networkx package¶
Reference page for the bluegraph.backends.networkx package. All the interfaces below are also available as bluegraph.backends.networkx.<interface> (for example, from bluegraph.backends.networkx import NXPathFinder
).
Graph metrics¶
- class bluegraph.backends.networkx.analyse.metrics.NXMetricProcessor(pgframe=None, directed=True)¶
Class for metric processing based on NetworkX graphs.
- betweenness_centrality(distance=None, write=False, write_property=None)¶
Compute (weighted) betweenness centrality.
- closeness_centrality(distance=None, write=False, write_property=None)¶
Compute (weighted) closeness centrality.
- degree_centrality(weight=None, write=False, write_property=None)¶
Compute (weighted) degree centrality.
- pagerank_centrality(weight=None, write=False, write_property=None)¶
Compute (weighted) PageRank centrality.
Path search¶
- class bluegraph.backends.networkx.analyse.paths.NXPathFinder(pgframe=None, directed=True)¶
NetworkX-based shortest paths finder.
- get_distance(source, target, distance)¶
Get distance value between source and target.
- get_subgraph_from_paths(paths)¶
Get a subgraph given the input paths.
- minimum_spanning_tree(distance, write=False, write_property=None)¶
Compute the minimum spanning tree.
- Parameters
distance (str) – Distance to minimize when computing the minimum spanning tree (MST)
write (bool, optional) – Flag indicating whether the MST should be returned as a new graph object or saved within a Boolean edge property being True whenever a given edge belongs to the MST.
write_property (str, optional) – Edge property name for marking edges beloning to the MST.
- Returns
tree – The minimum spanning tree graph object
- Return type
nx.Graph
- bluegraph.backends.networkx.analyse.paths.handle_exclude_nx_edge(method)¶
Method decorator that removes and restores the direct s/t edge.
Community Detection¶
- class bluegraph.backends.networkx.analyse.communities.NXCommunityDetector(pgframe=None, directed=True)¶
NetworkX-based community detection interface.
Currently supported community detection strategies for NetworkX:
Louvain algorithm (strategy=”louvain”)
Girvan–Newman algorithm (strategy=”girvan-newman”)
Label propagation (strategy=”lpa”)
Hierarchical clustering (strategy=”hierarchical”)
References
https://networkx.org/documentation/stable/reference/algorithms/community.html