This method generates all graphs on $n$ vertices subject to the constraints on the number of edges. It uses numerous options to allow further constraining of the output.
If a PolynomialRing $R$ is supplied instead, then the number of vertices is the number of generators. Moreover, the nauty-derived strings are automatically converted to instances of the class Graph in $R$.
i1 : R = QQ[a..e]; |
i2 : generateGraphs(R, 4, 6, OnlyConnected => true) o2 = {Graph{edges => {{a, e}, {b, e}, {c, e}, {d, e}}}, Graph{edges => {{a, d}, {a, e}, {b, e}, {c, e}}}, ring => R ring => R vertices => {a, b, c, d, e} vertices => {a, b, c, d, e} ---------------------------------------------------------------------------------------------------------------------------- Graph{edges => {{a, d}, {a, e}, {b, e}, {c, e}, {d, e}}}, Graph{edges => {{a, d}, {b, d}, {a, e}, {b, e}, {c, e}}}, ring => R ring => R vertices => {a, b, c, d, e} vertices => {a, b, c, d, e} ---------------------------------------------------------------------------------------------------------------------------- Graph{edges => {{a, d}, {b, d}, {a, e}, {c, e}, {d, e}}}, Graph{edges => {{a, d}, {b, d}, {a, e}, {b, e}, {c, e}, {d, e}}}, ring => R ring => R vertices => {a, b, c, d, e} vertices => {a, b, c, d, e} ---------------------------------------------------------------------------------------------------------------------------- Graph{edges => {{a, d}, {b, d}, {c, d}, {a, e}, {b, e}, {c, e}}}, Graph{edges => {{a, c}, {b, d}, {a, e}, {b, e}}}, ring => R ring => R vertices => {a, b, c, d, e} vertices => {a, b, c, d, e} ---------------------------------------------------------------------------------------------------------------------------- Graph{edges => {{a, c}, {b, d}, {a, e}, {b, e}, {c, e}}}, Graph{edges => {{a, c}, {b, d}, {a, e}, {b, e}, {c, e}, {d, e}}}, ring => R ring => R vertices => {a, b, c, d, e} vertices => {a, b, c, d, e} ---------------------------------------------------------------------------------------------------------------------------- Graph{edges => {{a, c}, {a, d}, {b, d}, {b, e}, {c, e}}}, Graph{edges => {{a, c}, {a, d}, {b, d}, {a, e}, {b, e}, {c, e}}}, ring => R ring => R vertices => {a, b, c, d, e} vertices => {a, b, c, d, e} ---------------------------------------------------------------------------------------------------------------------------- Graph{edges => {{a, c}, {a, d}, {c, d}, {a, e}, {b, e}, {c, e}}}} ring => R vertices => {a, b, c, d, e} o2 : List |
The number of vertices $n$ must be positive as nauty cannot handle graphs with zero vertices.
The object generateGraphs is a method function with options.