Skip to main content

graph_count

Function graph_count 

Source
pub fn graph_count(n: u32, directed: bool) -> IgraphResult<u64>
Expand description

Return the number of non-isomorphic simple graphs on n vertices.

For undirected graphs, supports n up to 14. For directed graphs, supports n up to 9.

§Arguments

  • n — number of vertices.
  • directed — whether to count directed graphs.

§Errors

Returns an error if n is too large for the lookup table.

§Examples

use rust_igraph::graph_count;

// 2 non-isomorphic undirected graphs on 2 vertices: empty and K2
assert_eq!(graph_count(2, false).unwrap(), 2);
// 3 non-isomorphic directed graphs on 2 vertices
assert_eq!(graph_count(2, true).unwrap(), 3);
// 4 undirected graphs on 3 vertices
assert_eq!(graph_count(3, false).unwrap(), 4);