FYI - in a naive attempt to enhance your solution, managed to create MergePatternPath. I think it works in expected way (atleast for the traversing problem in last email).
I modified your code a bit. Also instead of EdgePattern I used List of Functions that match the whole edge triplets along the path... and it returns a *new Graph* which preserves the vertices attributes, but only with new merged edges.
Here's a Gist of how I was using it:
This prolly is very naive attempt :-). Is there any possibility of adding it to the graphx.lib albeit one which is sophisticated & performant?
I was trying out the PatterMatcher it works for smaller path, but I see that for the longer ones it continues to run forever...
The first edge pattern list (Line 66) works okay, but the second one (Line 76) never return..
Interesting problem! My understanding is that you want to (1) find paths matching a particular pattern, and (2) add edges between the start and end vertices of the matched paths.
For (2), you can take the output of the pattern matcher (the set of matching paths organized by their terminal vertices) and construct a set of new edges using the initial and terminal vertices of each path. Then you can make a new graph consisting of the union of the original edge set and the new edges. Let me know if you'd like help with this.