rustworkx.PyGraph.adj#
- PyGraph.adj(node, /)#
Get the index and data for the neighbors of a node.
This will return a dictionary where the keys are the node indices of the adjacent nodes (inbound or outbound) and the value is the edge data objects between that adjacent node and the provided node. Note, that in the case of multigraphs only a single edge data object will be returned
- Parameters:
node (int) – The index of the node to get the neighbors
- Returns neighbors:
A dictionary where the keys are node indices and the value is the edge data object for all nodes that share an edge with the specified node.
- Return type:
dict