AllGraphs - Maple Help

GraphTheory

 AllGraphs
 generate iterator to traverse all graphs meeting specified conditions

 Calling Sequence AllGraphs(opts)

Parameters

 opts - (optional) argument of the form option or option=value where option is one of vertices, edges, connected, directed, nonisomorphic.

Options

 • vertices=nonnegative integer or range, size of graphs appearing in the iteration
 Specifies the size of graphs that appear in the resulting iteration.
 • edges=nonnegative integer or range, edge count of graphs appearing in the iteration
 Specifies the edge count of graphs that appear in the resulting iteration.
 • connected=truefalse
 If true, specifies that only connected graphs should appear in the iteration.
 • directed=truefalse
 Specifies whether the returned graphs should be directed or undirected.
 • nonisomorphic=truefalse
 If true, specifies that only one representative of each isomorphic class should appear in the iteration.

Description

 • The AllGraphs(opts) command returns an iterator object which can be used to traverse all graphs meeting the specified conditions.
 • With each step, the iterator object will return a Graph object.

Iterator Objects

 • The iterator object is an Iterator with hasNext and getNext methods as defined by the Iterator API.
 • The state of an iterator object iter may be reset to the beginning of the iteration by invoking Reset(iter).

Examples

 > $\mathrm{iterator}≔\mathrm{GraphTheory}\left[\mathrm{AllGraphs}\right]\left(\mathrm{vertices}=3,\mathrm{nonisomorphic}\right)$
 ${\mathrm{iterator}}{≔}\left[\begin{array}{c}{\mathrm{Graph Iterator}}\\ {\mathrm{Vertices: 3..3}}\\ {\mathrm{Edges: 0..infinity}}\\ {\mathrm{connected=false, directed=false, selfloops=false, nonisomorphic=true}}\end{array}\right]$ (1)
 > $\mathrm{iterator}:-\mathrm{getNext}\left(\right)$
 ${\mathrm{Graph 1: an undirected graph with 3 vertices and 0 edge\left(s\right)}}$ (2)
 > $\mathrm{iterator}:-\mathrm{getNext}\left(\right)$
 ${\mathrm{Graph 2: an undirected graph with 3 vertices and 1 edge\left(s\right)}}$ (3)
 > $\mathrm{iterator}:-\mathrm{getNext}\left(\right)$
 ${\mathrm{Graph 3: an undirected graph with 3 vertices and 2 edge\left(s\right)}}$ (4)
 > $\mathrm{iterator}:-\mathrm{getNext}\left(\right)$
 ${\mathrm{Graph 4: an undirected graph with 3 vertices and 3 edge\left(s\right)}}$ (5)
 > $\mathrm{iterator}:-\mathrm{hasNext}\left(\right)$
 ${\mathrm{false}}$ (6)

Compatibility

 • The GraphTheory[AllGraphs] command was introduced in Maple 2024.