split_igraph {iGraphMatch}R Documentation

Split an igraph object into aligned graphs by attribute

Description

Given an igraph object and an edge attribute, this function finds all unique values of the edge attribute in the graph and returns a list of igraph objects on the same vertex set where each element of the list has a graph containing only those edges with specified attributed.

Usage

split_igraph(g, e_attr, strip_vertex_attr = FALSE)

Arguments

g

An igraph object

e_attr

the name of an edge attribute in g

strip_vertex_attr

Whether to remove all vertex attribute from the new graphs

Value

A named list of igraph objects with names corresponding to the values of the edge attributes.

Examples

g <- igraph::sample_gnm(20, 60)
igraph::E(g)$color <-
  sample(c("red", "green"), 60, replace = TRUE)
split_igraph(g, "color")


[Package iGraphMatch version 2.0.5 Index]