pub fn is_chain_graph(graph: &Graph) -> IgraphResult<bool>Expand description
Check whether a graph is a chain graph.
A bipartite graph is a chain graph if the neighborhoods of the
vertices in each part are totally ordered by inclusion.
Returns false for non-bipartite or directed graphs.
ยงExamples
use rust_igraph::{Graph, is_chain_graph};
// Complete bipartite `K_{2,3}` is a chain graph
let mut g = Graph::with_vertices(5);
g.add_edge(0, 2).unwrap();
g.add_edge(0, 3).unwrap();
g.add_edge(0, 4).unwrap();
g.add_edge(1, 2).unwrap();
g.add_edge(1, 3).unwrap();
g.add_edge(1, 4).unwrap();
assert!(is_chain_graph(&g).unwrap());
// `C_6` is bipartite but NOT a chain graph (has induced `2K_2`)
let mut g = Graph::with_vertices(6);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
g.add_edge(2, 3).unwrap();
g.add_edge(3, 4).unwrap();
g.add_edge(4, 5).unwrap();
g.add_edge(5, 0).unwrap();
assert!(!is_chain_graph(&g).unwrap());