Closed mjafarpour87 closed 1 year ago
To calculate the radius of a network using NetworkX, you can use the networkx.algorithms.distance_measures.radius function. Here's an example code snippet:
import networkx as nx
# create a graph
G = nx.Graph()
G.add_edges_from([(1, 2), (2, 3), (3, 4), (4, 5)])
# calculate the radius
radius = nx.algorithms.distance_measures.radius(G)
print(radius) # output: 2
Do you want it to be placed in the info function?
I Update this but this error for test sample occur:
Found infinite path length because the digraph is not strongly connected
network radius is one of the metrics that should be calculated for the whole graph. It seems that we do not have it yet. Please make sure that it is calculated for directed networks, as well.