How to find all simple cycles in an undirected graph efficiently?

Let’s learn how to find all simple cycles in an undirected graph efficiently. The most accurate or helpful solution is served by Stack Overflow.

There are ten answers to this question.

Best solution

How can I find the number of Hamiltonian cycles in a complete undirected graph?

Can someone explain how to find the number of Hamiltonian cycles in a complete undirected graph? Wikipedia says that the formula is (n-1)!/2, but when I calculated using this formula, K3 has only one cycle and K4 has 5. Was my calculation incorrect?

Answer:

Since the graph is complete, any permutation starting with a fixed vertex gives an (almost) unique cycle...

Read more

avd at Stack Overflow Mark as irrelevant Undo

Other solutions

How can we find all simple cycles in an undirected graph efficiently?

Can someone tell me, how to find those points which are forming cycle in a graph. Ex: let's a graph has following edges: 0 1 1 2 2 3 3 4 5 2 4 6 6 5 so here, 2,3,4,5,6 are points which are forming cycles in graph.

Answer:

The main algorithm in An efficient algorithm for the symmetric principal minor assignment problem has...

Read more

Justin Rising at Quora Mark as irrelevant Undo

What is average number of cycles in an undirected ordered graph of size n?

What is average number of cycles in an undirected ordered graph of size n? I've tried finding sum of number of cycles in all sorts of a graph of size n but I couldn't find ...show more

Answer:

eadc

Read more

LY6A4AIH6LIZKKZ6YP5P4YXEHQ at Yahoo! Answers Mark as irrelevant Undo

In a weighted undirected graph, how do I find a fixed length path between two nodes?

I would like an algorithm or pointers to further research on how to find a fixed length path between two nodes in a weighted undirected graph.

Answer:

If your desired length is small, then the color-coding method is pretty reasonable. See Color-coding...

Read more

Aaron Schild at Quora Mark as irrelevant Undo

How can I find a path of a given length between two nodes in a weighted (undirected) graph?

Given a graph, how can I find a path of length X between two nodes in the graph. The path should ideally visit an edge no more than once.

Answer:

You can use a customized version of Uniform-cost search. Use Uniform-cost search but do not keep track...

Read more

Fardad Jalili at Quora Mark as irrelevant Undo

Given a graph, what are some of the best algorithms (what is the best algorithm) to find all the simple paths (i.e. no cycles) between any two nodes?

Some of the edges are undirected, some of them are directed.. That being the case, what is the best algorithm to find all the simple paths in a graph?

Answer:

The National Institute of Standards and Technology (NIST) online Dictionary of Algorithms and Data Structures...

Read more

Andrew Webb at Quora Mark as irrelevant Undo

How can I find the shortest path between two nodes if there might be negative cycles in the graph?

I remember reading somewhere that this is a NP hard problem. But what if I add an aditional clause that guarantees that even though there might be a negative cycle in the graph, there exists a path that doesn't go through the negative cycle?

Answer:

bellman-ford algorithm

Read more

Anusha Gudladana at Quora Mark as irrelevant Undo

Min-Cost Fixed Flow in Undirected graph

I need to solve following problem. I have undirected graph, source node S, sink node T, flow X to send from S to T, capacity C(i,j) of each vertex in undirected graph and price P(i,j) for single unit of flow for each vertex. Task is to find Min-Cost...

Answer:

Hi, kalitar-ga: A nice summary of the relationship between linear programming problems generally and...

Read more

kalitar-ga at Google Answers Mark as irrelevant Undo

MapReduce: How to find Online Communities by removing nodes(vertices) from a social graph?

I want to carry out Graph Clustering in a huge undirected graph with millions of edges and nodes. Graph is almost clustered with  different clusters joined together only by some nodes(kind of ambiguous  nodes which can relate to multiple clusters). There...

Answer:

Got this answer on Stackoverflow[1] ....  analysing networks with millions of nodes Seems legit, in...

Read more

Shashank Gupta at Quora Mark as irrelevant Undo

Is there an efficient algorithm to enumerate all the cycles within the Strongly Connected Component of a directed graph?

What is the most efficient algorithm to decompose a Strongly Connected Component of a directed graph into ALL of the constituent cycles? I solved this in a brute-force manner (Do DFS within the SCC from "every" vertex, find cycles by detecting...

Answer:

D. B. Johnson, "Finding All the Elementary Circuits of a Directed Graph," SIAM Journal of...

Read more

Abhijeet N. Vaidya at Quora Mark as irrelevant Undo

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.