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.Thu, 25 Feb 2021 18:57:18 +0100Mapping isomorphism for posets or graphshttps://ask.sagemath.org/question/55675/mapping-isomorphism-for-posets-or-graphs/I know that we can check if two posets/graphs are isomorphic using is_isomorphic(), but is there any way that I can get Sage to output a possible mapping between the two posets/graphs that are isomorphic?Thu, 11 Feb 2021 18:59:45 +0100https://ask.sagemath.org/question/55675/mapping-isomorphism-for-posets-or-graphs/Answer by Sébastien for <p>I know that we can check if two posets/graphs are isomorphic using is_isomorphic(), but is there any way that I can get Sage to output a possible mapping between the two posets/graphs that are isomorphic?</p>
https://ask.sagemath.org/question/55675/mapping-isomorphism-for-posets-or-graphs/?answer=55687#post-id-55687According to the documentation of [is_isomorphic](https://doc.sagemath.org/html/en/reference/graphs/sage/graphs/generic_graph.html#sage.graphs.generic_graph.GenericGraph.is_isomorphic), you can use the argument `certificate=True`:
sage: G = Graph([(0,1),(1,2)])
sage: H = Graph([(8,9), (9,10)])
sage: G.is_isomorphic(H)
True
sage: G.is_isomorphic(H, certificate=True)
(True, {0: 10, 1: 9, 2: 8})
If the automorphism group of G is non trivial, there are more than one such map. You can deduce all of them from the automorphism group of G:
sage: G.automorphism_group()
Permutation Group with generators [(0,2)]
Sat, 13 Feb 2021 09:08:20 +0100https://ask.sagemath.org/question/55675/mapping-isomorphism-for-posets-or-graphs/?answer=55687#post-id-55687Comment by FrédéricC for <p>According to the documentation of <a href="https://doc.sagemath.org/html/en/reference/graphs/sage/graphs/generic_graph.html#sage.graphs.generic_graph.GenericGraph.is_isomorphic">is_isomorphic</a>, you can use the argument <code>certificate=True</code>:</p>
<pre><code>sage: G = Graph([(0,1),(1,2)])
sage: H = Graph([(8,9), (9,10)])
sage: G.is_isomorphic(H)
True
sage: G.is_isomorphic(H, certificate=True)
(True, {0: 10, 1: 9, 2: 8})
</code></pre>
<p>If the automorphism group of G is non trivial, there are more than one such map. You can deduce all of them from the automorphism group of G:</p>
<pre><code>sage: G.automorphism_group()
Permutation Group with generators [(0,2)]
</code></pre>
https://ask.sagemath.org/question/55675/mapping-isomorphism-for-posets-or-graphs/?comment=55704#post-id-55704in other words, always read the manual first !Sun, 14 Feb 2021 10:35:52 +0100https://ask.sagemath.org/question/55675/mapping-isomorphism-for-posets-or-graphs/?comment=55704#post-id-55704Comment by sunflower for <p>According to the documentation of <a href="https://doc.sagemath.org/html/en/reference/graphs/sage/graphs/generic_graph.html#sage.graphs.generic_graph.GenericGraph.is_isomorphic">is_isomorphic</a>, you can use the argument <code>certificate=True</code>:</p>
<pre><code>sage: G = Graph([(0,1),(1,2)])
sage: H = Graph([(8,9), (9,10)])
sage: G.is_isomorphic(H)
True
sage: G.is_isomorphic(H, certificate=True)
(True, {0: 10, 1: 9, 2: 8})
</code></pre>
<p>If the automorphism group of G is non trivial, there are more than one such map. You can deduce all of them from the automorphism group of G:</p>
<pre><code>sage: G.automorphism_group()
Permutation Group with generators [(0,2)]
</code></pre>
https://ask.sagemath.org/question/55675/mapping-isomorphism-for-posets-or-graphs/?comment=55910#post-id-55910Ah, thank you so much! This is helpful, don't know how I missed that.Thu, 25 Feb 2021 18:57:18 +0100https://ask.sagemath.org/question/55675/mapping-isomorphism-for-posets-or-graphs/?comment=55910#post-id-55910