About the Combination of Operation Inputs

This page provides detailed information on how operations manage lists of items and structures of nested lists. It also helps to master structure management at an advanced level.

This page discusses:

Definitions

Input items are nested in lists which compose the global structure. The depth of a structure is defined by a maximum number of authorized levels in the lists.

Captions

Atomic element Item expected by a node as input to compute an output.
List Ordered set of items
Structure root Top level of the structure

Examples

Example of a structure containing three lists, each one containing two items

Example of a structure with a depth of three levels

Operation Execution

An operation needs a set of inputs to run. If there is only one atomic element in each input, the operation runs one time. If there is more than one atomic element, the operation runs several times.

Basic Case

The following case describes the basic behavior of an operation execution using the Plus operation as an example.

This operation expects two inputs of Real type.

One run Two runs




  • When several inputs are included in a list, the operation runs for each atomic element and iterates on them. For a successful execution, a rule applies, and one of its criteria needs to be followed:
    1. n to n: the lists include same number of items.

      In this case, atomic elements are read in parallel. The first run is on the first items of each list, and the second run is on the second items. There is nth run on nth items of each list.

    2. 1 to n: the lists include different number of items, but one of the lists includes only one item (called singleton).

      In this case, the operation runs twice. While iterating on the longest list, the singleton is used as many times as necessary.

  • If lists include different number of items and none of them includes a singleton (that is, the 1 to n criteria is not followed), the operation returns an incompatible structures error.

  • If the operation has more than two inputs, the same rule applies. All the lists must have the same number of items or one of them must contain only one item.
    Two runs Incompatible structures




Solving Incompatible Structures Errors

The structure depicted in the following example doesn't correspond to one of the two authorized structures described above.

Therefore, an error occurs because input values cannot be associated together by the operation to compute the results. The operation can associate 1 with 10 and 2 with 20. However, no association is possible for 3.

To solve this type of error, several methods are possible:

  • Check that the lists have the expected size by reviewing your latest operations. In the above example, the second list could include a third element for instance.
  • If you want to ignore items which have no association (in this example, 3), use the Fit Shortest operation to truncate the longest list.

  • If you want to repeat the last item of the shortest list to fit the longest list, use the Fit Longest operation. In this example, 20 is repeated.

  • If you want to repeat all the shortest lists to fit the longest list, use the Fit Cyclic operation.

  • If you want the operation to be executed on all the possible combinations between the two lists (that is, you want to add each item of the first list to every items of the second list), use the Combine operation. As a result, you obtain a list of lists, organized as a table (in orange).

Use Case: Operations Working On Lists

Some operations take lists or structures as input. The Get Item operation is the more easy-to-use, as it returns a given item of a list. Other operations are also available: Invert List, Group, Fit Shortest, or Fit Longest.

In the following example, the atomic element is a list. The operation runs once.

When the structure is composed of several levels of nested lists, the level identified as atomic must be specified. The input panel displays this level as a number called Dimension. By default, the number is usually 1. Positive numbers are displayed for levels starting from the bottom of the structure. Negative numbers are displayed for levels starting from the top. It is advised to use positive numbers, except in specific situations.

Dimensions



Examples with the Get Item Operation

  • When the Dimension value is 1 (default value): the operation runs four times and returns the second item of each list at level 1.

  • When the Dimension value is 2: the operation runs twice and returns the second item of each list at level 2.

  • When the Dimension value is 3 or -1: the operation runs once.

Combination of Structures

Basic Case

When several operation inputs contain structures, the rule described above apply recursively from the root of the structure.

Starting from the root level, the operation checks if nested lists can be associated n to n or 1 to n. The following example gives a detailed explanation:

Combination of Structures with Different Depths

When several operation inputs contain structures with different depths, the node adds nested lists to the smallest list to get equal depth.

First, the operation adds levels to the top of the structure. If the combination fails, the operation adds levels at the bottom of the structure.

Deepen starting from top level



Deepen starting from bottom level



In the above example, deepening by starting from the top level doesn't allow to combine structures. Therefore, the operation deepens starting from the bottom level.