Note

This is the documentation for the current state of the development branch of rustworkx. The documentation or APIs here can change prior to being released.

rustworkx.PyDiGraph.adj#

PyDiGraph.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 dat objects between that adjacent node and the provided node. Note in the case of a multigraph only one edge will be used, not all of the edges between two node.

Parameters:

node (int) – The index of the node to get the neighbors

Returns:

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