The previous post described the elementary data structure used to represent nodes of graphs in the Theme One program. This post describes the specific family of graphs employed by the program.
Figure 1 shows a typical example of a painted and rooted cactus.
o a | d o---o o \ / b c | o----o----o b e \ / \ / \ / \ / @ a c e Figure 1. Painted And Rooted Cactus
The graph itself is a mathematical object and does not inhabit the page or other medium before our eyes, and it must not be confused with any picture or other representation of it, anymore than we’d want someone to confuse us with a picture of ourselves, but it’s a fair enough picture, once we understand the conventions of representation involved.
Let be the set of nodes in a graph and let be a set of identifiers. We often find ourselves in situations where we have to consider many different ways of associating the nodes of with the identifiers in Various manners of associating nodes with identifiers have been given conventional names by different schools of graph theorists. I will give one way of describing a few of the most common patterns of association.
- A graph is painted if there is a relation between its node set and a set of identifiers, in which case the relation is called a painting and the identifiers are called paints.
- A graph is colored if there is a function from its node set to a set of identifiers, in which case the function is called a coloring and the identifiers are called colors.
- A graph is labeled if there is a one-to-one mapping between its node set and a set of identifiers, in which case the mapping is called a labeling and the identifiers are called labels.
- A graph is said to be rooted if it has a unique distinguished node, in which case the distinguished node is called the root of the graph. The graph in Figure 1 has a root node marked by the “at” sign or amphora symbol “”.
The graph in Figure 1 has eight nodes plus the five paints in the set The painting of nodes is indicated by drawing the paints of each node next to the node they paint. Observe that some nodes may be painted with an empty set of paints.
The structure of a painted and rooted cactus can be encoded in the form of a character string called a painted and rooted cactus expression. For the remainder of this discussion the terms cactus and cactus expression will be used to mean the painted and rooted varieties. A cactus expression is formed on an alphabet consisting of the relevant set of identifiers, the paints, together with three punctuation marks: the left parenthesis, the comma, and the right parenthesis.