Hi!
I'm sorry if I was an inattentive reader, but the problem definition
does not seem to be clear for me. Please clarify, whether the graph is
always a tree or not. Your code for Edges seems to indicate otherwise,
so the further questions assume this:
- do you want to get all of the paths between two vertices or only one?
- if I understood your example properly, the ending must be a either D
or a "dead end". But what is a dead end exactly in the case of graphs
with a cycle? In other words, can a path contain the same vertex twice?
Regardless, my feeling is, that You are better of doing this
preprocessing step of your pipeline in python, generate the dat file
that way. (And as always, a different formulation not needing these sets
may also be possible/more preferable.)
All the best!
Mate