简体   繁体   中英

Find subset of a graph using node id's (must include all nodes connected to id's supplied)

What im looking for is a quick way to take a set of nodes and find a subset of a graph that has all of those PLUS other vertex that have a edges to those nodes.

Im sure it's very simple but i've failed to find a nice way of doing it.

Thanks in advance!

You are looking for adjacent edges, or adjacent vertex .

Using igraph package, you can use on of theses functions:

 get.adjedgelist
 get.adjlist

Example :

gg <- ring(10)                  ## create a ring graph
g2 <- induced.subgraph(g, 1:7)  ## indiced grapg by vertex 1:7
get.adjedgelist(g2)             ## get adjacent edges of this sub-graph

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM