metrics
class PathLengthsMethods(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases: str
, Enum
BellmanFord = ‘bellman-ford’
Dijkstra = ‘dijkstra’
FloydWarshall = ‘floyd-warshall’
FloydWarshallNumpy = ‘floyd-warshall-numpy’
betweennesscentrality(graph, weight=None)
betweennesscentrality: GRAPH WEIGHT
Will return a dictionary of the betweenness centrality for all nodes.
Parameters
graph : Networkx graph object.
weight : Edge attributes to use as weight. Defaults to None.
Returns
dict : Dictionary of the betweenness centrality for all nodes.
closenesscentrality(graph, weight=None)
closenesscentrality: GRAPH WEIGHT
Will return a dictionary of the closeness centrality for all nodes.
Parameters
graph : Networkx graph object.
weight : Edge attributes to use as weight. Defaults to None.
Returns
dict : Dictionary of the closeness centrality for all nodes.
closenessvitality(graph, nodes, weight=None)
closenessvitality: GRAPH NODE WEIGHT
Will return a dictionary of the closeness vitality for a single node.
Parameters
graph : Networkx graph object.
nodes : Node to compute the closeness vitality for.
weight : Edge attributes to use as weight. Defaults to None.
Returns
dict : Dictionary of the closeness vitality for a single node.
clustering(graph, weight=None)
clustering: GRAPH WEIGHT
Will return a dictionary of the clustering coefficient for all nodes.
Parameters
graph : Networkx graph object.
weight : Edge attributes to use as weight. Defaults to None.
Returns
dict : Dictionary of the clustering coefficient for all nodes.
constraint(graph, nodes, weight=None)
constraint: GRAPH NODES WEIGHT
Will return a dictionary of the constraint for all specified nodes.
Parameters
graph : Networkx graph object.
nodes : Nodes to compute the constraint for.
weight : Edge attributes to use as weight. Defaults to None.
Returns
dict : Dictionary of the constraint for all specified nodes.
currentflowbc(graph, weight=None)
currentflowbc: GRAPH WEIGHT
Will return a dictionary of the current flow betweenness centrality for all nodes.
Parameters
graph : Networkx graph object.
weight : Edge attributes to use as weight. Defaults to None.
Returns
dict : Dictionary of the current flow betweenness centrality for all nodes.
degree(graph, weight=None)
degree: GRAPH WEIGHT
Will return the degree of the specified node.
Parameters
graph : Networkx graph object.
weight : Edge attributes to use as weight. Defaults to None.
Returns
dict : Dictionary of the degree for all nodes.
eccentricity(graph, weight=None)
eccentricity: GRAPH WEIGHT
Will return a dictionary of the eccentricity for all nodes.
Parameters
graph : Networkx graph object.
weight : Edge attributes to use as weight. Defaults to None.
Returns
dict : Dictionary of the eccentricity for all nodes.
effectivesize(graph, nodes, weight=None)
effectivesize: GRAPH NODES WEIGHT
Will return a dictionary of the effective size for all specified nodes.
Parameters
graph : Networkx graph object.
nodes : Nodes to compute the effective size for.
weight : Edge attributes to use as weight. Defaults to None.
Returns
dict : Dictionary of the effective size for all specified nodes.
eigencentrality(graph, weight=None)
eigencentrality: GRAPH WEIGHT
Will return a dictionary of the eigenvector centrality for all nodes.
Parameters
graph : Networkx graph object.
weight : Edge attributes to use as weight. Defaults to None.
Returns
dict : Dictionary of the eigenvector centrality for all nodes.
get_metrics_ops()
Get a dictionary of all functions related to graph network metrics.
Returns
dict : Dictionary of functions.
harmoniccentrality(graph, weight=None)
harmoniccentrality: GRAPH WEIGHT
Will return a dictionary of the harmonic centrality for all nodes.
Parameters
graph : Networkx graph object.
weight : Edge attributes to use as weight. Defaults to None.
Returns
dict : Dictionary of the harmonic centrality for all nodes.
informationcentrality(graph, weight=None)
informationcentrality: GRAPH WEIGHT
Will return a dictionary of the information centrality for all nodes.
Parameters
graph : Networkx graph object.
weight : Edge attributes to use as weight. Defaults to None.
Returns
dict : Dictionary of the information centrality for all nodes.
loadcentrality(graph, weight=None)
loadcentrality: GRAPH WEIGHT
Will return a dictionary of the load centrality for all nodes.
Parameters
graph : Networkx graph object.
weight : Edge attributes to use as weight. Defaults to None.
Returns
dict : Dictionary of the load centrality for all nodes.
weightedpath(graph, df, label_name, cohort=None, iterations=1000, weight=None, method=‘dijkstra’, distribution=None, processes=1, verbose=False)
Function to compute the average weighted shortest path length for a group of nodes. The function will also compute the p-value between the group of nodes and the randomly generated null distribution.
Parameters
graph : Networkx graph object.
df : Dataframe containing the nodes.
label_name : Name of the column containing the group label.
cohort : Name of the cohort. Defaults to None.
iterations : Number of iterations to run. Defaults to 1000.
weight : Edge attributes to use as weight. Defaults to None.
method : Method to use for path computation. Defaults to “dijkstra”.
distribution : Pre-computed distribution. Defaults to None.
processes : Number of processes to use. Defaults to 1.
verbose : Verbose flag. Defaults to False.
Returns
avg_path_length : Average path length.
dist : Null distribution.
pvalue : P-value.