(see Figure 8.33). The nearest neighbour to sub graph A–G is F as it has the smallest entry i.e. 1. Since by
adding F, no cycle is formed then it is added to the sub-graph. Now closest to A–G–F is the vertex E. It is
added to the subgraph as it does form a cycle. Similarly edges G–C, C–B, and C–D are added to obtain
the complete MST. The step by step creation of MST is shown in Figure 8.33.
8.4.5 Shortest Path Problem
The communication and transport networks are represented using graphs. Most of the time one is in-
terested to traverse a network from a source to destination by a shortest path. Foe example, how to
travel from D ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.