Description Usage Arguments Value Examples
View source: R/graph_to_complex.R
Takes the adjacency matrix of a graph and returns a clique complex that can be used
by other functions in the RayleighSelection
package.
1 | graph_to_complex(adjacency, clique = TRUE)
|
adjacency |
a weighted adjacency matrix. |
clique |
if set to FALSE the computation of 2-simplices is skipped. |
An object of the class simplicial
. The class simplicial
inherits from
the class igraph
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | library(RayleighSelection)
# Load MNIST example dataset
data("mnist")
# Compute a correlation matrix for a subset of the LFW dataset using only pixels with high variance
mnist_test <- mnist[,1:800]
mnist_test_top <- mnist_test[apply(mnist_test, 1, var) > 0.9,]
mnist_test_distances <- cor(mnist_test_top)
# Compute a simplifical complex
gg <- graph_to_complex(mnist_test_distances)
# Plot the skeleton of the simplicial complex colored by the intensity of the 500th pixel
plot_skeleton(gg, k=as.numeric(mnist_test[500,]))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.