Tim Holdsworth
Tim Holdsworth

Reputation: 499

Weighted PageRank with Cypher Projection

I have a graph with nodes corresponding to papers, authors, and years, and I would like to calculate weighted PageRank based on co-authorship at a given point in time. The paper nodes have a year property and I am using a Cypher projection to get a subset of the nodes that exist in a given year for PageRank.

The problem is that the code below currently gives the same score for all nodes.

CALL algo.pageRank(
    "MATCH (a:Author)-[m:IN]->(y:Year {year: 2019})
    RETURN id(a) as id", 
    "MATCH (a1:Author)-[:AUTHORED]->(p:Paper)<-[:AUTHORED]-(a2:Author) 
    WHERE p.year <= 2019 and a1 <> a2
    RETURN id(a1) as source, id(a2) as target, count(distinct p) as num_coauth",
    {graph:'cypher', iterations:20, write:true, writeProperty: "PageRank", weightProperty: "num_coauth"});

Any help would be greately appreciated!

Upvotes: 0

Views: 75

Answers (1)

anderw
anderw

Reputation: 103

RETURN id(a1) as source, id(a2) as target, count(distinct q) as num_coauth",
                                                         ^^^

Should it be count(distinct p) instead? You never define what q is, so I would expect every score to be 0.

Upvotes: 1

Related Questions