Skip to main content

Module graph

Module graph 

Source
Expand description

Graph construction and analysis with cache-optimized CSR representation.

This module provides high-performance graph algorithms built on top of Compressed Sparse Row (CSR) format for maximum cache locality. Key features:

  • CSR representation (50-70% memory reduction vs HashMap)
  • Centrality measures (degree, betweenness, PageRank)
  • Parallel algorithms using Rayon
  • Numerical stability (Kahan summation in PageRank)

§Examples

use aprender::graph::{Graph, GraphCentrality};

let g = Graph::from_edges(&[(0, 1), (1, 2), (2, 0)], false);

let dc = g.degree_centrality();
assert_eq!(dc.len(), 3);

Re-exports§

pub use centrality::GraphCentrality;

Modules§

centrality
Graph centrality measures.

Structs§

Edge
Graph edge with optional weight.
Graph
Graph structure using CSR (Compressed Sparse Row) for cache efficiency.

Type Aliases§

NodeId
Graph node identifier (contiguous integers for cache efficiency).