has_edge(self, u, v)
This is the same as :None:None:`v in G[u]`
without KeyError exceptions.
Nodes can be, for example, strings or numbers. Nodes must be hashable (and not None) Python objects.
True if edge is in the graph, False otherwise.
Returns True if the edge (u, v) is in the graph.
>>> G = nx.path_graph(4) # or DiGraph, MultiGraph, MultiDiGraph, etc
... G.has_edge(0, 1) # using two nodes True
>>> e = (0, 1)
... G.has_edge(*e) # e is a 2-tuple (u, v) True
>>> e = (0, 1, {"weight": 7})
... G.has_edge(*e[:2]) # e is a 3-tuple (u, v, data_dictionary) True
The following syntax are equivalent:
>>> G.has_edge(0, 1) True
>>> 1 in G[0] # though this gives KeyError if 0 not in G TrueSee :
The following pages refer to to this document either explicitly or contain code examples using this.
networkx.classes.graph.Graph.has_edge
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