@@ -147,6 +147,20 @@ let compile_traces states (start, final) =
147
147
| None -> actions
148
148
| Some action -> action :: actions
149
149
in
150
+ let exception Irrelevant in
151
+ let is_relevant node =
152
+ let relevant_nodes = Hashtbl. create 31 in
153
+ let rec aux node =
154
+ try ignore (Hashtbl. find relevant_nodes node.id)
155
+ with Not_found ->
156
+ Hashtbl. add relevant_nodes node.id () ;
157
+ List. iter aux node.eps;
158
+ List. iter (fun (_ , n ) -> aux n) node.trans
159
+ in
160
+ aux start;
161
+ try ignore (Hashtbl. find relevant_nodes node)
162
+ with Not_found -> raise Irrelevant
163
+ in
150
164
let first_node = final.id in
151
165
let trans_cases =
152
166
let cases = Hashtbl. create 31 in
@@ -158,8 +172,10 @@ let compile_traces states (start, final) =
158
172
(fun from_node ->
159
173
try
160
174
let node_j = from_node.id in
175
+ is_relevant node_j;
161
176
let rec dfs cset actions to_node =
162
177
let node_i = to_node.id in
178
+ is_relevant node_i;
163
179
if not (Hashtbl. mem cases (i, node_i, j, cset)) then begin
164
180
let actions = append_action actions to_node.action in
165
181
if to_node.trans <> [] || to_node == final then
@@ -179,7 +195,7 @@ let compile_traces states (start, final) =
179
195
(fun (cset , to_node ) ->
180
196
if List. mem to_node to_state then dfs cset [] to_node)
181
197
from_node.trans
182
- with Not_found -> () )
198
+ with Irrelevant -> () )
183
199
from_state)
184
200
states)
185
201
states;
0 commit comments