Next: VertexMethods Up: Algorithms Previous: The Default Graph Object

## Building Graphs

Figure 2.2: Graph Attributes
Graph* | bipartiteRepresentation (Graph *g);

Primarily useful for obtaining alternate representations for hypergraphs, this function creates a new binary graph whose vertex set is the union of the vertex and edge sets of g. A Vertex v representing edge e of g is adjacent to the vertices representing vertices of g which are members of e.

int | compareVertexNames (char *, char *);

This is the default method for comparing vertices. Vertex names are character strings, but those strings most often contain digits. Standard lexicographic ordering of strings is therefore not very convenient most of the time. This routines determines if the strings represent integers, and if so, compares their integer values.

Graph* makeGraph(Set<Vertex*>, MSet<Edge*>); |
Graph* makeGraph(MSet<Vertex*> vset, MSet<Set<Vertex*> > eset); |
Graph* makeGraph(MSet<Vertex*> vset, MSet<Sequence<Vertex*> > eset); |
Graph* makeGraph(MSet<char*> vset, MSet<Set<char*> > eset); |
Graph* makeGraph(Set<char*> vseq, MSet<Sequence<char*> > eseq); |
Graph* makeGraph(Set<int*> vset, MSet<Set<int*> > eset); |

These routines dynamically allocate and construct a new graph of the appropriate type given the passed vertex and edge sets.

Graph* | directedGraph (const Graph* g);

Dynamically allocate a new empty graph of the same type as g, except if g is not directed. In that case, dynamically allocate a directed graph of the corresponding type.

Graph* | multiGraph (const Graph* g);

Dynamically allocate a new empty graph of the same type as g, except if g is a simple graph. In that case, dynamically allocate a multigraph of the corresponding type.

graph* | nautyGraph (const Graph* g);

Given a LINK graph object, return a graph in the format of nauty, the system due to Brendan McKay for identifying automorphism groups and testing isomorphism.

Graph* | newEmpty() onst Graph* g);

Dynamically allocate a new empty graph of the same type as g.

Graph* | simpleGraph (const Graph* g);

Dynamically allocate a new empty graph of the same type as g, except if g is a simple graph. In that case, dynamically allocate a multigraph of the corresponding type.

Graph* | undirectedGraph (const Graph* g);

Dynamically allocate a new empty graph of the same type as g, except if g is not undirected. In that case, dynamically allocate an undirected graph of the corresponding type.

Next: VertexMethods Up: Algorithms Previous: The Default Graph Object