src/Pure/General/graph.ML
changeset 12451 0224f472be71
parent 9347 1791a62b33e7
child 14161 73ad4884441f
equal deleted inserted replaced
12450:1162b280700a 12451:0224f472be71
   122 
   122 
   123 fun find_paths G (x, y) =
   123 fun find_paths G (x, y) =
   124   let
   124   let
   125     val (_, X) = reachable (imm_succs G) [x];
   125     val (_, X) = reachable (imm_succs G) [x];
   126     fun paths ps p =
   126     fun paths ps p =
   127       if eq_key (p, x) then [p :: ps]
   127       if not (null ps) andalso eq_key (p, x) then [p :: ps]
   128       else flat (map (paths (p :: ps))
   128       else if p mem_keys X andalso not (p mem_key ps)
   129         (filter (fn pp => pp mem_keys X andalso not (pp mem_key ps)) (imm_preds G p)));
   129       then flat (map (paths (p :: ps)) (imm_preds G p))
   130   in get_entry G y; if y mem_keys X then (paths [] y) else [] end;
   130       else [];
       
   131   in paths [] y end;
   131 
   132 
   132 
   133 
   133 (* nodes *)
   134 (* nodes *)
   134 
   135 
   135 exception DUPLICATE of key;
   136 exception DUPLICATE of key;