edgeBetweenClust: Get Betweenness of Edges in Clustered Graph

View source: R/functions.R

edgeBetweenClustR Documentation

Get Betweenness of Edges in Clustered Graph

Description

edgeBetweenClust is a utility function which takes in a graph and the membership vector mapping each vertex to a certain cluster and returns a vector of boolean values. A value of 'TRUE' means that the corresponding edge in that edge list position connects vertices which belong to distinct clusters. A value of 'FALSE' means that the edge connects vertices which belong to the same cluster.

Usage

edgeBetweenClust(graph, membership)

Arguments

graph

An object of class 'graph' from the igraph package.

membership

A vector of integers of length N (see constructClusters)

Value

A vector of boolean values of length ecount(graph) where each TRUE value represents an edge that connects distinct clusters

References

Luo, Z.T. (*), Sang, H. and Mallick, B.K. (2021), BAST: Bayesian Additive Regression Spanning Trees for Complex Constrained Domain

Luo, Z.T. (*), Sang, H. and Mallick, B.K. (2021), A Bayesian Contiguous Partitioning Method for Learning Clustered Latent Variables, Journal of Machine Learning Research, 22, 1-52.

Examples

set.seed(1)
coords = data.frame(lon = rnorm(50), lat = rnorm(50))
g = constructGraph(coords, 5)
clust_membership = constructClusters(g, 6, minclust = 5)$membership
betweenness = edgeBetweenClust(g, clust_membership)
plot(g,
     layout = as.matrix(coords),
     edge.color = as.numeric(betweenness) + 1,
     edge.arrow.mode = 0)

rayisaacalan/BASTION documentation built on April 27, 2023, 2:06 p.m.