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.Fri, 03 Jun 2011 06:59:46 +0200Enumerate isomrphic subgraphs of graph vertex labeledhttps://ask.sagemath.org/question/7688/enumerate-isomrphic-subgraphs-of-graph-vertex-labeled/Enumerate all isomorphic subgraphs of given graph given the subgraph adjacency matrixWed, 15 Sep 2010 02:17:45 +0200https://ask.sagemath.org/question/7688/enumerate-isomrphic-subgraphs-of-graph-vertex-labeled/Comment by ccanonc for <p>Enumerate all isomorphic subgraphs of given graph given the subgraph adjacency matrix</p>
https://ask.sagemath.org/question/7688/enumerate-isomrphic-subgraphs-of-graph-vertex-labeled/?comment=22634#post-id-22634Can you post your code (up until the computation you want to perform)?Fri, 17 Sep 2010 17:28:52 +0200https://ask.sagemath.org/question/7688/enumerate-isomrphic-subgraphs-of-graph-vertex-labeled/?comment=22634#post-id-22634Answer by staffan for <p>Enumerate all isomorphic subgraphs of given graph given the subgraph adjacency matrix</p>
https://ask.sagemath.org/question/7688/enumerate-isomrphic-subgraphs-of-graph-vertex-labeled/?answer=12410#post-id-12410All graphs in Sage support iteration over its major subcomponents, at least vertices and to create a graph from its adjacency matrix
mg= Graph(adj)
mg.is_isomorphic(mg) -> True
# graph from adjency matrix
adj= Matrix ([ [0, 1, 1], [1, 0, 1], [1, 1, 0] ])
mg= Graph(adj)
mg.is_isomorphic(mg) -> True
If are you looking for the isomorphic subgraphs of the one you specify with the adj. graph you can usemg.subgraph_search_iterator().
too see how it might be used here. If you post the source as suggested above we could
get a more detailed answer.
Here is a simple example of looking for the simplest graph, with zero vertices:
eg = Graph()
[p for p in mg.subgraph_search_iterator(eg)]
Fri, 03 Jun 2011 06:59:46 +0200https://ask.sagemath.org/question/7688/enumerate-isomrphic-subgraphs-of-graph-vertex-labeled/?answer=12410#post-id-12410