Efficiently Finding Cycles in a Graph: A Scientific Exploration

In summary, the conversation discusses finding all basic cycles in a graph using recursion and DFS. The attempt at a solution involves using a modified DFS method and considering Boruvka's algorithm for finding a minimum spanning tree. The question also brings up the possibility of using Boruvka's algorithm to get a minimum hitting set.
  • #1
wololo
27
0

Homework Statement


Capture.PNG


Homework Equations


Recursion, graphs, DFS

The Attempt at a Solution


To try to solve this algorithm, I first need to find all the basic cycles in the Graph G. When I have these cycles, I can simply pick the smallest edge in each of them and add them to the set F, while removing duplicates, which is trivial. However, I can't figure out an algorithm that would give me all the cycles in polynomial time.

I tried using a modified Depth First Search recursive method that, when it reaches a node that has already been visited, backtracks until it reaches again to find the cycle. However, for a simple graph with 8 nodes and 14 links my method gets called more than 500 times... I tried using what is described here: http://stackoverflow.com/questions/546655/finding-all-cycles-in-graph/549312#549312

Am I thinking about this problem correctly? What approach other than finding the cycles could I use? Thanks
 
Physics news on Phys.org
  • #2
Could I simply use Boruvka's algorithm to get a minimum spanning tree and add these edges to F?
 
  • #3
I think all the edges that are not in a maximum spanning tree wil give me the minimum hitting set.
 

1. How do you identify cycles in a graph?

To identify cycles in a graph, you can use a cycle detection algorithm such as Depth-First Search (DFS) or Breadth-First Search (BFS). These algorithms traverse the graph and keep track of visited nodes, and if a visited node is encountered again, it indicates the presence of a cycle.

2. What is the significance of finding cycles in a graph?

Finding cycles in a graph is important as it helps in understanding the structure and relationships within the graph. It can also help in identifying potential problems or errors in the data, as cycles in a graph can lead to infinite loops or incorrect results in certain applications.

3. Can a graph have multiple cycles?

Yes, a graph can have multiple cycles. In fact, most real-world graphs contain multiple cycles. For example, a social network graph can have cycles of friendships between individuals.

4. How can you break a cycle in a graph?

Breaking a cycle in a graph involves removing one or more edges from the graph. This can be done by using algorithms like Tarjan's algorithm or Johnson's algorithm, which find and remove the edges that form the cycles in the graph.

5. Are all cycles in a graph problematic or undesirable?

No, not all cycles in a graph are problematic or undesirable. In some cases, cycles can represent important patterns or relationships in the data. For example, in a transportation network, cycles can indicate possible routes or connections between different locations.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • General Math
Replies
5
Views
1K
  • Programming and Computer Science
Replies
3
Views
719
Replies
5
Views
989
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
3K
  • Precalculus Mathematics Homework Help
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
Back
Top