Skip to content

Document the algo.pagerank direction property (OUT/IN/BOTH), and correct its default #446

Description

@robfrank

The algo.pagerank reference page does not document the direction config property at all, and the shared note that describes direction generically is inaccurate for PageRank specifically. This matters more now than it did: until ArcadeData/arcadedb#6956, direction: 'IN' did not actually work, so there was little to document. It works now, and the page should say so.

Source of truth for all of the below: ArcadeData/arcadedb#6956 (fix(pagerank): honor IN direction in OLTP fallback), plus the class Javadoc on AlgoPageRank and GraphAlgorithms.pageRank after that PR.

1. direction is missing from the algo.pagerank page

src/main/asciidoc/reference/graph-algorithms/centrality.adoc omits it from both the syntax block and the parameters table.

Current syntax line:

CALL algo.pagerank([{dampingFactor: 0.85, maxIterations: 20, tolerance: 0.0001, weightProperty: null}])
YIELD node, score

Suggested:

CALL algo.pagerank([{dampingFactor: 0.85, maxIterations: 20, tolerance: 0.0001, weightProperty: null, direction: 'OUT'}])
YIELD node, score

And a parameters-table row:

Parameter Type Required Default Description
direction String No OUT Edge direction rank is pushed along: OUT, IN, or BOTH

2. The default is OUT, not BOTH

src/main/asciidoc/reference/graph-algorithms/notes.adoc says:

  • "BOTH" — edges in either direction (default for most algorithms)

That default does not hold for PageRank, which defaults to OUT (AlgoPageRank.execute: an absent or non-String direction yields Vertex.DIRECTION.OUT). A reader who takes the shared note at face value will assume undirected behaviour and get directed scores. Worth an explicit "PageRank defaults to OUT" either on the PageRank page or as a carve-out in the note.

3. "which edges are considered" understates what IN does for PageRank

The shared note frames direction as a filter. For PageRank it is not a filter, it selects which edges rank flows along:

  • OUT — rank is pushed along stored edges
  • IN — rank is pushed along the reverse of every edge, i.e. PageRank over the reversed graph, without materializing a reversed copy
  • BOTH — pushed both ways, treating the graph as undirected

IN is the useful way to ask "which vertices are important because of what points at them, reversed" — for example ranking sources rather than sinks in a citation or link graph. Calling it a filter makes it read like a minor variant of OUT, which is how the bug in #6956 went unnoticed.

4. The dangling-node sentence is direction-dependent

The Description currently reads:

Dangling nodes (no outgoing edges) contribute their rank to all nodes proportionally via the teleportation mechanism.

"No outgoing edges" is only true for OUT. Dangling means "no edges in the direction rank is being pushed" — so under IN a dangling node is one with no incoming edges, and under BOTH one with no edges at all. Suggest rewording to something like "Dangling nodes (no edges in the direction rank is pushed along)".

Note for whoever picks this up

direction applies to both execution paths — the CSR/Graph-Analytical-View path and the OLTP fallback — and they agree on all three values as of #6956. Weighted PageRank (weightProperty set) always uses the OLTP path; that is also currently undocumented and may be worth a sentence, since it has performance implications on a graph that otherwise has a covering view.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions