Graph Algorithms
A graph showing the friends
A graph showing the friends
Fig. 1
A graph can show the relationships between friends. Each person has an unique number and a line is connected between two persons if they know each other. This graph can be represented by a grid (matrix).
Q1: Draw 4 persons (nodes) and connect some of them as you like. Can you make a matrix to show the graph?
Q2: Find all nodes from the graph (Fig. 1) starting node #3.