How do I count the number of simple cycles in a graph?

429 views
Skip to first unread message

Kristaps Balodis

unread,
Oct 4, 2016, 5:46:17 AM10/4/16
to sage-support
Specifically I would like to figure out what to type in order to compute the number of simple cycles in the Hoffman-Singleton graph.  

David Joyner

unread,
Oct 4, 2016, 6:12:20 AM10/4/16
to SAGE support
Does this help?
http://doc.sagemath.org/html/en/reference/graphs/sage/graphs/digraph.html#sage.graphs.digraph.DiGraph.all_simple_cycles

> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support...@googlegroups.com.
> To post to this group, send email to sage-s...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.

Kristaps Balodis

unread,
Oct 4, 2016, 11:39:38 PM10/4/16
to sage-support


I seem to be confused about the language here.  For instance when asking about simple cycles in the Peterson graph it gives things like [0,4,0] but the petersen graph doesn't have any cycles shorter than length 5...

John H Palmieri

unread,
Oct 5, 2016, 12:21:23 AM10/5/16
to sage-support


On Tuesday, October 4, 2016 at 8:39:38 PM UTC-7, Kristaps Balodis wrote:


I seem to be confused about the language here.  For instance when asking about simple cycles in the Peterson graph it gives things like [0,4,0] but the petersen graph doesn't have any cycles shorter than length 5...

The previous answer deals with a directed graph version of the Petersen graph, where each edge in the original is replaced by a pair of directed edges, one in each direction. For the undirected case you could try g.cycle_basis(...): see http://doc.sagemath.org/html/en/reference/graphs/sage/graphs/generic_graph.html#sage.graphs.generic_graph.GenericGraph.cycle_basis.


Kristaps Balodis

unread,
Oct 6, 2016, 2:52:40 PM10/6/16
to sage-support
Ah thanks that makes sense.  I don't think that the cycle basis will help me though as it will only list one possible basis for the cycle space, not all cycles.  Furthermore cycle space isn't accurately named as it's really a 'circuit space', which is to say it contains disjoint cycles, and well as circuits which are cycles that allow repeated vertices and edges.  
Reply all
Reply to author
Forward
0 new messages