Ask Your Question
0

Graph.subgraph_search() obtaining the indices?

asked 6 years ago

RushBack gravatar image

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?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 6 years ago

tmonteil gravatar image

This 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()
Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 6 years ago

Seen: 333 times

Last updated: Dec 27 '18