graph_to_complex: Generates a simplicial complex from a graph.

Description Usage Arguments Value Examples

View source: R/graph_to_complex.R

Description

Takes the adjacency matrix of a graph and returns a clique complex that can be used by other functions in the RayleighSelection package.

Usage

1
graph_to_complex(adjacency, clique = TRUE)

Arguments

adjacency

a weighted adjacency matrix.

clique

if set to FALSE the computation of 2-simplices is skipped.

Value

An object of the class simplicial. The class simplicial inherits from the class igraph.

Examples

 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,]))

CamaraLab/RayleighSelection documentation built on Aug. 16, 2021, 12:01 p.m.