![]() Volume 10, Issue 2 Articles In and Out Trott's Corner Beyond Sudoku New Products New Publications Calendar News Bulletins New Resources Classifieds Download This Issue Editorial Policy Staff and Contributors Submissions Subscriptions Advertising Back Issues Contact Information |
In and Out
HamiltonianCycleQ: I am interested in counting the number of paths from a node in a network back to that node, counting loops (cycles) only once. Is there any readily available code that does this? A: Steve Luttrell (steve_usenet@luttrell.org.uk) answers: Use HamiltonianCycle in the DiscreteMath`Combinatorica` package. Here is an example of how this solves your problem. Load the DiscreteMath`Combinatorica` package.
Here is a random, labeled graph on 10 vertices with an edge probability of
Using Highlight, display a HamiltonianCycle of the graph g.
The total number of Hamiltonian cycles is equal to the number of loops that start from and eventually return to any starting node, having visited every other node exactly once.
|
||||||||
About Mathematica | Download Mathematica Player © 2006 Wolfram Media, Inc. All rights reserved. |