rustworkx.PyDiGraph.adj_direction#

PyDiGraph.adj_direction(node, direction, /)#

Get the index and data for either the parent or children of a node.

This will return a dictionary where the keys are the node indices of the adjacent nodes (inbound or outbound as specified) and the value is the edge data objects for the edges between that adjacent node and the provided node. Note in the case of a multigraph only one edge 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

  • direction (bool) – The direction to use for finding nodes, True means inbound edges and False means outbound edges.

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