Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

networkx.algorithms.approximation.steinertree.metric_closure

metric_closure(G, weight='weight')[source]

Return the metric closure of a graph.

The metric closure of a graph G is the complete graph in which each edge is weighted by the shortest path distance between the nodes in G .

Parameters

G (NetworkX graph)

Returns

Metric closure of the graph G.

Return type

NetworkX graph