Graph algorithms

Choose a graph projection, run an algorithm on the sample, and interpret its result and resource use.

On this page

Choose an algorithm and graph scope

Shortest path
Find a low-cost route between known endpoints. Decide whether cost means hops or a mapped numeric edge property.
PageRank
Rank nodes in a directed graph based on incoming relationships and how their sources distribute rank.
Weakly connected components
Group nodes connected by any route when edge direction is ignored.
Communities and embeddings
Use Louvain or Leiden to group a projected graph, and Node2Vec to produce vector features.

Choose edge types, direction, and weights before running the algorithm. If you use a weight, all selected edge types must expose that field with supported numeric values. The examples below use the three-account sample.

Rank accounts with PageRank

Cypher
CALL algo.pagerank({relationshipTypes: ['Transfer']})
YIELD id, rank
RETURN id.key AS account, rank
ORDER BY rank DESC, account

Expect a score for each of the three accounts. Sort by rank to compare nodes within the same projection. Changing edge selection or direction changes the graph being ranked.

Find connected groups

Cypher
CALL algo.wcc({relationshipTypes: ['Transfer']})
YIELD id, component
RETURN id.key AS account, component
ORDER BY account

Alice, Bob, and Carol share one component. Comparing component IDs tells you whether nodes lie in the same group. A common component does not, by itself, specify a directed route.

Find a weighted route

Run the CLI command in the sample directory. This treats the transfer amount as an illustrative numeric cost.

Shell
/opt/graphlake/current/bin/graphlake --catalog graph.yaml route \
  --edge Transfer --weight amount \
  --start-label Account --start 1 --target-label Account --target 3

Expected result A two-hop route from account 1 to 3, with exact cost 37.75.

Choose live data or a CSR generation

For repeated graph traversals, an administrator or publisher can build a CSR generation, which is a compressed adjacency snapshot of a published model. In Query options, choose an available generation only if its source state and graph scope match the question. Rebuild after changing mapped data or scope when the result needs the new state.

In a cluster, supported PageRank and component workloads can use partitioned CSR. Community detection and Node2Vec work on a whole projection on the execution node. Check available operations, memory budgets, and weighting rules in the algorithm reference.