| 1 | initial version |
Having defined A and G as follows,
sage: A = Matrix([[0, 1], [1, 0]])
sage: G = DiGraph(A)
we have a directed graph G, which has a method all_simple_cycles.
The following only refers to the method itself
sage: G.all_simple_cycles
<bound method DiGraph.all_simple_cycles of Digraph on 2 vertices>
while the following is the result of applying the method to G.
sage: G.all_simple_cycles()
[[0, 1, 0]]
So if we save the method itself,
sage: save(G.all_simple_cycles, 'temp22')
we can then reload it:
sage: asc = load('temp22')
sage: asc
<bound method ?.all_simple_cycles of Digraph on 2 vertices>
and possibly apply it to G:
sage: asc(G)
[[0, 1, 0]]
while if we save the result of applying the method to G,
sage: save(G.all_simple_cycles(), 'temp22')
then reloading it gets us the list of all simple cycles of G:
sage: ascG = load('temp22')
sage: ascG
[[0, 1, 0]]
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.