Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

To find a Hamiltonian circuit in a graph #1422

Closed
OrkoHunter opened this issue Mar 21, 2015 · 6 comments
Closed

To find a Hamiltonian circuit in a graph #1422

OrkoHunter opened this issue Mar 21, 2015 · 6 comments

Comments

@OrkoHunter
Copy link
Contributor

I was wondering if there's a way to find if a graph whether directed or undirected has a Hamiltonian path or not i.e. a path visiting each vertex exactly once. For graphs with small number of nodes, it can be done easily, but it won't be easy for bigger graphs with more branches. I was thinking to implement a way to find the Hamiltonian circuit in such graphs.

Any suggestions?

@MridulS
Copy link
Member

MridulS commented Mar 21, 2015

@OrkoHunter

def all_simple_paths(G, source, target, cutoff=None):
and
def hamiltonian_path(G,source):

@OrkoHunter
Copy link
Contributor Author

@MridulS Thanks for pointing that out. At least it is there already.
But I have no idea how can we use it.
And why is it under the tests?
There's no mention of it in the documentation either

@ysitu
Copy link
Contributor

ysitu commented Mar 21, 2015

Implementing "a way" is easy. Implementing "a good way" is hard.

@OrkoHunter
Copy link
Contributor Author

@ysitu So, I think a way exist here

def hamiltonian_path(G,source):

But I can't figure out how can someone make use of it. It's under tests.

@MridulS
Copy link
Member

MridulS commented Mar 22, 2015

@OrkoHunter You do realise that the hamiltonian path problem is a NP-Complete problem. As @ysitu pointed out it will be a hard to implement it in a "good way" .

@ysitu ysitu added this to the networkx-future milestone Apr 27, 2015
@hagberg
Copy link
Member

hagberg commented Nov 24, 2017

Closed due to inactivity.

@hagberg hagberg closed this as completed Nov 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants