Closed mading0817 closed 5 years ago
Try returning weight in the relationship cypher statement:
CALL algo.pageRank(
'MATCH (p:Person) RETURN id(p) as id',
'MATCH (p1:Person)-[r]-(p2:Person) RETURN id(p1) as source, id(p2) as target, r.weight as weight',
{graph:'cypher', direction: 'BOTH', iterations:20, dampingFactor:0.85, write: true,
writeProperty:"influence", weightProperty: 'weight'} ) YIELD nodes
Thanks a lot! It did work!!
The graph has node label with Person and relationship type with Human_Relation. Each relationship has a property which is called "weight" with initial value 0.5 I wish to use PageRank by cypher projection as followed:
CALL algo.pageRank( 'MATCH (p:Person) RETURN id(p) as id', 'MATCH (p1:Person)-[]-(p2:Person) RETURN id(p1) as source, id(p2) as target', {graph:'cypher', direction: 'BOTH', iterations:20, dampingFactor:0.85, write: true, writeProperty:"influence", direction: 'BOTH', weightProperty: 'weight'} )
I got the following result:![image](https://user-images.githubusercontent.com/32394010/54864647-04f2d600-4d95-11e9-98c0-d8aec5078399.png)
and the stream result as followed:![image](https://user-images.githubusercontent.com/32394010/54864693-9bbf9280-4d95-11e9-9405-af05d45a38c1.png)
As the influences are all the same, the PageRank obviously did not work the result shows correctly if I did not use cypher projection:
CALL algo.pageRank('Person', 'Human_Relation',{ iterations:20, direction:'both', dampingFactor:0.85, write: true, writeProperty:"influence", weightProperty: "weight" }) YIELD nodes, iterations, loadMillis, computeMillis, writeMillis, dampingFactor, write, writeProperty
So is this a bug or cypher projection does not support weightProperty or somewhere I had made a mistake?
Thanks, Regards