Description Usage Arguments Details Value Warning References See Also Examples
tcc
returns the temporal closeness centrality for each node in a
dynamic network (sequence of graph snapshots).
1 2 3 |
x |
A list of adjacency matrices or a list of adjacency lists. |
type |
Data format of |
startsnapshot |
Numeric. Entry of |
endsnapshot |
Numeric. Entry of |
vertexindices |
Numeric. A vector of nodes. Only shortest temporal paths
ending at nodes in |
directed |
Logical. Set |
normalize |
Logical. Set |
centrality_evolution |
Logical. Set |
tcc
calculates the temporal closeness centrality (Kim and
Anderson, 2012). To keep the computational effort linear in the number of
snapshots the Reversed Evolution Network algorithm (REN; Hanke and Foraita,
2017) is used to find all shortest temporal paths.
The (normalized) temporal betweenness centrality values of all nodes
(TCC
). If centrality_evolution
is TRUE
, an additional
(|V| x T) matrix is returned (CentEvo
), containing the
temporal centrality value at each snapshot between startsnapshot
and
endsnapshot
.
Using adjacency matrices as input exponentially increases the required memory. Use adjacency lists to save memory.
Kim, Hyoungshick and Anderson, Ross (2012). Temporal node centrality in complex networks. Physical Review E, 85 (2).
Hanke, Moritz and Foraita, Ronja (2017). Clone temporal centrality measures for incomplete sequences of graph snapshots. BMC Bioinformatics, 18 (1).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | # Create a list of adjacency matrices, plot the corresponding graphs
# (using the igraph package) and calculate tcc
A1 <- matrix(c(0,1,0,0,0,0,
1,0,1,0,0,0,
0,1,0,0,0,0,
0,0,0,0,0,0,
0,0,0,0,0,0,
0,0,0,0,0,0), ncol=6)
A2 <- matrix(c(0,0,0,0,0,0,
0,0,1,0,0,0,
0,1,0,1,1,0,
0,0,1,0,0,0,
0,0,1,0,0,0,
0,0,0,0,0,0), ncol=6)
A3 <- matrix(c(0,0,0,0,0,0,
0,0,0,0,0,0,
0,0,0,0,0,0,
0,0,0,0,0,0,
0,0,0,0,0,0,
0,0,0,0,0,0), ncol=6)
A4 <- matrix(c(0,1,0,0,0,0,
1,0,0,1,0,0,
0,0,0,0,0,0,
0,1,0,0,0,0,
0,0,0,0,0,0,
0,0,0,0,0,0), ncol=6)
library(igraph)
par(mfrow=c(2,2))
Layout <-
layout_in_circle(graph_from_adjacency_matrix(A1, mode = "undirected"))
plot(graph_from_adjacency_matrix(A1, "undirected"), layout=Layout)
plot(graph_from_adjacency_matrix(A2, "undirected"), layout=Layout)
plot(graph_from_adjacency_matrix(A3, "undirected"), layout=Layout)
plot(graph_from_adjacency_matrix(A4, "undirected"), layout=Layout)
As <- list(A1,A2,A3,A4)
tcc(As, "M", centrality_evolution=TRUE)
### Create list of adjacency lists
Ls <- lapply(seq_along(As), function(i){
sapply(1:6, function(j){which(As[[i]][j,]==1)})
})
tcc(Ls, "L", centrality_evolution=TRUE)
### Run tbc in parallel ###
library(parallel)
# Calculate the number of cores
cores_avail <- detectCores()-1
# Initiate cluster
cl <- makeCluster(2)
clusterExport(cl, c("As", "tcc"))
TCC <- parLapply(cl, 1:6, function(x){
tcc(As, "M", vertexindices = x)
}
)
stopCluster(cl)
Reduce("+", TCC)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.