From 2a00d0d0aa34d87d2f4f18d864050d7f0497680d Mon Sep 17 00:00:00 2001 From: Ranjita Poudel Date: Wed, 15 Aug 2018 10:34:01 -0400 Subject: [PATCH 1/6] update centrality documentation --- brainconn/centrality/centrality.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/brainconn/centrality/centrality.py b/brainconn/centrality/centrality.py index ea6e391..c670e6e 100644 --- a/brainconn/centrality/centrality.py +++ b/brainconn/centrality/centrality.py @@ -26,6 +26,10 @@ def betweenness_bin(G): ----- Betweenness centrality may be normalised to the range [0,1] as BC/[(N-1)(N-2)], where N is the number of nodes in the network. + + Betweeness centrality assumes that the information is routed + along the shortest paths which may not be an appropriate assumption + in case information transmission in brain. """ G = np.array(G, dtype=float) # force G to have float type so it can be # compared to float np.inf From d7b53216d2e2ce3cf191424eb6c7bfb083d044aa Mon Sep 17 00:00:00 2001 From: Ranjita Poudel Date: Wed, 15 Aug 2018 10:48:42 -0400 Subject: [PATCH 2/6] Interesting fact on Pagerank centrality --- brainconn/centrality/centrality.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/brainconn/centrality/centrality.py b/brainconn/centrality/centrality.py index c670e6e..2449d8a 100644 --- a/brainconn/centrality/centrality.py +++ b/brainconn/centrality/centrality.py @@ -29,7 +29,7 @@ def betweenness_bin(G): Betweeness centrality assumes that the information is routed along the shortest paths which may not be an appropriate assumption - in case information transmission in brain. + in case information transmission in brain. """ G = np.array(G, dtype=float) # force G to have float type so it can be # compared to float np.inf @@ -659,6 +659,9 @@ def module_degree_zscore(W, ci, flag=0): def pagerank_centrality(A, d, falff=None): """ + Interesting fact: It is used to rank websites in the results of Google + search engine. + The PageRank centrality is a variant of eigenvector centrality. This function computes the PageRank centrality of each vertex in a graph. From 1f5ba59d23af90694c59f41fe7a3730ca2bc5288 Mon Sep 17 00:00:00 2001 From: Ranjita Poudel Date: Wed, 15 Aug 2018 14:14:38 -0400 Subject: [PATCH 3/6] addition Leverage centrality and limitations --- brainconn/centrality/centrality.py | 50 ++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/brainconn/centrality/centrality.py b/brainconn/centrality/centrality.py index 2449d8a..4452b7c 100644 --- a/brainconn/centrality/centrality.py +++ b/brainconn/centrality/centrality.py @@ -7,13 +7,39 @@ from ..distance import reachdist from ..utils import invert +def Degree_centrality (G): + """ + Degree centrality, is the simplest measure of centrality. It assumes + that no nodes with many connections exert more influence over network. + However, the limitation of degree centrality is that all connections + are treated as same strength. + + """ + +def Delta_centrality (G): + """ + Another way of thinking about centrality is that it does not depend + on either degree, closeness or betweenness but is based on the effect + of the removal of a node has on the structure and function of the rest + of the network. + + The intuition behind this measure is that inactivation of nodes will + exert a disproportionate impact on remaining network elements. + + Delta centrality is closely related to analysis of network robustness. + + Used to creat putative scaffold. Refer to Sporns (2016) paper to see an + example of structural scaffold of human brain. + """ -def betweenness_bin(G): +def betweenness(G): """ Node betweenness centrality is the fraction of all shortest paths in the network that contain a given node. Nodes with high values of betweenness centrality participate in a large number of shortest paths. + + Parameters ---------- A : NxN :obj:`numpy.ndarray` @@ -189,7 +215,7 @@ def entropy(w_): return Hpos, Hneg -def edge_betweenness_bin(G): +def edge_betweenness(G): """ Edge betweenness centrality is the fraction of all shortest paths in the network that contain a given edge. Edges with high values of @@ -345,6 +371,13 @@ def eigenvector_centrality_und(CIJ): node i is equivalent to the ith element in the eigenvector corresponding to the largest eigenvalue of the adjacency matrix. + Eigenvector centrality is based on the notion that the given node is highly + central if its' neighbors also share the same property. Howveer, it does not + account for the disparity in degree of a node with respect to its' + neighbours. This has different implications depending on the networks' + assortavity and the tendency of a node to be connected to nodes with + similar degrees (Joyce, 2010) + Parameters ---------- CIJ : NxN :obj:`numpy.ndarray` @@ -824,3 +857,16 @@ def subgraph_centrality(CIJ): # compute eigenvector centr. Cs = np.real(np.dot(vecs * vecs, np.exp(vals))) return Cs # imaginary part from precision error + +def Leverage_centrality: + """ + This concept considers the centrality of the node depending on whether + its neighbour rely on the node for information + + leverage centrality does not assume shortest path or in a serial fashion. + It focuses on disparity in node degrees to quantify information flow + locally. + + For further information on utitlity of leverage centrality in the + brain network refer to Joyce (2010) + """ From 4caf3f080c9cc6e115630ef96c82f08894f7a790 Mon Sep 17 00:00:00 2001 From: Ranjita Poudel Date: Wed, 15 Aug 2018 14:41:51 -0400 Subject: [PATCH 4/6] changes addressing comments --- brainconn/centrality/centrality.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/brainconn/centrality/centrality.py b/brainconn/centrality/centrality.py index 4452b7c..1f72137 100644 --- a/brainconn/centrality/centrality.py +++ b/brainconn/centrality/centrality.py @@ -7,7 +7,7 @@ from ..distance import reachdist from ..utils import invert -def Degree_centrality (G): +def degree_centrality (G): """ Degree centrality, is the simplest measure of centrality. It assumes that no nodes with many connections exert more influence over network. @@ -16,7 +16,7 @@ def Degree_centrality (G): """ -def Delta_centrality (G): +def delta_centrality (G): """ Another way of thinking about centrality is that it does not depend on either degree, closeness or betweenness but is based on the effect @@ -858,7 +858,7 @@ def subgraph_centrality(CIJ): Cs = np.real(np.dot(vecs * vecs, np.exp(vals))) return Cs # imaginary part from precision error -def Leverage_centrality: +def leverage_centrality (): """ This concept considers the centrality of the node depending on whether its neighbour rely on the node for information From b18f6395dea3a0d8a1187156ce6f5a33e415c501 Mon Sep 17 00:00:00 2001 From: Ranjita Poudel Date: Wed, 15 Aug 2018 14:45:38 -0400 Subject: [PATCH 5/6] additional changes --- brainconn/centrality/centrality.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/brainconn/centrality/centrality.py b/brainconn/centrality/centrality.py index 1f72137..ca7dca2 100644 --- a/brainconn/centrality/centrality.py +++ b/brainconn/centrality/centrality.py @@ -858,7 +858,8 @@ def subgraph_centrality(CIJ): Cs = np.real(np.dot(vecs * vecs, np.exp(vals))) return Cs # imaginary part from precision error -def leverage_centrality (): + +def leverage_centrality(): """ This concept considers the centrality of the node depending on whether its neighbour rely on the node for information @@ -870,3 +871,4 @@ def leverage_centrality (): For further information on utitlity of leverage centrality in the brain network refer to Joyce (2010) """ + pass From 15ded57bfe31c7cbff466da3786bdae3096485a2 Mon Sep 17 00:00:00 2001 From: Ranjita Poudel Date: Wed, 15 Aug 2018 14:48:02 -0400 Subject: [PATCH 6/6] additional changess --- brainconn/centrality/centrality.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/brainconn/centrality/centrality.py b/brainconn/centrality/centrality.py index ca7dca2..2114f36 100644 --- a/brainconn/centrality/centrality.py +++ b/brainconn/centrality/centrality.py @@ -7,7 +7,8 @@ from ..distance import reachdist from ..utils import invert -def degree_centrality (G): + +def degree_centrality(G): """ Degree centrality, is the simplest measure of centrality. It assumes that no nodes with many connections exert more influence over network. @@ -15,8 +16,10 @@ def degree_centrality (G): are treated as same strength. """ + pass -def delta_centrality (G): + +def delta_centrality(G): """ Another way of thinking about centrality is that it does not depend on either degree, closeness or betweenness but is based on the effect @@ -31,6 +34,8 @@ def delta_centrality (G): Used to creat putative scaffold. Refer to Sporns (2016) paper to see an example of structural scaffold of human brain. """ + pass + def betweenness(G): """ @@ -38,8 +43,6 @@ def betweenness(G): the network that contain a given node. Nodes with high values of betweenness centrality participate in a large number of shortest paths. - - Parameters ---------- A : NxN :obj:`numpy.ndarray`