Cycle in a graph using degree of nodes of the graph

There are different ways of detecting cycle in a graph. Let us understand how to detect cycles in an undirected graph using the degree of each vertex.


Introduction

Our objective is to check if a cycle exists in an undirected graph. What is a cycle ? A graph that has a number of vertices connected in a close chain, is said to contain a cycle or a loop.

Look at the graph below :


graph1

Fig. 1


There is a cycle formed by the nodes 0,3,1 and 5.


NOTE : Self loops are also considered as a cycle in the graph....

 •  0 comments  •  flag
Share on Twitter
Published on November 02, 2020 22:59
No comments have been added yet.