NetworkX

Previous topic

networkx.MultiDiGraph.has_edge

Next topic

networkx.MultiDiGraph.nodes_with_selfloops

Quick search

networkx.MultiDiGraph.has_neighbor

MultiDiGraph.has_neighbor(u, v)

Return True if node u has neighbor v.

This returns True if there exists any edge (u,v,data) for some data.

See also

has_edge

Examples

>>> G=nx.path_graph(4)
>>> G.has_neighbor(0,1)
True
>>> G.has_edge(0,1) # same as has_neighbor
True
>>> 1 in G[0]  # this gives KeyError if u not in G
True