Skip to main content

Module graph_algorithms

Module graph_algorithms 

Source
Expand description

Pure graph algorithms operating on abstract node/edge inputs.

This module is deliberately self-contained: it has NO dependency on catalog, storage, cluster, or GraphStore types. Callers (e.g. the query executor) materialize a node-id list plus weighted edges and call into these pure functions. This keeps the algorithms easy to test and reuse, and separate from the storage-coupled crate::storage::engine::algorithms helpers.

Functions§

betweenness
Betweenness centrality over an abstract undirected, unweighted graph using Brandes’ algorithm.
connected_components
Compute connected components over an abstract graph.
eigenvector
Eigenvector centrality over an abstract undirected, unweighted graph via power iteration on the adjacency matrix.
louvain
Detect communities with the Louvain modularity-maximisation algorithm over an abstract undirected weighted graph.
modularity
Public modularity helper over the abstract graph for a given node→community labelling (as produced by louvain). Exposed for tests and callers that want to score a partition. Edges are treated as undirected; resolution is the γ parameter. Returns 0.0 for an edgeless graph.
pagerank
PageRank over an abstract undirected, unweighted graph.
shortest_path
Single-source single-target shortest path over an abstract undirected weighted graph.
spectral_embedding
Deterministic 2D spectral layout over an abstract undirected, unweighted graph. Returns one (node, (x, y)) pair per distinct node with both coordinates min–max normalised to [0, 1].

Type Aliases§

Weight
Edge weight type. The storage layer uses f32 for edge weight, so we mirror that here. Weight is accepted for API compatibility; connectivity treats edges as unweighted/undirected.