Expand description
The pure-algorithm graph analysis toolbox (centrality / community /
pathfinding / cycles / components / k-core / similarity) — the compute core of the
graph-DB IDE. Index-based (n, edges); no egui, no GPU.
Graph analysis — the pure-algorithm core of the graph-DB IDE (V.G / G.V()).
Every algorithm works on the index-based representation (n, edges) — n
nodes numbered 0..n and edges: &[(usize, usize)] (directed from → to) — the
same shape crate::community::louvain already uses, so a caller maps its
GraphModel (String ids) to indices once and runs the whole toolbox. Results are
plain Vecs keyed by node index. No egui, no GPU, no RNG — deterministic and
headless-testable.
Groups:
- [
centrality] — degree / betweenness / closeness / pagerank / eigenvector. community— Louvain (re-exported) + label propagation.- [
pathfinding] — BFS / DFS / shortest path / all simple paths. - [
cycles] — cycle detection + topological sort. - [
components] — connected (undirected) + strongly-connected (Tarjan). - [
kcore] — k-core decomposition (core numbers). - [
similarity] — Jaccard / common-neighbours / Adamic–Adar / cosine. - [
stats] — whole-graph clustering coefficient + diameter / average path length.
Modules§
- centrality
- Centrality — who matters in the graph, five ways. All return a
Vec<f32>indexed by node (0..n). Deterministic; no RNG. - community
- Community detection — the analysis-toolbox front door. Louvain modularity
optimisation is re-exported from
crate::community(the existing, well-tested implementation that drives the semantic-zoom meta-graph); label propagation is added here as a fast near-linear alternative. - components
- Connected components — undirected (union-find) + strongly-connected
(Tarjan, directed). Both return a labelling
Vec<usize>(comp[i]= component id, compact0..count) plus the componentcount. - cycles
- Cycles & ordering — directed cycle detection, a topological sort (Kahn),
and elementary-cycle enumeration (Johnson-style, bounded). Directed, over the
outview. - kcore
- k-core decomposition — each node’s core number: the largest
ksuch that the node survives repeatedly peeling away every node of undirected degree< k. High core numbers mark the dense, well-connected heart of the graph. - pathfinding
- Pathfinding — BFS / DFS orders, shortest paths (unweighted BFS + weighted
Dijkstra), and all simple paths between two nodes. Directed (over the
outview); pass anAdjacencybuilt from undirected-doubled edges for undirected search. - similarity
- Node similarity — neighbourhood-overlap measures over the undirected view: common neighbours, Jaccard, Adamic–Adar, and cosine. Each compares two nodes by how much their neighbour sets overlap — the link-prediction / “you may also know” primitive.
- stats
- Whole-graph statistics — the scalar summaries a stats panel shows, computed on
the undirected view: the clustering coefficient (how tightly neighbourhoods
close into triangles) and the diameter / average path length (the graph’s
reach). These fill the two gaps the rest of
superleft open.
Structs§
- Adjacency
- A built adjacency over
nindexed nodes: directed out / in neighbour lists plus an undirected view, each carrying an edge weight (1.0for unweighted input). Built once from(n, edges)and shared by the analysis algorithms.