ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 27 Dec 2018 16:51:31 -0600Graph.subgraph_search() obtaining the indices?http://ask.sagemath.org/question/44792/graphsubgraph_search-obtaining-the-indices/It is nice that Graph.subgraph_search() returns a subgraph, but I need the indices of the larger graph to manipulate it, for example finding the subgraph neighbors. Is there a way to obtain the original indices?Thu, 27 Dec 2018 08:56:10 -0600http://ask.sagemath.org/question/44792/graphsubgraph_search-obtaining-the-indices/Answer by tmonteil for <p>It is nice that Graph.subgraph_search() returns a subgraph, but I need the indices of the larger graph to manipulate it, for example finding the subgraph neighbors. Is there a way to obtain the original indices?</p>
http://ask.sagemath.org/question/44792/graphsubgraph_search-obtaining-the-indices/?answer=44797#post-id-44797This is actually the case: the vertices are labelled the same way as in the larger graph, see:
sage: G = graphs.PetersenGraph()
sage: H = graphs.CycleGraph(6)
sage: G.subgraph_search(H)
Subgraph of (Petersen graph): Graph on 6 vertices
sage: G.subgraph_search(H).vertices()
[0, 1, 2, 3, 5, 8]
sage: G.subgraph_search(H).plot()
Thu, 27 Dec 2018 16:51:31 -0600http://ask.sagemath.org/question/44792/graphsubgraph_search-obtaining-the-indices/?answer=44797#post-id-44797