Skip to contents

Extract an Induced Subgraph

Usage

create.subgraph(graph, vertices, stage = "final")

Arguments

graph

A dgraph.

vertices

Unique vertex indices, in the desired output order.

stage

Stored stage to extract.

Value

A dgraph with compact indices and aligned lengths and attributes. metadata$original.vertices maps its vertices back to the original graph.

Examples

graph <- create.graph("chain", 4)
sub <- create.subgraph(graph, vertices = c(4, 3))
graph.edges(sub)
#>   from to length
#> 1    1  2      1
sub$metadata$original.vertices
#> [1] 4 3