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

## Synopsis

• Usage:
S = graphToString(E, n)
S = graphToString I
S = graphToString G
S = graphToString T
• Inputs:
• E, a list, a list of edge pairs
• n, an integer, the number of vertices in the graph, must be positive (see caveat)
• I, an ideal, the edge ideal of a graph
• G, ,
• T, , a string containing a graph; the string automatically passes through untouched
• Outputs:
• S, , the graph converted to a Graph6 format string

## Description

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.

## Caveat

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.

## Ways to use graphToString :

• "graphToString(Graph)"
• "graphToString(Ideal)"
• "graphToString(List,ZZ)"
• "graphToString(MonomialIdeal)"
• "graphToString(String)"

## For the programmer

The object graphToString is .