differt.rt.generate_all_path_candidates

differt.rt.generate_all_path_candidates#

generate_all_path_candidates(num_primitives, order)[source]#

Generate an array of all path candidates for fixed path order and a number of primitives.

The returned array contains, for each row, an array of order indices indicating the primitive with which the path interacts.

This list is generated as the list of all paths from one node to another, by passing by exactly order primitives. Calling this function is equivalent to calling itertools.product with parameters [0, 1, ..., num_primitives - 1] and repeat=order, and removing entries containing loops, i.e., two or more consecutive indices that are equal.

Parameters:
  • num_primitives (int) – The (positive) number of primitives.

  • order (int) – The path order. An order less than one returns an empty array.

Return type:

Int[Array, 'num_candidates order']

Returns:

An unsigned array with primitive indices on each column. Its number of columns is actually equal to num_primitives * ((num_primitives - 1) ** (order - 1)).