graphscope.nx.classes.function.common_neighbors¶
- graphscope.nx.classes.function.common_neighbors(G, u, v)[source]¶
- Returns the common neighbors of two nodes in a graph. - Parameters:
- G (graph) – A NetworkX undirected graph. 
- u (nodes) – Nodes in the graph. 
- v (nodes) – Nodes in the graph. 
 
- Returns:
- cnbors – Iterator of common neighbors of u and v in the graph. 
- Return type:
- iterator 
- Raises:
- NetworkXError – If u or v is not a node in the graph. 
 - Examples - >>> G = nx.complete_graph(5) >>> sorted(nx.common_neighbors(G, 0, 1)) [2, 3, 4]