aggregateVertices: Aggregate vertices of a graph

Description Usage Arguments Value Examples

View source: R/aggregateVertices.R

Description

Aggregate vertices of an igraph object. For vertices numeric columns, mean of groups is computed. For character class columns, uniques values are pasted.

Usage

1
aggregateVertices(g, by, v.agg = V(g))

Arguments

g

An igraph object

by

Vector of the same length than vertices to aggregate them.

v.agg

igraph.vs or character; the vertices to aggregate. Default is all graph vertices.

Value

An igraph object.

Examples

1
2
3
4
5
6
library(igraph)
g = erdos.renyi.game(100, 120, 'gnm')
plot(g)
by = sample(letters[1:10], length(V(g)), replace=TRUE)
g2 = aggregateVertices(g, by)
plot(g2)

MiloMonnier/supplynet documentation built on Feb. 16, 2021, 8:03 p.m.