grinpy.functions.neighborhoods.are_neighbors¶

grinpy.functions.neighborhoods.
are_neighbors
(G, u, v)¶ Returns true if u is adjacent to v. Otherwise, returns false.
Parameters:  G (NetworkX graph) – An undirected graph.
 u (node) – A node in the graph.
 v (node) – A node in the graph.
Returns: True if u is a neighbor of v in G, False otherwise.
Return type: bool
Examples
>>> G = nx.star_graph(3) # Star on 4 nodes >>> nx.are_neighbors(G, 0, 1) True >>> nx.are_neighbors(G, 1, 2) False