Earlier we noted that a path from to itself is called a circuit
(sometimes simple circuit) if it repeats no edges, and a cycle
(sometimes simple cycle) if it repeats no vertices except
. A
graph is acyclic if it contains no cycles with 2 or more
edges. A connected, acyclic graph with a distinguished vertex (a
vertex that we choose and keep track of) is called a tree
(the distinguished node is the root).
One sort of information that can be added to a graph is edge weight:
with each edge
, associate a number. Various applications
might use weighted graph to represent properties, for example
inter-city distances, average packet time between internet hosts,
etc.
Our two graph representations can be coerced into adding this
information: an adjacency matrix can store the edge weight for edge
in matrix[i][j]. In this scheme,
matrix[i][i] would be 0, and matrix[i][j] could
contain some special value (say
) if there is no edge
. Similarly, an adjacency list could add a member to each list
element to record the edge weight.