ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 08 Sep 2020 10:20:50 +0200- Is it possible to know the corresponding graph labeling after using "relabel()"?https://ask.sagemath.org/question/53363/is-it-possible-to-know-the-corresponding-graph-labeling-after-using-relabel/**I am trying to generate the following cayley graph**
G=AlternatingGroup(5)
S=[(1,2,3),(1,2,4),(1,2,5)]
C=G.cayley_graph(generators=S, simple=True)
U=C.to_undirected()
U.vertices()
[(), (3,4,5), (3,5,4), (2,3)(4,5), (2,3,4), (2,3,5), (2,4,3), (2,4,5), (2,4)(3,5), (2,5,3), (2,5,4), (2,5)(3,4), (1,2)(4,5), (1,2)(3,4), (1,2)(3,5), (1,2,3), (1,2,3,4,5), (1,2,3,5,4), (1,2,4,5,3), (1,2,4), (1,2,4,3,5), (1,2,5,4,3), (1,2,5), (1,2,5,3,4), (1,3,2), (1,3,4,5,2), (1,3,5,4,2), (1,3)(4,5), (1,3,4), (1,3,5), (1,3)(2,4), (1,3,2,4,5), (1,3,5,2,4), (1,3)(2,5), (1,3,2,5,4), (1,3,4,2,5), (1,4,5,3,2), (1,4,2), (1,4,3,5,2), (1,4,3), (1,4,5), (1,4)(3,5), (1,4,5,2,3), (1,4)(2,3), (1,4,2,3,5), (1,4,2,5,3), (1,4,3,2,5), (1,4)(2,5), (1,5,4,3,2), (1,5,2), (1,5,3,4,2), (1,5,3), (1,5,4), (1,5)(3,4), (1,5,4,2,3), (1,5)(2,3), (1,5,2,3,4), (1,5,2,4,3), (1,5,3,2,4), (1,5)(2,4)]
**Here, I used the "relabel()" function and I got the following vertices**
U.relabel()
V= U.vertices()
V
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59]
**Is it possible to know the corresponding labels? Like for example what is the corresponding permutation for 0?**Mon, 07 Sep 2020 21:38:05 +0200https://ask.sagemath.org/question/53363/is-it-possible-to-know-the-corresponding-graph-labeling-after-using-relabel/
- Answer by tmonteil for <p><strong>I am trying to generate the following cayley graph</strong> </p>
<pre><code>G=AlternatingGroup(5)
S=[(1,2,3),(1,2,4),(1,2,5)]
C=G.cayley_graph(generators=S, simple=True)
U=C.to_undirected()
U.vertices()
[(), (3,4,5), (3,5,4), (2,3)(4,5), (2,3,4), (2,3,5), (2,4,3), (2,4,5), (2,4)(3,5), (2,5,3), (2,5,4), (2,5)(3,4), (1,2)(4,5), (1,2)(3,4), (1,2)(3,5), (1,2,3), (1,2,3,4,5), (1,2,3,5,4), (1,2,4,5,3), (1,2,4), (1,2,4,3,5), (1,2,5,4,3), (1,2,5), (1,2,5,3,4), (1,3,2), (1,3,4,5,2), (1,3,5,4,2), (1,3)(4,5), (1,3,4), (1,3,5), (1,3)(2,4), (1,3,2,4,5), (1,3,5,2,4), (1,3)(2,5), (1,3,2,5,4), (1,3,4,2,5), (1,4,5,3,2), (1,4,2), (1,4,3,5,2), (1,4,3), (1,4,5), (1,4)(3,5), (1,4,5,2,3), (1,4)(2,3), (1,4,2,3,5), (1,4,2,5,3), (1,4,3,2,5), (1,4)(2,5), (1,5,4,3,2), (1,5,2), (1,5,3,4,2), (1,5,3), (1,5,4), (1,5)(3,4), (1,5,4,2,3), (1,5)(2,3), (1,5,2,3,4), (1,5,2,4,3), (1,5,3,2,4), (1,5)(2,4)]
</code></pre>
<p><strong>Here, I used the "relabel()" function and I got the following vertices</strong></p>
<pre><code>U.relabel()
V= U.vertices()
V
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59]
</code></pre>
<p><strong>Is it possible to know the corresponding labels? Like for example what is the corresponding permutation for 0?</strong></p>
https://ask.sagemath.org/question/53363/is-it-possible-to-know-the-corresponding-graph-labeling-after-using-relabel/?answer=53367#post-id-53367If you look at the documentation of the `relabel` method (by typing `U.relabel?`), you can see that there is a `return_map` option`:
sage: U.relabel(return_map=True)
{(): 0,
(1,5,4,3,2): 1,
(1,4,5,3,2): 2,
(1,3,2): 3,
(1,2,5,4,3): 4,
(2,4,5): 5,
(1,5)(2,3): 6,
(1,4,3,2,5): 7,
(1,3,2,4,5): 8,
(1,2,3): 9,
(2,3,5): 10,
(1,5)(3,4): 11,
(1,4,5): 12,
(1,3,5): 13,
(1,2)(3,4): 14,
(2,5,4): 15,
(1,5,3,2,4): 16,
(1,4)(2,3): 17,
(1,3,2,5,4): 18,
(1,2,4,5,3): 19,
(3,5,4): 20,
(1,5,3,4,2): 21,
(1,4,2): 22,
(1,3,5,4,2): 23,
(1,2,5,3,4): 24,
(2,4,3): 25,
(1,5,4,2,3): 26,
(1,4,2,5,3): 27,
(1,3)(2,4): 28,
(1,2,3,5,4): 29,
(2,3)(4,5): 30,
(1,5,3): 31,
(1,4,3): 32,
(1,3)(4,5): 33,
(1,2)(3,5): 34,
(2,5)(3,4): 35,
(1,5)(2,4): 36,
(1,4,2,3,5): 37,
(1,3,4,2,5): 38,
(1,2,4): 39,
(3,4,5): 40,
(1,5,2): 41,
(1,4,3,5,2): 42,
(1,3,4,5,2): 43,
(1,2,5): 44,
(2,4)(3,5): 45,
(1,5,2,3,4): 46,
(1,4)(2,5): 47,
(1,3,5,2,4): 48,
(1,2,3,4,5): 49,
(2,3,4): 50,
(1,5,4): 51,
(1,4)(3,5): 52,
(1,3,4): 53,
(1,2)(4,5): 54,
(2,5,3): 55,
(1,5,2,4,3): 56,
(1,4,5,2,3): 57,
(1,3)(2,5): 58,
(1,2,4,3,5): 59}
Tue, 08 Sep 2020 10:20:50 +0200https://ask.sagemath.org/question/53363/is-it-possible-to-know-the-corresponding-graph-labeling-after-using-relabel/?answer=53367#post-id-53367