View source: R/structural.properties.R
subgraph | R Documentation |
subgraph()
creates a subgraph of a graph, containing only the specified
vertices and all the edges among them.
subgraph(graph, vids)
induced_subgraph(
graph,
vids,
impl = c("auto", "copy_and_delete", "create_from_scratch")
)
subgraph_from_edges(graph, eids, delete.vertices = TRUE)
graph |
The original graph. |
vids |
Numeric vector, the vertices of the original graph which will form the subgraph. |
impl |
Character scalar, to choose between two implementation of the
subgraph calculation. ‘ |
eids |
The edge ids of the edges that will be kept in the result graph. |
delete.vertices |
Logical scalar, whether to remove vertices that do
not have any adjacent edges in |
induced_subgraph()
calculates the induced subgraph of a set of vertices
in a graph. This means that exactly the specified vertices and all the edges
between them will be kept in the result graph.
subgraph_from_edges()
calculates the subgraph of a graph. For this function
one can specify the vertices and edges to keep. This function will be
renamed to subgraph()
in the next major version of igraph.
The subgraph()
function currently does the same as induced_subgraph()
(assuming ‘auto
’ as the impl
argument), but this behaviour
is deprecated. In the next major version, subgraph()
will overtake the
functionality of subgraph_from_edges()
.
A new graph object.
Gabor Csardi csardi.gabor@gmail.com
Other structural.properties:
bfs()
,
component_distribution()
,
connect()
,
constraint()
,
coreness()
,
degree()
,
dfs()
,
distance_table()
,
edge_density()
,
feedback_arc_set()
,
girth()
,
is_acyclic()
,
is_dag()
,
is_matching()
,
k_shortest_paths()
,
knn()
,
reciprocity()
,
subcomponent()
,
topo_sort()
,
transitivity()
,
unfold_tree()
,
which_multiple()
,
which_mutual()
g <- make_ring(10)
g2 <- induced_subgraph(g, 1:7)
g3 <- subgraph_from_edges(g, 1:5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.