Title: | S-Core Graph Decomposition |
---|---|
Description: | S-Core Graph Decomposition algorithm for graphs. This is a method for decomposition of a weighted graph, as proposed by Eidsaa and Almaas (2013) <doi:10.1103/PhysRevE.88.062819>. The high speed and the low memory usage make it suitable for large graphs. |
Authors: | Christos Adam [aut, cre] |
Maintainer: | Christos Adam <[email protected]> |
License: | GPL-3 |
Version: | 0.1.2 |
Built: | 2024-11-20 07:21:14 UTC |
Source: | https://github.com/cadam00/scoredec |
s-core community decomposition
s_coreness(g = NULL, W = NULL, mode = "all")
s_coreness(g = NULL, W = NULL, mode = "all")
g |
|
W |
|
mode |
|
s-core community decomposition implementation. Only one of g
or W
must be provided.
While the source code is not as clear as the one at brainGraph::s_core
,
it is very speed and memory efficient. In case that the adjacency matrix
W
is provided instead of the graph g
is provided, then this
function is very speed and memory efficient.
Note that in cases that the adjacency matrix W
is known to be symmetric
(checked, for example, with base::isSymmetric
or
Rfast::is.symmetric
), then mode = "in"
and mode = "out"
will produce the same result more efficiently. For efficiency reasons not
checking it is chosen, but user should do it.
Integer vector with s-coreness attribute to each vertex.
Eidsaa, M. and Almaas, E. (2013) ‘s-core network decomposition: A generalization of k-core analysis to weighted networks’, Phys. Rev. E., American Physical Society, 88, 062819. doi:10.1103/PhysRevE.88.062819.
Watson, C.G. (2024). brainGraph: Graph Theory Analysis of Brain MRI Data. R package version 3.1.0. doi:10.32614/CRAN.package.brainGraph.
set.seed(42) ## Create a dummy symmetric adjacency matrix n <- 5 W <- matrix(runif(n^2),n) W[lower.tri(W)] = t(W)[lower.tri(W)] diag(W) <- 0 print(scoredec::s_coreness(g = NULL, W = W, mode = "all")) #> [1] 3 1 2 4 4 base::isSymmetric(W) #> [1] TRUE all.equal(scoredec::s_coreness(g = NULL, W = W, mode = "all"), scoredec::s_coreness(g = NULL, W = W, mode = "in")) #> [1] TRUE # Create a dummy undirected graph g <- igraph::graph_from_adjacency_matrix(adjmatrix = W, mode = "undirected", weighted = TRUE) print(scoredec::s_coreness(g = g, W = NULL, mode = "all")) #> [1] 3 1 2 4 4
set.seed(42) ## Create a dummy symmetric adjacency matrix n <- 5 W <- matrix(runif(n^2),n) W[lower.tri(W)] = t(W)[lower.tri(W)] diag(W) <- 0 print(scoredec::s_coreness(g = NULL, W = W, mode = "all")) #> [1] 3 1 2 4 4 base::isSymmetric(W) #> [1] TRUE all.equal(scoredec::s_coreness(g = NULL, W = W, mode = "all"), scoredec::s_coreness(g = NULL, W = W, mode = "in")) #> [1] TRUE # Create a dummy undirected graph g <- igraph::graph_from_adjacency_matrix(adjmatrix = W, mode = "undirected", weighted = TRUE) print(scoredec::s_coreness(g = g, W = NULL, mode = "all")) #> [1] 3 1 2 4 4