Graph A data structure that consists of a set of nodes and a set of edges that relate the nodes to each other Vertex A node in a graph Edge (Arc) A pair of vertices representing a connection between two nodes in a graph Undirected graph A graph in which the edges have no direction Directed graph (Digraph) A graph in which each edge is directed from one vertex to another (or the same) vertex 310 Chapter 9 Abstract Data Types and Algorithms Graphs Trees are a useful way to represent relationships in which a hierarchy exists. That is, a node is pointed to by at most one other node (its parent). If we remove the restriction that each node may have only one parent node, we have a data structure called a graph . A graph is made up of a set of nodes called vertices and a set of lines called edges (or arcs ) that connect the nodes. The vertices in the graph represent objects and the edges describe rela-tionships among the vertices. For instance, if the graph is representing a map, the vertices might be the names of cities and the edges that link the
This is the end of the preview.
access the rest of the document.