GraphMetrics
GraphMetrics(operation, out_file=None, verbose=False, overwrite=False)
Graph Network Metrics
GraphMetrics is a wrapper script that allows the user to compute various network metrics on an existing graph network. Depending on your hardware and the metric you want to compute, the script could be running for ~10 mins for a large graph (~10 000 nodes).
Available Metrics
Available metrics come from the Networkx implemented algorithms. As of now, only the algorithms that can handle undirected weighted graph are implemented (see operation argument). For more details regarding those algorithms, please see [1]. Details regarding specific operations: if NODE is required, you have to provide a single node label (such as ‘c1’). If NODES is required, you can provide multiple nodes within quotation marks (such as “c1 c2 c3”).
- eigencentrality: GRAPH WEIGHT - : Will return a dictionary of the eigenvector centrality for all nodes.
- closenesscentrality: GRAPH WEIGHT - : Will return a dictionary of the closeness centrality for all nodes.
- betweennesscentrality: GRAPH WEIGHT - : Will return a dictionary of the betweenness centrality for all nodes.
- informationcentrality: GRAPH WEIGHT - : Will return a dictionary of the information centrality for all nodes.
- currentflowbc: GRAPH WEIGHT - : Will return a dictionary of the current flow betweenness centrality for all nodes.
- loadcentrality: GRAPH WEIGHT - : Will return a dictionary of the load centrality for all nodes.
- harmoniccentrality: GRAPH WEIGHT - : Will return a dictionary of the harmonic centrality for all nodes.
- eccentricity: GRAPH WEIGHT - : Will return a dictionary of the eccentricity for all nodes.
- clustering: GRAPH WEIGHT - : Will return a dictionary of the clustering coefficient for all nodes.
- constraint: GRAPH NODES WEIGHT - : Will return a dictionary of the constraint for all specified nodes.
- effectivesize: GRAPH NODES WEIGHT - : Will return a dictionary of the effective size for all specified nodes.
- closenessvitality: GRAPH NODE WEIGHT - : Will return a dictionary of the closeness vitality for a single node.
- degree: GRAPH WEIGHT - : Will return the degree of the specified node.
Reference
[1] Networkx Algorithms (https://networkx.org/documentation/stable/reference/algorithms/index.html#)
Example Usage
Parameters
operation : List of arguments to provide to the script. The first argument is the operation to perform. The second argument is the input graph file. The rest of the arguments are the arguments required by the operation (see above).
out_file : Path and name of the file containing the metrics for each nodes. Default is : ./operation_name.xlsx
verbose : If true, produce verbose output.
overwrite : If true, force overwriting of existing output files.