Generating non-isomorphic graphs by adding edges to a given graph - MathOverflow most recent 30 from http://mathoverflow.net 2013-06-20T03:48:33Z http://mathoverflow.net/feeds/question/119070 http://www.creativecommons.org/licenses/by-nc/2.5/rdf http://mathoverflow.net/questions/119070/generating-non-isomorphic-graphs-by-adding-edges-to-a-given-graph Generating non-isomorphic graphs by adding edges to a given graph Jernej 2013-01-16T13:29:15Z 2013-01-17T11:49:59Z <p>Hello!</p> <p>This question is in a way related to the one I posted on <a href="http://math.stackexchange.com/questions/266444/generating-non-isomorphic-graph-by-adding-two-edges-to-a-fixed-graph" rel="nofollow">math.se</a>. Since the question there did not produce any final answer I am trying my luck here!</p> <p>I am given a fairly large graph $G$ and subsets $A,B \subseteq V(G)$ where $|A| \leq |B|.$ I need to extend $G$ so that every vertex $v \in A$ is <em>matched</em> with precisely one vertex in $B.$ By matched I mean that $v$ is adjacent to a vertex in $v' \in B$ and no other vertex of $A$ is adjacent to $v'.$</p> <p>The way I am doing this now is that for each fixed vertex $v \in A$ I compute the orbits of the stabilizer $\rm{Aut}(G)_v$ and then only add edges to representatives of orbits of elements of $B$ that are still "free." </p> <p>The problem with this approach is that we still obtain isomorphic graphs after we repeat the above procedure on the new graphs and for the next unmatched vertex. To patch this I also keep a list of canonical labelings for each graph as to ensure that each step gives only non isomorphic graphs.</p> <p>Now the problem is that the described approach is inefficient for my concrete case $(|A| = 40, |B| = 48).$ Since $G$ is highly-symmetric I am fairly confident that the number of all non-isomorphic graphs obtained by matching all vertices in $A$ is manageable but computing automorphism groups and canonical labelings after every iteration appears to slow down things a lot.</p> <p>Hence I am wondering if there is any other more efficient way to do this? Perhaps something based on computing the canonical labeling of $G$ at the start and then adding edges as to preserve the labeling? </p> <p>I am not really knowledgeable of what can be done but since I would really like to generate these graphs I'd be thankful for any constructive suggestion!</p> http://mathoverflow.net/questions/119070/generating-non-isomorphic-graphs-by-adding-edges-to-a-given-graph/119162#119162 Answer by Brendan McKay for Generating non-isomorphic graphs by adding edges to a given graph Brendan McKay 2013-01-17T11:49:59Z 2013-01-17T11:49:59Z <p>Let me assume that Aut$(G)$ fixes $A$ and $B$ setwise, or at least the group you use to define equivalence is the setwise stabiliser of each of $A$ and $B$ (in which case use vertex colours to get this stabiliser). </p> <p>Suppose recursively that you have all the non-equivalent graphs in which $k$ vertices of $A$ are matched to $B$. Do the following for each graph $H$ in that list.</p> <p>Let $A'$ be the set of vertices of $A$ not matched to $B$ yet, and similarly $B'$. First find the orbits of Aut$(H)$ on $A'\times B'$. For one $e=(a,b)$ from each orbit, consider $H+e$. Compute both Aut$(H+e)$ and a canonical labelling of $H+e$. Accept $H+e$ if $a$ is in the same orbit as the vertex of $A$ which is matched to $B$ and is the first of such vertices in the canonical labelling. Otherwise reject $H+e$.</p> <p>The set of graphs you accept has exactly one member of each equivalence class of graphs in which $k+1$ vertices of $A$ are matched to $B$. This is the method of "canonical construction path", which some people call "canonical augmentation".</p> <p>If you write it in depth-first form, you don't need to store the graphs but can output them as they are accepted.</p> <p>There are various ways to use graph invariants to speed it up in practice. The efficiency will depend on what the group is like for the typical intermediate graph.</p>