cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

PageRank recommendation query

Riri2022
Node Link

I am trying to compute a page rank with the code below be I keep getting the error:

message: Type mismatch: expected String but was Map

 

result=gds.run_cypher('''
CALL gds.pageRank.stream({
  nodeQuery:'MATCH (d:Doc) WHERE d.id IN $isletter OR ((d) -[]- (n) 
             where n.id in $isletter) 
             RETURN DISTINCT id(d) AS id',
  relationshipQuery: 'MATCH (d:Doc)-[r:r1|r2|r3|r4|r5|r6]-(n:Doc)
                     WHERE (d) IN $isletter
                     RETURN id(d) as source, id(n) as target, 
                     r.weight_r1 as weight, r.weight_r2 as weight,
                     r.weight_r3 as weight, r.Weight_r4 as weight'
                 })
YIELD nodeId, score
return nodeId, score
ORDER BY score DESC''',params={'isletter': isletter})

 

Am I using the wrong syntax?

I previously wanted to create a projection first but that did not work as well. Here is how I did it:

 

pr, results = gds.graph.project(
    'myPRGraph', 
    '''MATCH (d:Doc) WHERE d.id IN $isletter OR ((d) -[]- (n) 
       where n.id in $isletter) 
       RETURN DISTINCT d.id AS id''', 
    '''MATCH (d:Document)-[r:r1|r2|r3|r4|r5|r6]-(n:Doc)
                 WHERE (d) IN $isletter
                 RETURN d.id as source, n.id as target, r.weight_r1 as
                 weight,r.weight_r2 as weight,r.weight_r3 as 
                 weight,r.weight_r4 as weight
                 ''', 
    {'parameters':{'isletter': isletter}}
)

 

And got the error below:

TypeError: __call__() takes 4 positional arguments but 5 were given

 Thanks in advance for your help. 

0 REPLIES 0