I'm using Boost Graph and want to find a way to identify sequences (subgraphs) within a graph which follow a specific pattern.
I think of my subgraph as a pattern or template. The actual graph contains nodes with parts of strings and parsed data; for example, a parsed date string in a graph may be: ...->(9)->("/")->(4)->"/"->(2017)->...
. My template subgraph would find all instances of such a date in the graph, so it would match nodes like this: (1<=d<=31)->(.|/)->(1<=m<=12)->(same symbol as in 2nd node)->(1900<=y<=2100)
.
The function vf2_subgraph_iso
takes predicates as arguments to determine equality of edges and vertices, but I am unsure if there is a way to "hack" those predicates to actually find nodes according to a simple pattern which is beyond mere equality.
As the equality predicates aren't given any kind of state or context, I'm having a hard time figuring out how to maintain such state internally. Is this possible? Or is there a better suited algorithm out there?