adding weights to eccentricity calculations

13 views
Skip to first unread message

akshay yeddanapudi

unread,
Feb 3, 2023, 1:44:19 AMFeb 3
to networkx-discuss
Hi all, 

I am trying to add edge weights to get the eccentricities of a weighted graph and am unable to figure out how the edge weights should be implemented in the eccentricity function. As per the documentation, it suggests that "if this is a string, then edge weights will be accessed via the edge attribute with this key (that is, the weight of the edge joining u to v will be G.edges[u, v][weight])."

Currently, I am getting the edge weights using get_edge_attributes(G, 'weights') but this returns a dictionary so I am not too sure how to translate the information which is saved here into the weights for eccentricity calculations. 

I would appreciate any input on how to get this to work and thanks in advance for any help!
Reply all
Reply to author
Forward
0 new messages