Structural

Overview

StructuralGT.structural

Details

class StructuralGT.structural.Size(*args, **kwargs)

Bases: _Compute

Classical GT parameters. Calculates common proxies for network size. Edge weights are supported for the calculation of diameter.

property number_of_nodes

int: The total number of nodes.

property number_of_edges

int: The total number of edges.

property diameter

int: The maximum number of edges that have to be traversed to get from one node to any other node. Also referred to as the maximum eccentricity, or the longest-shortest path of the graph.

property density

float: The fraction of edges that exist compared to all possible edges in a complete graph:

\[\rho = \frac{2M}{N(N-1)}\]

Where \(N\) and \(M\) are the total number of nodes and edges, respectively.

class StructuralGT.structural.Clustering(*args, **kwargs)

Bases: _Compute

Calculates cluster properties. Weights are not supported.

property clustering

np.ndarray: Array of clustering coefficients, \(\delta_{i}\) s. The clustering coefficient is the fraction of neighbors of a node that are directly connected to each other as well (forming a triangle):

\[\delta_i = \frac{2*T_i}{k_i(k_i-1)}\]

Where \(T_i\) is the number of connected triples (visually triangles) on node \(i\).

property average_clustering_coefficient

float: The average clustering coefficient over nodes:

\[\Delta = \frac{\sum_i{\delta_i}}{N}\]
class StructuralGT.structural.Assortativity(*args, **kwargs)

Bases: _Compute

Assortativity refers to how related a node is to its neighbors. In this module, similarity refers to similarity by degree.

property assortativity

float: The assortativity coefficient, r, measures similarity of connections by node degree. This value approaches 1 if nodes with the same degree are directly connected to each other and approaches −1 if nodes are all connected to nodes with different degree. A value near 0 indicates uncorrelated connections: [New18]

\[r = \frac{1}{\sigma_q^2}\sum_{jk} jk(e_{jk}-q_j * q_k)\]

where \(q\) is the remaining degree distribution, \(\sigma_{q}^2\) is it variance. \(e_{jk}\) is the joint probability distribution of the remaining degrees of the two vertices at either end of a randomly chosen edge.

class StructuralGT.structural.Closeness(*args, **kwargs)

Bases: _Compute

Calculates closeness parameters. This module supports edge weights.

property closeness

np.ndarray: The closeness centrality of node \(i\) is the reciprocal of the average shortest distance from node \(i\) to all other nodes:

\[C_{C}(i) = \frac{n-1}{\sum_{j=1}^{n-1}L(i,j)}\]

where \(L(i,j)\) is the shortest path between nodes \(i\) and \(j\).

property average_closeness

float: The average closeness:

\[\Delta = \frac{\sum_i{C}}{n}\]
class StructuralGT.structural.Degree(*args, **kwargs)

Bases: _Compute

Calculates degree. This module support node weights, for the calculation of weighted node degree, sometimes called “strength”.

property degree

np.ndarray: The number of edges connected to each node.

property average_degree

np.ndarray: The average number of edges connected to each node.