Subset an edge list

retain.groups(edges, groups)

retain.nodes(edges, nodes)

Arguments

edges

an edge list

groups

the groups to retain in the subset

nodes

the nodes to retain in the subset

Value

retain.groups returns an edge list containing only edges from the specified groups. retain.nodes returns an edge list containing only edges incident on the specified nodes.

Details

These functions extract a subset of an edge list containing only edges in a specified group, or incident with a specified set of nodes.

Examples

edges <- parse.digraph(c("A *-> B","B *-> C","C *--> D")) write.digraph(retain.groups(edges,c(0)))
#> A *-> B #> B *-> C