gammagl.utils.find_all_simple_paths

class find_all_simple_paths(edge_index, src, dest, max_length)[source]

The find_all_simple_paths function is used to find all simple paths (that is, paths that do not duplicate nodes) from the source node to the destination node in a given graph. The function accepts as parameters the edge index of the graph, the maximum length of the source node, the target node, and the path, and returns a list of all simple paths from the source node to the target node that do not exceed the maximum length.

Parameters:
  • edge_index (tensor) – A 2-D Tensor of the edge index of a graph with the shape [2, num_edges]. Each column contains two end-point indexes for one side.

  • src (tensor) – The index of the source node.

  • dest (tensor) – The index of the target node.

  • max_length (int) – The maximum length of a path.

Returns:

A list of all the simple paths from the source node to the destination node.

Return type:

list[list[int]]