Skip to content

algo.personalizedPageRank has no direction or weightProperty, unlike algo.pagerank: a record with only outgoing edges always scores 0 #11146

Closed

Description

@chetto1983

algo.pagerank takes direction and weightProperty. algo.personalizedPageRank takes neither: it walks OUT only, and its docs do not say so.

So a vertex with no incoming edge scores 0 from any source. That is the shape of any record just written, which points at what already exists and has nothing pointing at it yet. For recommendation and classification, the newest record is usually the one being asked about.

Found while trying 26.11.1-SNAPSHOT before the release, as asked.

Measured

On 26.11.1-SNAPSHOT (build d6e16a35e, sha256:2852f6fb00d2), the graph in -> source -> out, with source as the source vertex:

Vertex Score
in 0.0
source 0.558
out 0.442

Asking for the other direction:

Call Result
algo.pagerank({direction: 'BOTH'}) works, in scores 0.26
algo.personalizedPageRank(s, {direction: 'BOTH'}) refused, the second argument must be the relationship types
algo.personalizedPageRank(s, 'E', 0.85, 20, 0.000001, 'BOTH') refused, too many arguments

The refusals are clear, and they are not the problem. There is simply no way to ask.

To reproduce

CREATE VERTEX TYPE N;
CREATE EDGE TYPE E;
CREATE (:N {k: 'in'}), (:N {k: 'source'}), (:N {k: 'out'});

MATCH (a:N {k: 'in'}), (s:N {k: 'source'}), (b:N {k: 'out'})
CREATE (a)-[:E]->(s), (s)-[:E]->(b);

MATCH (s:N {k: 'source'})
CALL algo.personalizedPageRank(s) YIELD nodeId, score
RETURN nodeId, score;

What it cost

In our graph every new record linked to existing ones, so all of them scored 0 from every source, and each one fell through to the caller's default. There was no error, and the result looked like a very poor model. Reading AlgoPersonalizedPageRank.java is what showed it.

The workaround is to write every edge twice, once each way, which doubles the edge count of the graph.

What would close it

  1. direction, with the name and the values algo.pagerank already uses, defaulting to OUT so nothing changes for current callers.
  2. weightProperty, same name again. Weights today apply to the source vertices only, while a similarity graph keeps its score on the edge. algo.pagerank and algo.louvain already read it.
  3. Until then, one line in reference/graph-algorithms/centrality.adoc saying the walk is OUT only.

The arguments are positional and already five, so an options map like algo.pagerank's may fit better than a sixth and a seventh.

Activity

  1. added
    enhancement
    severity:minor
    on Nov 2, 2026
  2. added
    in progress
    on Nov 2, 2026
  3. self-assigned this
    on Nov 2, 2026
  4. added this to the 26.11.1 milestone on Nov 2, 2026
  5. added a commit that references this issue on Nov 2, 2026
  6. removed
    in progress
    on Nov 2, 2026
  7. lvca commented on Nov 2, 2026

    @lvca
    Member

    Fixed in #11148, available from 26.11.1.

    algo.personalizedPageRank now accepts a config map as second argument, with the same names algo.pagerank uses:

    MATCH (s:N {k: 'source'})
    CALL algo.personalizedPageRank(s, {direction: 'BOTH', weightProperty: 'score'})
    YIELD nodeId, score
    RETURN nodeId, score
    • direction: OUT (default, unchanged behaviour), IN or BOTH. With BOTH, a record that only links to existing ones is reached, so no need to write every edge twice.
    • weightProperty: edge property used as weight; a vertex passes its score to its neighbours in proportion to the edge weights.
    • relTypes, dampingFactor, maxIterations, tolerance can go in the same map.

    The positional form keeps working as before, and the docs now state the default walk is OUT.


    ❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.

  8. added a commit that references this issue on Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementopencypherseverity:minor

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions