
Graph Terminology in Data Structures: Explained with Examples
Table of Content:
In this book, the following terms related to graphs are used:
Directed graph
A directed graph is a graph G =
Undirected graph
An undirected graph is a graph G =
Weighted graph
A weighted graph is a graph G =
Path
It is a sequence of nodes in which all the intermediate pair nodes between the first and the last nodes are joined by edges as shown in Figure 4 below. The path from A to F is shown with the help of dark edges. The path length is equal to the number of edges present in a path. The path length of A-D-E-F is 3 as it contains three edges.
However in the case of weighted graphs, the path length is computed as the sum of labels of the intermediate edges. For example, the path length of path A-D-C-E of Figure 3 above is (11 + 12 + 9), i.e., 32.
It may be noted that if no node occurs more E E than once in a path then the path is called a simple path. For example in Figure 2 above, A-B-C is a simple path. However, the path A-D-E-C-D is not a simple path.