Turn VF2 matcher into a generator that yields all matches
This commit is contained in:
parent
1320ea29e9
commit
d2c996f4f7
2 changed files with 40 additions and 459 deletions
|
|
@ -31,10 +31,10 @@ if __name__ == '__main__':
|
|||
"""
|
||||
The main function called when running from the command line.
|
||||
"""
|
||||
nr_of_vertices = 10
|
||||
nr_of_diff_types_v = 0
|
||||
nr_of_edges = 20
|
||||
nr_of_diff_types_e = 0
|
||||
nr_of_vertices = 50
|
||||
nr_of_diff_types_v = 2
|
||||
nr_of_edges = 150
|
||||
nr_of_diff_types_e = 2
|
||||
|
||||
dv = [random.randint(0, nr_of_diff_types_v) for _ in range(nr_of_vertices)]
|
||||
de = [random.randint(0, nr_of_diff_types_e) for _ in range(nr_of_edges)]
|
||||
|
|
@ -47,10 +47,10 @@ if __name__ == '__main__':
|
|||
# dc_inc = [ 0,25,18,47,22,25,16,45,38,25,5,45,15,44,17,46,6,17,35,8,16,29,48,47,25,34,4,20,24,1,47,44,8,25,32,3,16,6,33,21,6,13,41,10,17,25,21,33,31,30,5,4,45,26,16,42,12,25,29,3,32,30,14,26,11,13,7,13,3,43,43,22,48,37,20,28,15,40,19,33,43,16,49,36,11,25,9,42,3,22,16,40,42,44,27,30,1,18,10,35,19,6,9,43,37,38,45,19,41,14,37,45,0,31,29,31,24,20,44,46,8,45,43,3,38,38,35,12,19,45,7,34,20,28,12,17,45,17,35,49,20,21,49,1,35,38,38,36,33,30 ]
|
||||
# dc_out = [ 9,2,49,49,37,33,16,21,5,46,4,15,9,6,14,22,16,33,23,21,15,31,37,23,47,3,30,26,35,9,29,21,39,32,22,43,5,9,41,30,31,30,37,33,31,34,23,22,34,26,44,36,38,33,48,5,9,34,13,7,48,41,43,26,26,7,12,6,12,28,22,8,29,22,24,27,16,4,31,41,32,15,19,20,38,0,26,18,43,46,40,17,29,14,34,14,32,17,32,47,16,45,7,4,35,22,42,11,38,2,0,29,4,38,17,44,9,23,5,10,31,17,1,11,16,5,37,27,35,32,45,16,18,1,14,4,42,24,43,31,21,38,6,34,39,46,20,1,38,47 ]
|
||||
|
||||
dv = [0, 1, 0, 1, 0]
|
||||
de = [0, 0, 0]
|
||||
dc_inc = [0, 2, 4]
|
||||
dc_out = [1, 3, 3]
|
||||
# dv = [0, 1, 0, 1, 0]
|
||||
# de = [0, 0, 0]
|
||||
# dc_inc = [0, 2, 4]
|
||||
# dc_out = [1, 3, 3]
|
||||
|
||||
gg = GraphGenerator(dv, de, dc_inc, dc_out, debug)
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ if __name__ == '__main__':
|
|||
#PM = PatternMatching('SP')
|
||||
# PM = PatternMatching('Ullmann')
|
||||
PM = PatternMatching('VF2')
|
||||
matches = PM.match(pattern, graph)
|
||||
matches = [m for m in PM.matchVF2(pattern, graph)]
|
||||
print("found", len(matches), "matches:", matches)
|
||||
|
||||
# regenerate graph, to show matched pattern
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue