pub fn transitive_closure(graph: &Graph) -> IgraphResult<Graph>Expand description
Transitive closure of graph. The returned graph shares the same
vertex count and direction as the input.
For directed graphs every reachable ordered pair (u, v) (u != v)
becomes an edge. For undirected graphs each unordered reachable pair
{u, v} is added once.
Counterpart of igraph_transitive_closure(_, _) from
references/igraph/src/connectivity/reachability.c:225.
ยงExamples
use rust_igraph::{Graph, transitive_closure};
// Directed path 0 -> 1 -> 2: closure adds 0 -> 2.
let mut g = Graph::new(3, true).unwrap();
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
let tc = transitive_closure(&g).unwrap();
assert_eq!(tc.vcount(), 3);
assert_eq!(tc.ecount(), 3); // 0->1, 0->2, 1->2
assert!(tc.find_eid(0, 2).unwrap().is_some());