We don’t provide an API for that.
You may however try to construct a Graph structure given a diagram:
- Events, gateways and tasks are vertices of the Graph
- Sequence flows are the edges between two vertices.
Once you have the Graph constructed, you may traverse it from given starting vertex to an end vertex. You may even find the shortest path between two nodes using Dijsktra or AStar algorithms.
You may use the ElementRegistry module to get individual elements of your diagram. Refer to this question to see how you can use the ElementRegistry module.
Good luck!