Pin-to-pin object-flow path identification in Activity diagrams

Hello,
I would be interested in identifying object-flow paths from output pins to input pins of an Activity Diagram.

Paths can be:
1) Direct, i.e., output pin connected to an input pin via an object flow with a single connection. As an example, in the figure below, pin 1 of Action 1 and pin 2 of Action 2 are connected directly via a single object flow.
2) Composite i.e., consist of multiple object flows and control nodes between the input pin and the output pins. As an example in the figure below, the path between pin 3 of Action 2 and pin 4 of Action 3 is separated by a control node (fork node). As another example in the figure below, the path between pin 6 of Action 3 and pin 8 of Action 5 is separated by 3 control nodes (a join node, a decision node, and a merge node)

Question: Is there a simple way to navigate, recursively, the chain of object flows (and control nodes) to identify all the target input pins connected through at least one path to a source output pin?


I tried using Structured Expression, but I had a hard time to encode recursion. I suspect built-in features or function/script invocations may exist based on how validation between interfaces works (which highlight such required paths whenever two interfaces are incompatible).

Thanks!