repulsion_graph | R Documentation |
This function creates a repulsion graph, which is a graph where edges between vertices of different classes are emphasized, while edges within the same class are suppressed.
repulsion_graph(
W,
cg,
method = c("binary", "weighted"),
threshold = 0,
norm_fac = 1
)
W |
The adjacency matrix (weighted or binary) representing the relationships between vertices in the input graph. |
cg |
The class graph indicating the pairwise relationships among node classes. |
method |
A character string indicating the method used to create the repulsion graph. Can be either "binary" or "weighted". Default is "binary". |
threshold |
A numeric value used to filter the adjacency matrix. Edges with weights below this threshold will be ignored. Default is 0. |
norm_fac |
A numeric value used to normalize the weights in the adjacency matrix when the method is set to "weighted". Default is 1. |
A 'neighbor_graph' object representing the repulsion graph.
# Example with random data
X <- matrix(rnorm(100*100), 100, 100)
labels <- factor(rep(1:5, each=20))
cg <- class_graph(labels)
W <- graph_weights(X, k=10)
R <- repulsion_graph(W, cg, method="weighted")
# Example with iris dataset
data(iris)
X2 <- as.matrix(iris[, 1:4])
labels <- iris[, 5]
cg <- class_graph(labels)
W <- graph_weights(X2, k=6)
R <- repulsion_graph(W, cg, method="weighted")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.