public class GraphTheoryMetrics
extends Object
Class to deal with graph-theory metrics computation.
Important: Internal computations (like shortest-paths) are cached in order to improve efficiency.
Constructor and Description |
---|
GraphTheoryMetrics(int[][] linkTable,
int N,
double[] costVector)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
double |
getAlgebraicConnectivity()
Returns the algebraic connectivity of the network.
|
double |
getAssortativity()
Returns the assortativity of the network.
|
double |
getAverageNeighborConnectivity()
Returns the average neighbor connectivity.
|
double |
getAverageOutNodeDegree()
Returns the average number of outgoing links per node.
|
double |
getAverageShortestPathDistance()
Returns the average shortest path distance among all node-pair shortest paths.
|
double |
getAverageTwoTermReliability()
Returns the average two-term reliability (A2TR) of the network.
|
double[][] |
getBetweenessCentrality()
Returns the betweeness centrality for nodes and links.
|
double |
getClusteringCoefficient()
Returns the clustering coefficient of the network.
|
double |
getDensity()
Returns the density of the network.
|
double |
getDiameter()
Returns the diameter of the network.
|
double |
getHeterogeneity()
Returns the heterogeneity of the network.
|
int |
getLinkConnectivity()
Returns the link connectivity.
|
int[] |
getNeighbors(int nodeId)
Returns the set of nodes reachable from a given node.
|
int |
getNodeConnectivity()
Returns the node connectivity.
|
int[] |
getOutNodeDegree()
Returns the number of outgoing links for each node.
|
double |
getSpectralRadius()
Returns the spectral radius of the network.
|
double |
getSymmetryRatio()
Returns the symmetry ratio.
|
public GraphTheoryMetrics(int[][] linkTable, int N, double[] costVector)
linkTable
- Set of installed links (first column: origin node, second column: destination node)N
- Number of nodes in the networkcostVector
- Link weightspublic double getAlgebraicConnectivity()
Returns the algebraic connectivity of the network. The algebraic connectivity is equal to the second smallest eigenvalue of the laplacian matrix.
For symmetric (or undirected) networks, if the algebraic connectivity is different from zero, it is ensured that the network is connected, that is, it is possible to find a path between each node pair.
public double getAssortativity()
public double getAverageNeighborConnectivity()
public double getAverageOutNodeDegree()
public double getAverageShortestPathDistance()
public double getAverageTwoTermReliability()
public double[][] getBetweenessCentrality()
Returns the betweeness centrality for nodes and links. The betweeness centrality is equal to the number of node-pair shortest paths which pass through a network element (node or link).
Internally it makes use of the Brandes' algorithm.
output[0]
is equal to the betweeness
centrality per node, output[1]
is that for links)public double getClusteringCoefficient()
public double getDensity()
public double getDiameter()
public double getHeterogeneity()
public int getLinkConnectivity()
Returns the link connectivity. The link connectivity is equal to the smallest number of link-disjoint paths between each node pair.
Internally it makes use of the Edmonds-Karp algorithm to compute the maximum flow between each node pair, assuming a link capacity equal to one for every link.
public int[] getNeighbors(int nodeId)
nodeId
- Node identifierpublic int getNodeConnectivity()
Internally it makes use of the (modified) Edmonds-Karp algorithm to compute the maximum flow between each node pair, assuming a link capacity equal to one for every link.
public int[] getOutNodeDegree()
public double getSpectralRadius()
public double getSymmetryRatio()