Hey,
If you’re refering to the directed graph as an abstract data strcture, we don’t provide an implementation of that data structure, however it is possible to create it from a bpmn diagram.
Please see this answer: Get Elements In the Order of Flow In Canvas
Once you have a Graph representing your process, you may use a path finding algorithm to check if there’s a path between two nodes (in your case start node: Task, end node: End process).