letflattent=(* [mapping] is list of couple (node_id, node_id) used to flatten the graph *)let(mapping,new_free)=List.fold_left(fun(acc_map,next_free)node_id->((node_id,Gid.Oldnext_free)::acc_map,next_free+1))([],t.free_index)t.activated_nodein{emptywithgraph=G_graph.renamemappingt.graph;free_index=new_free}

(* [filter_instance instance filters] return a boolean: - true iff the instance does NOT match any pattern in [filters] *)letfilter_instancefiltersinstance=letrecloop=function|[]->true(* no more filter to check *)|filter::filter_tail->letpos_graph=filter.pos.graphin

letneg_graph=without.graphinletnew_partial_matching=update_partialpos_graphwithout(sub,already_matched_gids)infulfill(pos_graph,neg_graph)instance.Instance.graphnew_partial_matching)filter.neg)matching_listthen(* one of the matching can be extended *)falseelseloopfilter_tailinloopfilters