graphChange | R Documentation |
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.
graphChange(graph, membership, full_graph)
graph |
An object of class 'graph' from the |
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 |
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 |
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.
constructClusters
, graphDeath
, graphBirth
, graphHyper
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.