graphChange: Perform a cluster death operation followed by a cluster birth...

View source: R/functions.R

graphChangeR Documentation

Perform a cluster death operation followed by a cluster birth operation

Description

graphChange executes graphDeath on the inputs and then executes graphBirth on the output of graphDeath. The net effect is that the output graph has the same number of clusters as the input graph, but different vertex membership. This is to encourage a better mixing time of the Markov chain when this function is used to implement an MCMC method.

Usage

graphChange(graph, membership, full_graph)

Arguments

graph

An object of class 'graph' from the igraph package

membership

A vector of integers of length N with k unique integers (1 < k <= N) which map each vertex to a cluster

full_graph

An object of class 'graph' from the igraph package; 'graph' should be a subgraph of full_graph

Value

A list containing two elements:

graph

The input graph with the different set of active edges

membership

A vector of integers of length N with k unique integers which map each vertex to a cluster, likely different than input membership

new_dclust_ids

Vertex keys of the vertices belonging to the newly unified cluster before the birth operation

old_dclust_ids

Vertex keys of the vertices belonging only to the cluster being merged which has a higher number before the birth operation

new_bclust_ids

Vertex keys of the vertices belonging to the new cluster after the birth operation

old_bclust_ids

Vertex keys of the vertices from the cluster which was born excluding the ones from new_bclust_ids

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.

See Also

constructClusters, graphDeath, graphBirth, graphHyper

Examples

set.seed(1)
coords = data.frame(lon = rnorm(80), lat = rnorm(80))
g = constructGraph(coords, 5)
clust_out = constructClusters(g, 6, minclust = 8)
plot(clust_out$spanning_forest,
     layout = as.matrix(coords),
     vertex.color = clust_out$membership,
     edge.arrow.mode = 0)
g_different = graphChange(clust_out$spanning_forest,
                          clust_out$membership, g)
plot(g_different$graph,
     layout = as.matrix(coords),
     vertex.color = g_different$membership,
     edge.arrow.mode = 0)

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