Learn R Programming

gremes (version 0.1.1)

FlowConnectionMatrix: Object of class FlowConnectionMatrix

Description

It creates an object of class FlowConnectionMatrix. Such an object is used as an input to create subsets based on the criterion of flow connectedness. See Vignette "Subsets and Coordinates". Within a subset all nodes will be flow connected.

Usage

FlowConnectionMatrix(x, g)

Value

An object of class FlowConnectionMatrix containing the matrix of flow connection.

Arguments

x

should be a matrix of ones and zeros, 1 representing flow connectedness between node i and node j. The matrix should have named rows and columns. Note that x is symmetric.

g

is an igraph object representing the graph. It should have named vertices.

Examples

Run this code
# create a graph and name the vertices
g<- graph(c(1,2,3,2, 2,4,4,5), directed=TRUE)
g<- set.vertex.attribute(g, "name", V(g), letters[1:5])

# create the flow connection matrix if not available
x<- matrix(rep(1,25), 5, 5)
x[1,3]<- x[3,1]<- 0
colnames(x)<- rownames(x)<- letters[1:5] # columns and rows are named according to the nodes

# create the object of class 'FlowConnectionMatrix'
fcmat<- FlowConnectionMatrix(x,g)
fcmat
rds<- FlowConnect()
sets<- subset(rds, from = fcmat, g)

Run the code above in your browser using DataLab