next | previous | forward | backward | up | top | index | toc | Macaulay2 website
Nauty :: graphToString

graphToString -- converts a graph to a string in the Graph6 format



This method converts various ways of representing a graph into nauty's Graph6 string format. Note that if the Ideal (or MonomialIdeal) passed to the method is not squarefree and monomial, then the method may have unknown and possibly undesired results.

In this example, all graphs are the 5-cycle.

i1 : graphToString({{0,1}, {1,2}, {2,3}, {3,4}, {0,4}}, 5)

o1 = Dhc
i2 : R = QQ[a..e];
i3 : graphToString monomialIdeal (a*c, a*d, b*d, b*e, c*e)

o3 = DUW
i4 : graphToString cycle R

o4 = Dhc
i5 : graphToString "Dhc"

o5 = Dhc

We note that if the input is a string, then the output is simply that string returned, regardless of format or correctness.


Notice that if using a List and number of vertices input to create the string, then the List must have vertices labeled $0$ to $n-1$.

The number of vertices $n$ must be positive as nauty cannot handle graphs with zero vertices.

See also

Ways to use graphToString :

For the programmer

The object graphToString is a method function.