Page 190 - DCAP407_DATA_STRUCTURE
P. 190
Unit 10: Trees
Figure 10.7 shows example of directed graph.
Figure 10.7: Example for Directed Graph
In figure 10.7, the nodes of the tree represent cities. The arc represents the day and time of the flight
from Delhi to Agra. The time of the flight from Delhi to Agra is not equal to the time of the flight from
Agra to Delhi. Here, (Delhi, Agra) is not equal to (Agra, Delhi).
Undirected Graphs
An undirected graph is a graph in which each edge has no direction.
The figure 10.8 shows an undirected graph.
Figure 10.8: An Undirected Graph
An undirected graph (G) consists of a set of vertices (V) and a set of edges (E). Each edge in undirected
graphs has a disorganized pair of vertices.
An edge is an unordered pair of vertices. If (a,b) is an undirected edge, then (a,b) = (b,a).
Figure 10.9: Example for Undirected Graph
In figure 10.9, the nodes of the tree represent cities. The edge represents the distance between the cities.
The distance from Delhi to Agra is equal to the distance from Agra to Delhi. Here, (Delhi, Agra) is equal
to (Agra, Delhi).
Mixed Graph
A mixed graph G contains both directed and undirected edges. It is represented as:
G = (V, E, A)
Where, V refers to a set of vertices, E refers to a set of edges and A refers to a set of arcs.
LOVELY PROFESSIONAL UNIVERSITY 183