Let G be the undirected graph given below.
(a) Find the number of paths from vertex a to vertex b.
(b) Find the number of trails from vertex a to vertex b.
(c) Find all cycles starting at vertex a.
Solution
A path is a walk that does not include any vertex twice, except that its first vertex might be the same as its last.
A trail is a walk that does not pass over the same edge twice. A trail might visit the same vertex twice, but only if it comes and goes from a different edge each time.
A cycle is a path that begins and ends on the same vertex.
(a) number of paths from a to b are 3 ( a-b , a-d-b , a-d-c-b)
(b) number of paths from a to b are 5( a-b , a-d-b , a-d-c-b , a-b-c-d-b , a-b-d-c-b)
(b) number of cycles from a to b are 4( a-b-d-a , a-d-b-a , a-d-c-b-a , a-b-c-d-a)
.