The routing algorithm is used to find the good path (A path has the least cost) from the source router to the destination router.

A graph G= (N, E) is a collection of nodes and edges, where N is a node and E is an edge.

**Consider the following figure:**

• In the network layer routing, the nodes are called as “routers” and the edges are used connect the nodes, it represents the “physical links” between the routers.

• Every edge has a value, and which is represents its cost. An edge cost reflects the length of the physical link.

From the above figure, the graph model of a computer network consists of 6 routers (u, v, w, x, y, and z).

**Path**

A path in a graph G (N, E) is a sequence of routers or nodes and each of the pairs are edges in E. In any graph, there are many paths between the nodes.

**The following are the paths from source node y to the destination node u that do not contain any loops in the above graph (Figure 4.27):**

Therefore, there are 15 paths that do not form cycles from source node “y” to the destination node “u”.

If you found this answer helpful, please upvote and share with other students in your network.