Learn R Programming

XGR (version 1.1.4)

xGraphSplit: Function to split a graph according to a node attribute

Description

xGraphSplit is supposed to split a graph according to a node attribute such as community or comp.

Usage

xGraphSplit(g, node.attr = NULL, verbose = TRUE)

Arguments

g

an object of class "igraph" (or "graphNEL") for a graph with such as a 'community' node attribute

node.attr

a charatter specifying a node attribute. If NULL or no match, it returns NULL

verbose

logical to indicate whether the messages will be displayed in the screen. By default, it sets to true for display

Value

It returns a list of igraph objects.

See Also

xGraphSplit

Examples

Run this code
# NOT RUN {
# 1) generate a random bipartite graph
set.seed(123)
g <- sample_bipartite(100, 50, p=0.1)
V(g)$name <- V(g)

# }
# NOT RUN {
# 2) obtain and append the community
cs <- igraph::cluster_louvain(g)
V(g)$community <- cs$membership
ls_ig <- xGraphSplit(g, node.attr="community")
# }

Run the code above in your browser using DataLab