get_edge_data(self, u, v, key=None, default=None)
If a key is not provided, returns a dictionary mapping edge keys to attribute dictionaries for each edge between u and v.
This is identical to :None:None:`G[u][v][key]`
except the default is returned instead of an exception is the edge doesn't exist.
Value to return if the specific edge (u, v, key) is not found, OR if there are no edges between u and v and no key is specified.
Return data only for the edge with specified key, as an attribute dictionary (rather than a dictionary mapping keys to attribute dictionaries).
The edge attribute dictionary, OR a dictionary mapping edge keys to attribute dictionaries for each of those edges if no specific key is provided (even if there's only one edge between u and v).
Returns the attribute dictionary associated with edge (u, v, key).
>>> G = nx.MultiGraph() # or MultiDiGraph
... key = G.add_edge(0, 1, key="a", weight=7)
... G[0][1]["a"] # key='a' {'weight': 7}
>>> G.edges[0, 1, "a"] # key='a' {'weight': 7}
Warning: we protect the graph data structure by making :None:None:`G.edges`
and :None:None:`G[1][2]`
read-only dict-like structures. However, you can assign values to attributes in e.g. :None:None:`G.edges[1, 2, 'a']`
or :None:None:`G[1][2]['a']`
using an additional bracket as shown next. You need to specify all edge info to assign to the edge data associated with an edge.
>>> G[0][1]["a"]["weight"] = 10
... G.edges[0, 1, "a"]["weight"] = 10
... G[0][1]["a"]["weight"] 10
>>> G.edges[1, 0, "a"]["weight"] 10
>>> G = nx.MultiGraph() # or MultiDiGraph
... nx.add_path(G, [0, 1, 2, 3])
... G.edges[0, 1, 0]["weight"] = 5
... G.get_edge_data(0, 1) {0: {'weight': 5}}
>>> e = (0, 1)
... G.get_edge_data(*e) # tuple form {0: {'weight': 5}}
>>> G.get_edge_data(3, 0) # edge not in graph, returns None
... G.get_edge_data(3, 0, default=0) # edge not in graph, return default 0
>>> G.get_edge_data(1, 0, 0) # specific key gives back {'weight': 5}See :
The following pages refer to to this document either explicitly or contain code examples using this.
networkx.classes.multigraph.MultiGraph.get_edge_data
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them