pub fn get_adjacency(
graph: &Graph,
adj_type: AdjacencyType,
weights: Option<&[f64]>,
loops: LoopHandling,
) -> IgraphResult<Vec<Vec<f64>>>Expand description
Compute the adjacency matrix of a graph.
Returns an n×n matrix stored as Vec<Vec<f64>> in row-major order.
adj_type: which triangle to fill (ignored for directed graphs).weights: optional edge weights. IfNone, each edge counts as 1.loops: how to handle self-loop edges on the diagonal.
§Examples
use rust_igraph::{Graph, get_adjacency, AdjacencyType, LoopHandling};
// Triangle 0-1-2
let mut g = Graph::with_vertices(3);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
g.add_edge(0, 2).unwrap();
let adj = get_adjacency(&g, AdjacencyType::Both, None, LoopHandling::Once).unwrap();
assert!((adj[0][1] - 1.0).abs() < 1e-10);
assert!((adj[1][0] - 1.0).abs() < 1e-10);
assert!((adj[0][2] - 1.0).abs() < 1e-10);