Skip to main content

treewidth_upper_bound

Function treewidth_upper_bound 

Source
pub fn treewidth_upper_bound(graph: &Graph) -> IgraphResult<u32>
Expand description

Compute an upper bound on treewidth via min-degree elimination.

Repeatedly eliminates the vertex with minimum degree, connecting all its neighbours (creating a clique), and tracks the maximum degree at elimination time.

ยงExamples

use rust_igraph::{Graph, treewidth_upper_bound};

// Path graph: treewidth = 1
let g = Graph::from_edges(&[(0,1),(1,2),(2,3)], false, Some(4)).unwrap();
assert_eq!(treewidth_upper_bound(&g).unwrap(), 1);