Skip to content

Latest commit

 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Cycles Detection in an Undirected Graph (Cyclic Undirected Graph Conversion to Acyclic Graph)

In this code, you can create an undirected graph and add its edges; then, the code finds all cycles also cycles of the cycle in the graph and print its members. The main idea is finding one cycle at the time and destroy it, then repeat this process until no cycle will be found in the graph. in the final, your graph will not have any cycle in it. For example, consider the following undirected graph:

When run the code, you see this out put

cycle 1: [2, 3, 4, 1, 0]
cycle 2: [9, 8, 7]
cycle 3: [5, 10, 9, 8, 7, 2, 3]
cycle 4: [6, 5, 10, 9, 8, 7, 2, 3, 4]

About

In this python script, you can create an undirected graph then convert it to a acyclic graph

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages