How to get the weight from an object of type "networkx.classes.graph.Graph"

30 views
Skip to first unread message

praveer kumar

unread,
Dec 20, 2023, 9:35:46 AM12/20/23
to networkx-discuss
Hi Experts, 
I am absolutely new to the NetworkX library. I need to know the weight of the edges.
I have a graph data structure, which holds data as shown below:

could someone suggest if there is any API to get the data when the object type is "networkx.classes.graph.Graph"
subgraph :

<networkx.classes.graph.Graph object at 0x7f9af67d2af0>
special variables
function variables
class variables
adj:
AdjacencyView(FilterAdjacency({'1.0': {'2.0': {'weight': 1.0}}, '2.0': {'1.0': {'weight': 1.0}, '3.0': {'weight': 8.0}, '4.0': {'weight': 10.0}, '5.0': {'weight': 1.0}, '6.0': {'weight': 1.0}, '7.0': {'weight': 1.0}, '8.0': {'weight': 1.0}, '9.0': {'weight': 2.0}, '10.0': {'weight': 1.0}, '11.0': {'weight': 5.0}}, '3.0': {'2.0': {'weight': 8.0}, '4.0': {'weight': 6.0}, '11.0': {'weight': 3.0}}, '4.0': {'2.0': {'weight': 10.0}, '3.0': {'weight': 6.0}, '11.0': {'weight': 3.0}}, '5.0': {'2.0': {'weight': 1.0}}, '6.0': {'2.0': {'weight': 1.0}}, '7.0': {'2.0': {'weight': 1.0}}, '8.0': {'2.0': {'weight': 1.0}}, '9.0': {'2.0': {'weight': 2.0}}, '10.0': {'2.0': {'weight': 1.0}}, '11.0': {'2.0': {'weight': 5.0}, '3.0': {'weight': 3.0}, '4.0': {'weight': 3.0}, '12.0': {'weight': 1.0}, '13.0': {'weight': 1.0}, '14.0': {'weight': 1.0}, '15.0': {'weight': 1.0}, '16.0': {'weight': 1.0}, '24.0': {'weight': 9.0}, '25.0': {'weight': 7.0}, '26.0': {'weight': 12.0}, '27.0': {'weight': 31.0}, '28.0': {'weight': 17.0}, '29.0': {'...
degree:
DegreeView({})
edges:
EdgeView([])
frozen:
True
graph:
{}
name:
''
nodes:
NodeView(())
_EDGE_OK:
<function no_filter at 0x7f9ac7eead30>
_NODE_OK:
<networkx.classes.filters.show_nodes object at 0x7f9af67d2b50>
_adj:
FilterAdjacency({'1.0': {'2.0': {'weight': 1.0}}, '2.0': {'1.0': {'weight': 1.0}, '3.0': {'weight': 8.0}, '4.0': {'weight': 10.0}, '5.0': {'weight': 1.0}, '6.0': {'weight': 1.0}, '7.0': {'weight': 1.0}, '8.0': {'weight': 1.0}, '9.0': {'weight': 2.0}, '10.0': {'weight': 1.0}, '11.0': {'weight': 5.0}}, '3.0': {'2.0': {'weight': 8.0}, '4.0': {'weight': 6.0}, '11.0': {'weight': 3.0}}, '4.0': {'2.0': {'weight': 10.0}, '3.0': {'weight': 6.0}, '11.0': {'weight': 3.0}}, '5.0': {'2.0': {'weight': 1.0}}, '6.0': {'2.0': {'weight': 1.0}}, '7.0': {'2.0': {'weight': 1.0}}, '8.0': {'2.0': {'weight': 1.0}}, '9.0': {'2.0': {'weight': 2.0}}, '10.0': {'2.0': {'weight': 1.0}}, '11.0': {'2.0': {'weight': 5.0}, '3.0': {'weight': 3.0}, '4.0': {'weight': 3.0}, '12.0': {'weight': 1.0}, '13.0': {'weight': 1.0}, '14.0': {'weight': 1.0}, '15.0': {'weight': 1.0}, '16.0': {'weight': 1.0}, '24.0': {'weight': 9.0}, '25.0': {'weight': 7.0}, '26.0': {'weight': 12.0}, '27.0': {'weight': 31.0}, '28.0': {'weight': 17.0}, '29.0': {'weight': 8.0},...
_graph:
<networkx.classes.graph.Graph object at 0x7f9afc502580>
_node:
FilterAtlas({'1.0': {}, '2.0': {}, '3.0': {}, '4.0': {}, '5.0': {}, '6.0': {}, '7.0': {}, '8.0': {}, '9.0': {}, '10.0': {}, '1

Thanks  in advance.

Dan Schult

unread,
Dec 20, 2023, 7:18:08 PM12/20/23
to networkx...@googlegroups.com
Perhaps `nx.get_edge_attributes`

--
You received this message because you are subscribed to the Google Groups "networkx-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to networkx-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/networkx-discuss/becd6310-897b-4ba2-8083-867e91128f91n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages