‘CINA’ is an R package submitted in cran repository which has been written specifically for centrality analysis in network science. It can be useful for assembling, comparing, evaluating and visualizing several types of centrality measures. This document is an introduction to the usage of the software and includes some user interface examples.
Centrality types are defined as measures for identifying the most important vertices within a network in graph theory. Several kinds of centrality has been provided to compute most central nodes by different formulas, while some analysis is needed to evaluate the most informative ones. In this package, we have prepared these resolutions and some examples of real networks.
For the examples in the following sections, we assume that the “CINA” package has been properly installed into the R environment. This can be done by typing
install.packages(“CINA”)
into the R console. The “igraph”(Csardi and Nepusz 2006) ,“network”(Data. 2015; Butts 2008),“sna”(CT 2008; CT 2007) and “centiserve”(Jalili et al. 2015) packages are required and must be installed in your R environment as well. These are analogous to installing “CINA” and for more other calculations, packages such as FactoMineR(Sebastien Le 2008), plyr(Wickham 2011) qdapTools(Rinker 2015), Rtsne(Krijthe 2015) are necessary. For some plots, “factoextra”(Kassambara, n.d.), “GGally”(Barret Schloerke and Larmarange 2016), “pheatmap”(Kolde 2015), “corrplot”(Simko and Viliam 2016), “dendextend”(Galili 2015), “circlize”(Gu et al. 2014), “viridis”(Garnier 2017) and “ggplot2”(Wickham 2016) packages must be installed too. After installations, the “CINA” package can be loaded via
library(CINNA)
We collected five graphs instances based on factual datasets and natural networks. In order to develop some instructions for using this package, we prepared you a brief introduction about the topological of these networks as it described below:
Name | Type | Description | Nodes | Edges | Refrences |
---|---|---|---|---|---|
zachary | unweighted, undirected | friendships between members of a club | 34 | 78 | (Zachary 1977) |
cortex | unweighted, directed | pathways among cortial region in Macaque | 30 | 311 | (Felleman and Van Essen 1991) |
kangaroo | weighted, undirected | interactions between kangaroos | 17 | 90 | (KONECT 2016a) |
rhesus | weighted, directed | grooming occured among monkeys of an area | 16 | 110 | (KONECT 2016b) |
drugtarget | bipartite,directed | interactions among drugs and their protein targets | 1599 | 3766 | (Barneh, Jafari, and Mirzaie 2015) |
Zachary Karate Club(Zachary 1977) is an example of undirected and unweighted network in this package. This dataset illustrates friendships between members of a university karate club. It is based on a faction membership after a social partion. The summary of important properties of this network is described below:
Edge Type: Friendship
Node Type: Person
Avg Edges: 77.50
Avg Nodes: 34.00
Graph properties: Unweighted, Undirected
This dataset can be easily accessed by using data() function:
data("zachary")
zachary
## IGRAPH U--- 34 78 --
## + attr: id (v/n)
## + edges:
## [1] 1-- 2 1-- 3 2-- 3 1-- 4 2-- 4 3-- 4 1-- 5 1-- 6 1-- 7 5-- 7
## [11] 6-- 7 1-- 8 2-- 8 3-- 8 4-- 8 1-- 9 3-- 9 3--10 1--11 5--11
## [21] 6--11 1--12 1--13 4--13 1--14 2--14 3--14 4--14 6--17 7--17
## [31] 1--18 2--18 1--20 2--20 1--22 2--22 24--26 25--26 3--28 24--28
## [41] 25--28 3--29 24--30 27--30 2--31 9--31 1--32 25--32 26--32 29--32
## [51] 3--33 9--33 15--33 16--33 19--33 21--33 23--33 24--33 30--33 31--33
## [61] 32--33 9--34 10--34 14--34 15--34 16--34 19--34 20--34 21--34 23--34
## [71] 24--34 27--34 28--34 29--34 30--34 31--34 32--34 33--34
The result would have a class of “igraph” object.
Kangaroo(KONECT 2016a) is a sample of undirected and weighted network which indicates interactions among free-ranging grey kangaroos. The edge between two nodes shows a dominence interaction between two kanagaroos. The positive weight of each edge represents number of interaction between them. A brief explanation of it’s properties is clarified below:
Edge Type: Interaction
Node Type: Kangaroo
Avg Edges: 91
Nodes: 17
Graph properties: Weighted, Undirected
Edge weights: Positive weights
Macaque visual cortex(Felleman and Van Essen 1991) is a sample cortex network which is collected in 1991. In this dataset, vertices represents neocortical areas which involved in visual functions in Macaques. The direction displays the progress of synapsis from one to another. A summary of this can be as follows:
Edge Type: Pathway
Node Type: Cortical region
Avg Edges: 315.50
Nodes: 31.00
Graph properties: Directed, Unweighted
Edge weights: Positive weights
Moreno rhesus(KONECT 2016b) is a directed and weighted network which describes grooming between free ranging rhesus macaques (Macaca mulatta) in Cayo Santiago during a two month period in 1963. In this dataset a vertice is identified as a monkey and the directed edge among them means grooming between them. The weights of the edges demonstrates how often this manner happened. The network summary is as follows:
Edge Type: Grooming
Node Type: Monkey
Avg Edges: 111
Nodes: 16
Graph properties: Directed, Weighted
Edge weights: Positive weights
Drugtarget(Barneh, Jafari, and Mirzaie 2015) is a bipartite, unconnected and directed network demonstrating interactions among Food and Drug Administration (FDA)-approved drugs and their corresponding protein targets. This network is a shrunken one in which metabolizing enzymes, carriers and transporters associated with drug metabolism are filtered and solely targets directly related to their pharmacological effects are included. A summary of this can be like:
Edge Type: inetraction
Node Type: drug, protein target
Avg Edges: 3766
Nodes: 1599
Graph properties: Bipartite, unconnected, directed
In order to apply several centrality analysis, it is recommended to have a connected graph. Therefore, approaching the connected components of a network is needed. In order to extract components of a graph and use them for centrality analysis, we prepared some functions to read different graph formats as they described below.
“graph.extract.components” function is able to read “igraph” and “network” objects and returns their componets as a list of “igraph” objects. This function also has this ability to recognized bipartite graphs and user can decide that which project is suitable for his analysis. In order to use this function, we use zachary dataset and develop it in all of our functions.
graph.extract.components(zachary)
## [[1]]
## IGRAPH U--- 34 78 --
## + attr: id (v/n)
## + edges:
## [1] 1-- 2 1-- 3 2-- 3 1-- 4 2-- 4 3-- 4 1-- 5 1-- 6 1-- 7 5-- 7
## [11] 6-- 7 1-- 8 2-- 8 3-- 8 4-- 8 1-- 9 3-- 9 3--10 1--11 5--11
## [21] 6--11 1--12 1--13 4--13 1--14 2--14 3--14 4--14 6--17 7--17
## [31] 1--18 2--18 1--20 2--20 1--22 2--22 24--26 25--26 3--28 24--28
## [41] 25--28 3--29 24--30 27--30 2--31 9--31 1--32 25--32 26--32 29--32
## [51] 3--33 9--33 15--33 16--33 19--33 21--33 23--33 24--33 30--33 31--33
## [61] 32--33 9--34 10--34 14--34 15--34 16--34 19--34 20--34 21--34 23--34
## [71] 24--34 27--34 28--34 29--34 30--34 31--34 32--34 33--34
This results the only component of the zachary graph. This function is laso applicable for bipartite networks. Using the num.proj argument, user can decide on which projection is inetrested to work on. As an example of bipartite graphs, we uses drugtarget network as follows:
data(drugtarget)
drug.comp<-graph.extract.components( drugtarget, directed = TRUE,bipartite.proj=TRUE ,num.proj=2)
## Warning in bipartite.projection(x): vertex types converted to logical
head(drug.comp)
## [[1]]
## IGRAPH UNW- 131 560 --
## + attr: id (v/n), name (v/c), weight (e/n)
## + edges (vertex names):
## [1] O00180--P54289 O00180--Q02641 O00180--Q06432 O00180--Q12809
## [5] O00180--Q13936 O00180--Q14654 O00180--Q9H252 O00180--Q9NS40
## [9] O00180--Q9Y257 O00555--O15399 O00555--P14416 O00555--P35367
## [13] O00555--P35372 O00555--P62158 O00555--Q12879 O00555--Q13224
## [17] O00555--Q14524 O00555--Q14957 O15399--O60391 O15399--P35367
## [21] O15399--P35372 O15399--P62158 O15399--Q05586 O15399--Q12879
## [25] O15399--Q13224 O15399--Q14957 O15399--Q8TCU5 O15554--P03886
## [29] O15554--P14867 O15554--P23415 O15554--P30049 O15554--P42261
## + ... omitted several edges
##
## [[2]]
## IGRAPH UNW- 6 15 --
## + attr: id (v/n), name (v/c), weight (e/n)
## + edges (vertex names):
## [1] O00764--P34896 O00764--P35520 O00764--Q96GD0 O00764--Q9NVS9
## [5] O00764--Q9Y617 P34896--P35520 P34896--Q96GD0 P34896--Q9NVS9
## [9] P34896--Q9Y617 P35520--Q96GD0 P35520--Q9NVS9 P35520--Q9Y617
## [13] Q96GD0--Q9NVS9 Q96GD0--Q9Y617 Q9NVS9--Q9Y617
##
## [[3]]
## IGRAPH UNW- 2 1 --
## + attr: id (v/n), name (v/c), weight (e/n)
## + edge (vertex names):
## [1] O14646--P11388
##
## [[4]]
## IGRAPH UNW- 7 10 --
## + attr: id (v/n), name (v/c), weight (e/n)
## + edges (vertex names):
## [1] O14659--P00374 O14659--P04818 P00374--P04818 P04818--P23921
## [5] P04818--P27707 P04818--P30085 P09884--P23921 P23921--P27707
## [9] P23921--P30085 P27707--P30085
##
## [[5]]
## IGRAPH UNW- 2 1 --
## + attr: id (v/n), name (v/c), weight (e/n)
## + edge (vertex names):
## [1] O14987--P21731
##
## [[6]]
## IGRAPH UNW- 4 5 --
## + attr: id (v/n), name (v/c), weight (e/n)
## + edges (vertex names):
## [1] O15528--P11473 O15528--Q6VVX0 P11473--Q02318 P11473--Q6VVX0
## [5] Q02318--Q6VVX0
It will return all components of the second projection of the network.
If you had an edgelist, an adjacency matrix or a graphNEL format of a network, the “misc.extract.components” can be useful. This function extracts the componets of other formats of graph. For illustration, we convert “zachary” graph to an edgelist to be able to use it for this function.
library(igraph)
zachary.edgelist<-as_edgelist(zachary)
misc.extract.components(zachary.edgelist)
## [[1]]
## IGRAPH D--- 34 78 --
## + edges:
## [1] 1-> 2 1-> 3 2-> 3 1-> 4 2-> 4 3-> 4 1-> 5 1-> 6 1-> 7 5-> 7
## [11] 6-> 7 1-> 8 2-> 8 3-> 8 4-> 8 1-> 9 3-> 9 3->10 1->11 5->11
## [21] 6->11 1->12 1->13 4->13 1->14 2->14 3->14 4->14 6->17 7->17
## [31] 1->18 2->18 1->20 2->20 1->22 2->22 24->26 25->26 3->28 24->28
## [41] 25->28 3->29 24->30 27->30 2->31 9->31 1->32 25->32 26->32 29->32
## [51] 3->33 9->33 15->33 16->33 19->33 21->33 23->33 24->33 30->33 31->33
## [61] 32->33 9->34 10->34 14->34 15->34 16->34 19->34 20->34 21->34 23->34
## [71] 24->34 27->34 28->34 29->34 30->34 31->34 32->34 33->34
In the most of research topics of network analysis, network features are related to the largest connected component of a graph(Newman 2010). In order to get that for an “igraph” or a “network” object, “giant.component.extract” function is specified. For using this function we can do:
giant.component.extract(zachary)
## [[1]]
## IGRAPH U--- 34 78 --
## + attr: id (v/n)
## + edges:
## [1] 1-- 2 1-- 3 2-- 3 1-- 4 2-- 4 3-- 4 1-- 5 1-- 6 1-- 7 5-- 7
## [11] 6-- 7 1-- 8 2-- 8 3-- 8 4-- 8 1-- 9 3-- 9 3--10 1--11 5--11
## [21] 6--11 1--12 1--13 4--13 1--14 2--14 3--14 4--14 6--17 7--17
## [31] 1--18 2--18 1--20 2--20 1--22 2--22 24--26 25--26 3--28 24--28
## [41] 25--28 3--29 24--30 27--30 2--31 9--31 1--32 25--32 26--32 29--32
## [51] 3--33 9--33 15--33 16--33 19--33 21--33 23--33 24--33 30--33 31--33
## [61] 32--33 9--34 10--34 14--34 15--34 16--34 19--34 20--34 21--34 23--34
## [71] 24--34 27--34 28--34 29--34 30--34 31--34 32--34 33--34
##
## [[2]]
## [,1] [,2]
## [1,] 1 2
## [2,] 1 3
## [3,] 2 3
## [4,] 1 4
## [5,] 2 4
## [6,] 3 4
## [7,] 1 5
## [8,] 1 6
## [9,] 1 7
## [10,] 5 7
## [11,] 6 7
## [12,] 1 8
## [13,] 2 8
## [14,] 3 8
## [15,] 4 8
## [16,] 1 9
## [17,] 3 9
## [18,] 3 10
## [19,] 1 11
## [20,] 5 11
## [21,] 6 11
## [22,] 1 12
## [23,] 1 13
## [24,] 4 13
## [25,] 1 14
## [26,] 2 14
## [27,] 3 14
## [28,] 4 14
## [29,] 6 17
## [30,] 7 17
## [31,] 1 18
## [32,] 2 18
## [33,] 1 20
## [34,] 2 20
## [35,] 1 22
## [36,] 2 22
## [37,] 24 26
## [38,] 25 26
## [39,] 3 28
## [40,] 24 28
## [41,] 25 28
## [42,] 3 29
## [43,] 24 30
## [44,] 27 30
## [45,] 2 31
## [46,] 9 31
## [47,] 1 32
## [48,] 25 32
## [49,] 26 32
## [50,] 29 32
## [51,] 3 33
## [52,] 9 33
## [53,] 15 33
## [54,] 16 33
## [55,] 19 33
## [56,] 21 33
## [57,] 23 33
## [58,] 24 33
## [59,] 30 33
## [60,] 31 33
## [61,] 32 33
## [62,] 9 34
## [63,] 10 34
## [64,] 14 34
## [65,] 15 34
## [66,] 16 34
## [67,] 19 34
## [68,] 20 34
## [69,] 21 34
## [70,] 23 34
## [71,] 24 34
## [72,] 27 34
## [73,] 28 34
## [74,] 29 34
## [75,] 30 34
## [76,] 31 34
## [77,] 32 34
## [78,] 33 34
This function extracts the strongests components of the input network as “igraph” objects.
This section particulary is specified for centrality analysis in network science.
All of the introduced centrality measures are not appropriate for all types of networks. So, to figure out which of them is suitable, “proper.centralities” is specifid. This funtion distinguishes proper centrality types based on network topology. To use this, we can do:
proper.centralities(zachary)
## [1] "Bonacich power centralities of positions"
## [2] "subgraph centrality scores"
## [3] "Topological Coefficient"
## [4] "Average Distance"
## [5] "Barycenter Centrality"
## [6] "BottleNeck Centrality"
## [7] "Centroid value"
## [8] "Closeness Centrality (Freeman)"
## [9] "ClusterRank"
## [10] "Decay Centrality"
## [11] "Degree Centrality"
## [12] "Diffusion Degree"
## [13] "DMNC - Density of Maximum Neighborhood Component"
## [14] "Eccentricity Centrality"
## [15] "eigenvector centralities"
## [16] "Flow Betweenness Centrality"
## [17] "Information Centrality"
## [18] "K-core Decomposition"
## [19] "Geodesic K-Path Centrality"
## [20] "Katz Centrality (Katz Status Index)"
## [21] "Kleinberg's authority centrality scores"
## [22] "Kleinberg's hub centrality scores"
## [23] "clustering coefficient"
## [24] "Lin Centrality"
## [25] "Load Centrality"
## [26] "Lobby Index (Centrality)"
## [27] "Markov Centrality"
## [28] "Radiality Centrality"
## [29] "Shortest-Paths Betweenness Centrality"
## [30] "Stress Centrality"
## [31] "Current-Flow Closeness Centrality"
## [32] "Closeness centrality (Latora)"
## [33] "Communicability Betweenness Centrality"
## [34] "Community Centrality"
## [35] "Cross-Clique Connectivity"
## [36] "Entropy Centrality"
## [37] "EPC - Edge Percolated Component"
## [38] "Laplacian Centrality"
## [39] "Leverage Centrality"
## [40] "MNC - Maximum Neighborhood Component"
## [41] "Hubbell Index"
## [42] "Semi Local Centrality"
## [43] "Closeness Vitality"
## [44] "Residual Closeness Centrality"
It returns the full names of suitable centrality types for the input graph. The input must have a class of “igraph” object.
In the next step, proper centralities and those which are looking for can be chosen. In order to compute proper centrality types resulted from the “proper.centralities”, you can use “calculate.centralities” function as below.
calculate.centralities(zachary)
## $`subgraph centrality scores`
## [1] 128.095014 71.430997 88.704595 48.180638 10.246740 12.347606
## [7] 12.347606 32.074296 45.067542 10.584888 10.246740 4.422322
## [13] 9.621246 46.769100 12.509399 12.509399 3.732406 10.874664
## [19] 12.509399 20.179611 12.509399 10.874664 12.509399 27.402901
## [25] 6.357646 6.812996 8.266177 18.586172 16.727386 22.926626
## [31] 28.553034 34.849359 95.694727 136.722338
##
## $`Topological Coefficient`
## [1] 0.1820652 0.2698413 0.2333333 0.3484848 0.4509804 0.3676471 0.3676471
## [8] 0.4880952 0.3933333 0.6250000 0.4509804 1.0000000 0.6875000 0.3931034
## [15] 0.8055556 0.8055556 0.8000000 0.7352941 0.8055556 0.4712644 0.8055556
## [22] 0.7352941 0.8055556 0.4105263 0.5000000 0.5416667 0.6176471 0.3750000
## [29] 0.4637681 0.4736842 0.4565217 0.2849462 0.2118056 0.1823529
##
## $`Bonacich power centralities of positions`
## [1] -1.56645902 -0.89167667 -1.10857100 -0.16869559 -1.56645902
## [6] -0.89167667 -0.89167667 -0.45788802 -1.51826028 -0.79527919
## [11] -1.56645902 -0.74708046 -0.09639748 -0.96397478 -0.26509306
## [16] -0.26509306 -0.14459622 -0.81937856 -0.26509306 -1.32546532
## [21] -0.26509306 -0.81937856 -0.26509306 -1.68695587 -0.69888172
## [26] -0.77117982 -1.25316721 -1.54235965 -0.81937856 -1.56645902
## [31] -1.03627289 -0.84347793 -0.57838487 -1.32546532
##
## $`Burt's Constraint`
## [1] 0.1554233 0.2795351 0.1851766 0.3966596 0.5294174 0.4774848 0.4774848
## [8] 0.4427116 0.3036007 0.5000000 0.5294174 1.0000000 0.6225043 0.3233354
## [15] 0.5736796 0.5736796 0.7812500 0.5908685 0.5736796 0.3737194 0.5736796
## [22] 0.5908685 0.5736796 0.3058237 0.4598765 0.4598765 0.6709018 0.2850692
## [29] 0.3869132 0.4494090 0.3460065 0.2445754 0.2492234 0.1564187
##
## $`Average Distance`
## [1] 1.657143 1.942857 1.685714 2.028571 2.485714 2.457143 2.457143
## [8] 2.142857 1.828571 2.171429 2.485714 2.571429 2.542857 1.828571
## [15] 2.542857 2.542857 3.314286 2.514286 2.542857 1.885714 2.542857
## [22] 2.514286 2.542857 2.400000 2.514286 2.514286 2.600000 2.057143
## [29] 2.085714 2.457143 2.057143 1.742857 1.828571 1.714286
##
## $`Barycenter Centrality`
## [1] 0.01724138 0.01470588 0.01694915 0.01408451 0.01149425 0.01162791
## [7] 0.01162791 0.01333333 0.01562500 0.01315789 0.01149425 0.01111111
## [13] 0.01123596 0.01562500 0.01123596 0.01123596 0.00862069 0.01136364
## [19] 0.01123596 0.01515152 0.01123596 0.01136364 0.01123596 0.01190476
## [25] 0.01136364 0.01136364 0.01098901 0.01388889 0.01369863 0.01162791
## [31] 0.01388889 0.01639344 0.01562500 0.01666667
##
## $`BottleNeck Centrality`
## [1] 33 13 27 1 1 8 8 2 21 0 1 1 7 22 4 4 7 7 4 20 4 7 4
## [24] 11 0 1 1 2 0 4 3 24 25 32
##
## $`Centroid value`
## [1] 0 -10 -1 -13 -29 -28 -28 -17 -6 -17 -29 -32 -31 -6 -25 -25 -30
## [18] -30 -25 -8 -25 -30 -25 -20 -27 -27 -25 -13 -14 -22 -13 -3 -5 -1
##
## $`Closeness Centrality (Freeman)`
## [1] 0.01724138 0.01470588 0.01694915 0.01408451 0.01149425 0.01162791
## [7] 0.01162791 0.01333333 0.01562500 0.01315789 0.01149425 0.01111111
## [13] 0.01123596 0.01562500 0.01123596 0.01123596 0.00862069 0.01136364
## [19] 0.01123596 0.01515152 0.01123596 0.01136364 0.01123596 0.01190476
## [25] 0.01136364 0.01136364 0.01098901 0.01388889 0.01369863 0.01162791
## [31] 0.01388889 0.01639344 0.01562500 0.01666667
##
## $ClusterRank
## [1] 12.750000 20.333333 18.577778 34.666667 17.333333 14.500000 14.500000
## [8] 45.000000 32.000000 0.000000 17.333333 NaN 24.000000 37.800000
## [15] 31.000000 31.000000 10.000000 27.000000 31.000000 15.000000 31.000000
## [22] 27.000000 31.000000 18.000000 5.333333 5.666667 23.000000 6.500000
## [29] 12.000000 26.666667 23.500000 12.000000 14.378788 9.044118
##
## $`Decay Centrality`
## [1] 12.25000 10.12500 11.37500 9.37500 7.50000 7.75000 7.75000
## [8] 8.68750 10.12500 8.31250 7.50000 6.87500 7.12500 10.12500
## [15] 7.28125 7.28125 5.00000 7.25000 7.28125 9.62500 7.28125
## [22] 7.25000 7.28125 8.28125 6.93750 6.93750 7.09375 9.06250
## [29] 8.81250 7.90625 9.06250 10.62500 11.06250 12.18750
##
## $`Degree Centrality`
## [1] 16 9 10 6 3 4 4 4 5 2 3 1 2 5 2 2 2 2 2 3 2 2 2
## [24] 5 3 3 2 4 3 4 4 6 12 17
##
## $`Diffusion Degree`
## [1] 85 61 76 52 26 29 29 45 64 29 26 17 24 63 31 31 10 27 31 45 31 27 31
## [24] 45 16 17 23 39 36 40 47 60 73 82
##
## $`DMNC - Density of Maximum Neighborhood Component`
## [1] 0.2779351 0.4655121 0.3878701 0.4014000 0.4789926 0.5925310 0.5925310
## [8] 0.5925310 0.4762315 1.0000000 0.4789926 0.0000000 0.3142533 0.5925310
## [15] 0.3142533 0.3142533 0.3142533 0.3142533 0.3142533 0.3142533 0.3142533
## [22] 0.3142533 0.3142533 0.2962655 0.3142533 0.3142533 0.3142533 0.3142533
## [29] 0.3142533 0.5925310 0.4789926 0.0000000 0.3468886 0.1828342
##
## $`Eccentricity Centrality`
## [1] 3 3 3 3 4 4 4 4 3 4 4 4 4 3 5 5 5 4 5 3 5 4 5 5 4 4 5 4 4 5 4 3 4 4
##
## $`eigenvector centralities`
## [1] 0.95213237 0.71233514 0.84955420 0.56561431 0.20347148 0.21288383
## [7] 0.21288383 0.45789093 0.60906844 0.27499812 0.20347148 0.14156633
## [13] 0.22566382 0.60657439 0.27159396 0.27159396 0.06330461 0.24747879
## [19] 0.27159396 0.39616224 0.27159396 0.24747879 0.27159396 0.40207086
## [25] 0.15280670 0.15857597 0.20242852 0.35749923 0.35107297 0.36147301
## [31] 0.46806481 0.51165649 0.82665886 1.00000000
##
## $`K-core Decomposition`
## [1] 4 4 4 4 3 3 3 4 4 2 3 1 2 4 2 2 2 2 2 3 2 2 2 3 3 3 2 3 3 3 4 3 4 4
##
## $`Geodesic K-Path Centrality`
## [1] 33 33 33 33 25 25 25 32 33 32 25 25 25 33 24 24 17 25 24 33 24 25 24
## [24] 24 32 32 23 32 32 24 32 33 32 32
##
## $`Katz Centrality (Katz Status Index)`
## [1] 4.982994 3.651810 4.121408 3.022648 1.890452 2.031073 2.031073
## [8] 2.577886 3.112664 1.926075 1.890452 1.498299 1.800564 3.091820
## [15] 1.940527 1.940527 1.406215 1.863480 1.940527 2.377414 1.940527
## [22] 1.863480 1.940527 2.586533 1.709116 1.730106 1.751366 2.355640
## [29] 2.226616 2.374316 2.616974 3.005410 4.265928 5.139339
##
## $`Kleinberg's authority centrality scores`
## [1] 0.95213237 0.71233514 0.84955420 0.56561431 0.20347148 0.21288383
## [7] 0.21288383 0.45789093 0.60906844 0.27499812 0.20347148 0.14156633
## [13] 0.22566382 0.60657439 0.27159396 0.27159396 0.06330461 0.24747879
## [19] 0.27159396 0.39616224 0.27159396 0.24747879 0.27159396 0.40207086
## [25] 0.15280670 0.15857597 0.20242852 0.35749923 0.35107297 0.36147301
## [31] 0.46806481 0.51165649 0.82665886 1.00000000
##
## $`Kleinberg's hub centrality scores`
## [1] 0.95213237 0.71233514 0.84955420 0.56561431 0.20347148 0.21288383
## [7] 0.21288383 0.45789093 0.60906844 0.27499812 0.20347148 0.14156633
## [13] 0.22566382 0.60657439 0.27159396 0.27159396 0.06330461 0.24747879
## [19] 0.27159396 0.39616224 0.27159396 0.24747879 0.27159396 0.40207086
## [25] 0.15280670 0.15857597 0.20242852 0.35749923 0.35107297 0.36147301
## [31] 0.46806481 0.51165649 0.82665886 1.00000000
##
## $`clustering coefficient`
## [1] 0.1500000 0.3333333 0.2444444 0.6666667 0.6666667 0.5000000 0.5000000
## [8] 1.0000000 0.5000000 0.0000000 0.6666667 NaN 1.0000000 0.6000000
## [15] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 0.3333333 1.0000000
## [22] 1.0000000 1.0000000 0.4000000 0.3333333 0.3333333 1.0000000 0.1666667
## [29] 0.3333333 0.6666667 0.5000000 0.2000000 0.1969697 0.1102941
##
## $`Lin Centrality`
## [1] 18.775862 16.014706 18.457627 15.338028 12.517241 12.662791 12.662791
## [8] 14.520000 17.015625 14.328947 12.517241 12.100000 12.235955 17.015625
## [15] 12.235955 12.235955 9.387931 12.375000 12.235955 16.500000 12.235955
## [22] 12.375000 12.235955 12.964286 12.375000 12.375000 11.967033 15.125000
## [29] 14.917808 12.662791 15.125000 17.852459 17.015625 18.150000
##
## $`Lobby Index (Centrality)`
## [1] 5 5 5 5 3 3 3 4 5 2 3 1 2 5 2 2 2 2 2 3 2 2 2 4 3 3 2 4 3 4 4 4 5 5
##
## $`Markov Centrality`
## [1] 0.070249891 0.043847292 0.057139177 0.029822790 0.012863125
## [6] 0.013849462 0.013849462 0.022303830 0.030421990 0.012237951
## [11] 0.012863125 0.006073612 0.011256800 0.029790727 0.011755307
## [16] 0.011755307 0.007663434 0.011669016 0.011755307 0.018691290
## [21] 0.011755307 0.011669016 0.011755307 0.024360384 0.013647306
## [26] 0.013786068 0.010611995 0.021213944 0.017780427 0.019309088
## [31] 0.023681893 0.031023783 0.053196955 0.076811842
##
## $`Radiality Centrality`
## [1] 4.424242 4.121212 4.393939 4.030303 3.545455 3.575758 3.575758
## [8] 3.909091 4.242424 3.878788 3.545455 3.454545 3.484848 4.242424
## [15] 3.484848 3.484848 2.666667 3.515152 3.484848 4.181818 3.484848
## [22] 3.515152 3.484848 3.636364 3.515152 3.515152 3.424242 4.000000
## [29] 3.969697 3.575758 4.000000 4.333333 4.242424 4.363636
##
## $`Shortest-Paths Betweenness Centrality`
## [1] 231.0714286 28.4785714 75.8507937 6.2880952 0.3333333
## [6] 15.8333333 15.8333333 0.0000000 29.5293651 0.4476190
## [11] 0.3333333 0.0000000 0.0000000 24.2158730 0.0000000
## [16] 0.0000000 0.0000000 0.0000000 0.0000000 17.1468254
## [21] 0.0000000 0.0000000 0.0000000 9.3000000 1.1666667
## [26] 2.0277778 0.0000000 11.7920635 0.9476190 1.5428571
## [31] 7.6095238 73.0095238 76.6904762 160.5515873
##
## $`Current-Flow Closeness Centrality`
## [1] 1.9327145 1.7333253 1.8402587 1.5452847 1.0802631 1.1255099 1.1255099
## [8] 1.3870796 1.5545106 1.0437812 1.0802631 0.6724479 0.9973096 1.5430081
## [15] 1.0212015 1.0212015 0.7905877 1.0180333 1.0212015 1.2901649 1.0212015
## [22] 1.0180333 1.0212015 1.4395418 1.1083637 1.1141949 0.9636705 1.3618770
## [29] 1.2596168 1.3092975 1.4204280 1.5702258 1.8181192 1.9530359
##
## $`Closeness centrality (Latora)`
## [1] 23.16667 19.16667 21.00000 17.66667 14.66667 15.16667 15.16667
## [8] 16.41667 18.50000 15.58333 14.66667 13.50000 14.00000 18.50000
## [15] 14.20000 14.20000 11.10000 14.16667 14.20000 17.50000 14.20000
## [22] 14.16667 14.20000 16.03333 13.91667 13.91667 13.95000 16.91667
## [29] 16.41667 15.36667 16.91667 19.33333 20.91667 23.25000
##
## $`Communicability Betweenness Centrality`
## [1] 636.800849 303.645689 425.929757 190.685533 50.841562 83.752310
## [7] 83.752310 121.953520 239.307912 45.739054 50.841562 15.258178
## [13] 34.121435 227.788259 44.862076 44.862076 8.313632 40.433598
## [19] 44.862076 113.006063 44.862076 40.433598 44.862076 126.269827
## [25] 26.709814 28.344688 27.577694 102.789069 81.115957 93.053305
## [31] 131.880074 241.480779 423.345826 586.650520
##
## $`Community Centrality`
## [1] 4.883730 4.953175 2.647619 2.647619 3.166667 3.586869 2.666667
## [8] 2.500000 1.666667 1.666667 2.818182 2.333333 2.333333 2.555556
## [15] 2.800000 2.818182 1.000000 1.000000 1.000000 1.000000 1.000000
## [22] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [29] 1.000000 1.000000 1.000000 1.000000 1.000000 0.000000
##
## $`Cross-Clique Connectivity`
## [1] 44 31 31 26 6 8 8 16 12 3 6 2 4 17 4 4 4 4 4 5 4 4 4
## [24] 11 5 5 4 6 5 10 9 10 28 35
##
## $`Entropy Centrality`
## [1] 7.740439 8.088788 8.088788 8.088788 8.088788 8.088788 8.088788
## [8] 8.088788 8.088788 8.088788 8.088788 8.088788 8.088788 8.088788
## [15] 8.088788 8.088788 8.088788 8.088788 8.088788 8.088788 8.088788
## [22] 8.088788 8.088788 8.088788 8.088788 8.088788 8.088788 8.088788
## [29] 8.088788 8.088788 8.088788 8.088788 8.088788 8.088788
##
## $`EPC - Edge Percolated Component`
## [1] 829.5882 824.2647 831.0000 809.2059 670.9118 684.7647 700.6471
## [8] 779.2353 801.3824 616.5000 677.0588 425.8235 634.8529 808.1765
## [15] 635.4412 631.7353 549.6471 637.6176 644.1176 736.2941 638.9412
## [22] 624.7941 617.6176 787.6176 692.2353 677.1471 589.2941 757.2647
## [29] 727.5588 755.1471 776.5294 792.9706 830.3529 831.4412
##
## $`Laplacian Centrality`
## [1] 410 194 242 134 58 70 70 102 148 60 58 34 50 146 64 64 22
## [18] 56 64 96 64 56 64 110 38 40 48 90 78 92 106 150 278 436
##
## $`Leverage Centrality`
## [1] 0.59598732 0.29944897 0.27098910 -0.01893939 -0.27568922
## [6] -0.03095238 -0.03095238 -0.40329670 -0.34065020 -0.72807018
## [11] -0.27568922 -0.88235294 -0.63888889 -0.35584416 -0.75187970
## [16] -0.75187970 -0.33333333 -0.70707071 -0.75187970 -0.62807018
## [21] -0.75187970 -0.70707071 -0.75187970 -0.09699941 -0.15873016
## [26] -0.19444444 -0.56140351 -0.25396825 -0.52393162 -0.22420635
## [31] -0.40369353 -0.04435661 0.47056555 0.65120570
##
## $`MNC - Maximum Neighborhood Component`
## [1] 10 8 7 6 3 4 4 4 5 1 3 1 2 4 2 2 2 2 2 2 2 2 2
## [24] 4 2 2 2 2 2 4 3 3 12 14
##
## $`Hubbell Index`
## NULL
##
## $`Semi Local Centrality`
## [1] 1547 1223 1546 1079 474 508 508 955 1348 630 474 351 495 1341
## [15] 654 654 128 567 654 953 654 567 654 881 257 278 470 794
## [29] 744 795 996 1216 1387 1479
##
## $`Closeness Vitality`
## NULL
##
## $`Residual Closeness Centrality`
## [1] 12.25000 10.12500 11.37500 9.37500 7.50000 7.75000 7.75000
## [8] 8.68750 10.12500 8.31250 7.50000 6.87500 7.12500 10.12500
## [15] 7.28125 7.28125 5.00000 7.25000 7.28125 9.62500 7.28125
## [22] 7.25000 7.28125 8.28125 6.93750 6.93750 7.09375 9.06250
## [29] 8.81250 7.90625 9.06250 10.62500 11.06250 12.18750
##
## $`Stress Centrality`
## [1] 0 1 10 2 0 1 2 0 5 1 0 0 0 4 0 0 0 0 0 2 0 0 0
## [24] 0 0 1 0 2 3 1 2 7 1 0
##
## $`Load Centrality`
## [1] 24.000000 18.500000 23.833333 10.000000 5.000000 5.500000 6.500000
## [8] 5.000000 9.250000 5.166667 4.000000 2.000000 5.000000 7.750000
## [15] 3.000000 3.000000 5.000000 3.000000 3.000000 4.583333 3.000000
## [22] 3.000000 3.000000 7.000000 6.000000 7.000000 4.000000 7.666667
## [29] 9.166667 6.000000 7.833333 15.083333 19.166667 24.000000
##
## $`Flow Betweenness Centrality`
## [1] 0 10 21 9 2 3 3 0 7 1 0 0 0 4 0 0 0 0 0 2 0 0 0
## [24] 0 0 5 0 3 5 4 5 12 12 0
##
## $`Information Centrality`
## [1] 1.9912816 1.7858503 1.8960241 1.5921115 1.1129983 1.1596162 1.1596162
## [8] 1.4291123 1.6016170 1.0754109 1.1129983 0.6928252 1.0275311 1.5897659
## [15] 1.0521470 1.0521470 0.8145449 1.0488828 1.0521470 1.3292608 1.0521470
## [22] 1.0488828 1.0521470 1.4831643 1.1419504 1.1479584 0.9928726 1.4031460
## [29] 1.2977870 1.3489732 1.4634712 1.6178084 1.8732137 2.0122188
In this function, you have the ability to specify some centrality types that is not your favor to calculate by the “except” argument:
pr.cent<-proper.centralities(zachary)
## [1] "Bonacich power centralities of positions"
## [2] "subgraph centrality scores"
## [3] "Topological Coefficient"
## [4] "Average Distance"
## [5] "Barycenter Centrality"
## [6] "BottleNeck Centrality"
## [7] "Centroid value"
## [8] "Closeness Centrality (Freeman)"
## [9] "ClusterRank"
## [10] "Decay Centrality"
## [11] "Degree Centrality"
## [12] "Diffusion Degree"
## [13] "DMNC - Density of Maximum Neighborhood Component"
## [14] "Eccentricity Centrality"
## [15] "eigenvector centralities"
## [16] "Flow Betweenness Centrality"
## [17] "Information Centrality"
## [18] "K-core Decomposition"
## [19] "Geodesic K-Path Centrality"
## [20] "Katz Centrality (Katz Status Index)"
## [21] "Kleinberg's authority centrality scores"
## [22] "Kleinberg's hub centrality scores"
## [23] "clustering coefficient"
## [24] "Lin Centrality"
## [25] "Load Centrality"
## [26] "Lobby Index (Centrality)"
## [27] "Markov Centrality"
## [28] "Radiality Centrality"
## [29] "Shortest-Paths Betweenness Centrality"
## [30] "Stress Centrality"
## [31] "Current-Flow Closeness Centrality"
## [32] "Closeness centrality (Latora)"
## [33] "Communicability Betweenness Centrality"
## [34] "Community Centrality"
## [35] "Cross-Clique Connectivity"
## [36] "Entropy Centrality"
## [37] "EPC - Edge Percolated Component"
## [38] "Laplacian Centrality"
## [39] "Leverage Centrality"
## [40] "MNC - Maximum Neighborhood Component"
## [41] "Hubbell Index"
## [42] "Semi Local Centrality"
## [43] "Closeness Vitality"
## [44] "Residual Closeness Centrality"
calc.cent<-calculate.centralities(zachary, except=pr.cent[5:40])
The result would be a list of computed centralities.
In order to figure out the order of most important centrality types based on your graph structure, “pca.centralities” function can be used. This applies principal component analysis on the computed centrality values(Husson, Lê, and Pages 2010). For this, the result of “calculate.centralities” method is needed:
pca.centralities( calc.cent )
A display of most informative centrality measures based on principal component analysis. The red line indicates the random threshold of contribution. This barplot represents contribution of variable values based on the number of dimensions.
For choosing the number of principal components, we considered cumulative percentage of variance values which are more than 80 as the cut off which can be edited using “cut.off” argument. It returns a plot for visualizing contribution values of the computed centrality measures due to the number of principal components. The “scale.unit” argument gives the ability to whether it should normalize the input or not.
pca.centralities( calc.cent , scale.unit = FALSE )
A representation of most informative centrality measures based on principal component analysis between unscaled(not normalized) centrality values.
Another method for distinguishing which centrality measure has more information or in another words has more costs is using (t-SNE) t-Distributed Stochastic Neighbor Embedding analysis(Van Der Maaten 2014). This is a non-linear dimensionality reduction algorithm used for high-dimensional data. “tsne.centralities”function applies t-sne on centrality measure values like below:
tsne.centralities( calc.cent, dims = 2, perplexity = 1, scale=TRUE)
A display of most informative centrality measures based on t-Distributed Stochastic Neighbor Embedding analysis among scaled(not normalized) centrality values.
This returns the bar plot of computed cost values of each centrality measure on a plot. In order to access only computed values of PCA and t-sne methods, “summary.pca.centralities” and “tsne.centralities” functions can be helpful.
To visualize the results of network centrality analysis some convenient functions have been developed as it described below.
After evaluating centrality measures, demonstrating high values of centralities in some nodes gives an overall insight about the network to the researcher. By using “visualize.graph” function, you will be able to illustrate the input graph based on the specified centrality value. If the centrality measure values were computed, “computed.centrality.value” argument is recommended. Otherwise, using “centrality.type” argument, the function will compute centrality based on the input name of centrality type. For practice, we specifies “Degree Centrality”. Here,
visualize.graph( zachary , centrality.type="Degree Centrality")
Graph illustration based on centrality measure. The size of nodes represent the degree centrality values.
On of the way of complex large network visualizations(more than 100 nodes and 200 edges) is using heatmap(Pryke, Mostaghim, and Nazemi 2007). “visualize.heatmap” function demonstrates a heatmap plot between the centrality values. The input is a list containing the computed values.
visualize.heatmap( calc.cent , scale = TRUE )
Observed centrality measure heatmap. The colors from blue to red displays scaled centrality values.
Comprehending pair correlation among centralities is a popular analysis for researchers(Dwyer et al. 2006). In order to that, “visualize.correlations” method is appropriate. In this you are able to specify the type of correlation which you are enthusiastic to obtain.
visualize.correlations(calc.cent,"pearson")
A display of correlation among computed centrality measures. The red to blue highlighted circles represent the top to bottom Pearson correlation coefficients(Benesty et al. 2009) which differ from -1 to 1. The higher the value becomes larger, circles’ sizes get larger too.
In order to visualize a simple clustering across the nodes of a graph based on a specific centrality measure, we can use the “visualize.dendogram” function. This function draw a dendrogram plot in which colors indicate the clusters.
visualize.dendogram(zachary,k=4)
Circular dendrogram plot of vertices based on specified centrality measure. Each color represents a cluster.
In this package additionally to correlation calculation, ability to apply linear regression for each pair of centralities has been prepared to realize the association between centralities. For visualization, “visualize.association” method is an approprite function to use:
subgraph_cent<-calc.cent[[1]]
Topological_coef<-calc.cent[[2]]
visualize.association( subgraph_cent, Topological_coef)
## $linear.regression
##
## Call:
## lm(formula = df[, 2] ~ df[, 1])
##
## Coefficients:
## (Intercept) df[, 1]
## 3.898e-16 -7.059e-01
##
##
## $visualization
Association plot between two centrality variables. The red line is an indicator of linear regression line among them.
To access the distribution of centrality values and their corresponding pair correlation value, “visualize.pair.correlation” would be helpful. The Pearson correlation(Benesty et al. 2009) has been used for this method.
visualize.pair.correlation( subgraph_cent ,Topological_coef)
Pairwise Pearson correlation between two centrality values.
The result is a scatterplot visualizing correlation values.
Barneh, Farnaz, Mohieddin Jafari, and Mehdi Mirzaie. 2015. “Updates on Drug–target Network; Facilitating Polypharmacology and Data Integration by Growth of Drugbank Database.” Briefings in Bioinformatics 17 (6). Oxford University Press: 1070–80.
Barret Schloerke, Di Cook, Jason Crowley, and Joseph Larmarange. 2016. “GGally: Extension to ’Ggplot2’. R Package Version 1.3.0.” Journal Article. https://CRAN.R-project.org/package=GGally.
Benesty, Jacob, Jingdong Chen, Yiteng Huang, and Israel Cohen. 2009. “Pearson Correlation Coefficient.” Noise Reduction in Speech Processing. Springer, 1–4.
Butts, Carter T. 2008. “Network: A Package for Managing Relational Data in R.” Journal Article. Journal of Statistical Software 24 (2): 1–36.
Csardi, Gabor, and Tamas Nepusz. 2006. “The Igraph Software Package for Complex Network Research.” Journal Article. InterJournal, Complex Systems 1695 (5): 1–9.
CT, Butts. 2007. “Sna: Tools for Social Network Analysis. Version 1.5.” Journal Article.
———. 2008. “Social Network Analysis with Sna. Journal of Statistical Software.” Journal Article, 24(6). http://www.jstatsoft.org/v24/i06/.
Data., Butts C (2015). network: Classes for Relational. 2015. “Network: Classes for Relational Data. the Statnet Project (Http://Statnet.org). R Package Version 1.13.0.” Journal Article.
Dwyer, Tim, Seok-Hee Hong, Dirk Koschützki, Falk Schreiber, and Kai Xu. 2006. “Visual Analysis of Network Centralities.” In Proceedings of the 2006 Asia-Pacific Symposium on Information Visualisation-Volume 60, 189–97. Australian Computer Society, Inc.
Felleman, Daniel J, and David C Van Essen. 1991. “Distributed Hierarchical Processing in the Primate Cerebral Cortex.” Journal Article. Cerebral Cortex 1 (1): 1–47.
Galili, Tal. 2015. “Dendextend: An R Package for Visualizing, Adjusting and Comparing Trees of Hierarchical Clustering.” Journal Article. Bioinformatics, btv428.
Garnier, Simon. 2017. Viridis: Default Color Maps from ’Matplotlib’. https://CRAN.R-project.org/package=viridis.
Gu, Zuguang, Lei Gu, Roland Eils, Matthias Schlesner, and Benedikt Brors. 2014. “Circlize Implements and Enhances Circular Visualization in R.” Journal Article. Bioinformatics, btu393.
Husson, F, S Lê, and J Pages. 2010. “Exploratory Multivariate Analysis by Example Using R, Volume 20105550 of Chapman & Hall/Crc Computer Science & Data Analysis.” Journal Article. CRC Press 30: 101–2.
Jalili, Mahdi, Ali Salehzadeh-Yazdi, Yazdan Asgari, Seyed Shahriar Arab, Marjan Yaghmaie, Ardeshir Ghavamzadeh, and Kamran Alimoghaddam. 2015. “CentiServer: A Comprehensive Resource, Web-Based Application and R Package for Centrality Analysis.” Journal Article. PloS One 10 (11): e0143111.
Kassambara. n.d. “A. Factoextra: Visualization of the Outputs of a Multivariate Analysis. R Package Version 1.0. 1. 2015.” Journal Article.
Kolde, Raivo. 2015. “Pheatmap: Pretty Heatmaps. R Package Version 1.0. 2.”
KONECT. 2016a. “Kangaroo Network Dataset.” Journal Article, October.
———. 2016b. “Rhesus Network Dataset.” Journal Article, October.
Krijthe, J. 2015. “Rtsne: T-Distributed Stochastic Neighbor Embedding Using Barnes-Hut Implementation.” R Package Version 0.10, URL Http://CRAN. R-Project. Org/Package= Rtsne.
Newman, Mark. 2010. Networks. Oxford University Press. doi:10.1093/acprof:oso/9780199206650.001.0001.
Pryke, Andy, Sanaz Mostaghim, and Alireza Nazemi. 2007. “Heatmap Visualization of Population Based Multi Objective Algorithms.” In Evolutionary Multi-Criterion Optimization, 361–75. Springer.
Rinker, Tyler W. 2015. qdapTools: Tools to Accompany the Qdap Package. Buffalo, New York: University at Buffalo/SUNY. https://github.com/trinker/qdapTools.
Sebastien Le, Francois Husson, Julie Josse. 2008. “FactoMineR: An R Package for Multivariate Analysis. Journal of Statistical Software.” Journal Article, no. 25(1): 1–18.
Simko, Taiyun Wei, and Viliam. 2016. “Corrplot: Visualization of a Correlation Matrix. R Package Version 0.77.” Journal Article.
Van Der Maaten, Laurens. 2014. “Accelerating T-Sne Using Tree-Based Algorithms.” Journal of Machine Learning Research 15 (1): 3221–45.
Wickham, Hadley. 2011. “The Split-Apply-Combine Strategy for Data Analysis.” Journal of Statistical Software 40 (1): 1–29. https://www.jstatsoft.org/article/view/v040i01.
———. 2016. Ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York. http://ggplot2.org/.
Zachary, Wayne W. 1977. “An Information Flow Model for Conflict and Fission in Small Groups.” Journal Article. Journal of Anthropological Research 33 (4): 452–73.