equal
deleted
inserted
replaced
25 val all_preds: 'a T -> key list -> key list |
25 val all_preds: 'a T -> key list -> key list |
26 val all_succs: 'a T -> key list -> key list |
26 val all_succs: 'a T -> key list -> key list |
27 val strong_conn: 'a T -> key list list |
27 val strong_conn: 'a T -> key list list |
28 val find_paths: 'a T -> key * key -> key list list |
28 val find_paths: 'a T -> key * key -> key list list |
29 val new_node: key * 'a -> 'a T -> 'a T (*exception DUP*) |
29 val new_node: key * 'a -> 'a T -> 'a T (*exception DUP*) |
|
30 val default_node: key -> 'a -> 'a T -> 'a T |
30 val del_nodes: key list -> 'a T -> 'a T (*exception UNDEF*) |
31 val del_nodes: key list -> 'a T -> 'a T (*exception UNDEF*) |
31 val is_edge: 'a T -> key * key -> bool |
32 val is_edge: 'a T -> key * key -> bool |
32 val add_edge: key * key -> 'a T -> 'a T |
33 val add_edge: key * key -> 'a T -> 'a T |
33 val del_edge: key * key -> 'a T -> 'a T |
34 val del_edge: key * key -> 'a T -> 'a T |
34 val merge: ('a * 'a -> bool) -> 'a T * 'a T -> 'a T (*exception DUPS*) |
35 val merge: ('a * 'a -> bool) -> 'a T * 'a T -> 'a T (*exception DUPS*) |
141 (* nodes *) |
142 (* nodes *) |
142 |
143 |
143 fun new_node (x, info) (Graph tab) = |
144 fun new_node (x, info) (Graph tab) = |
144 Graph (Table.update_new ((x, (info, ([], []))), tab)); |
145 Graph (Table.update_new ((x, (info, ([], []))), tab)); |
145 |
146 |
|
147 fun default_node x info (Graph tab) = |
|
148 Graph (Table.default x (info, ([], [])) tab); |
|
149 |
146 fun del_nodes xs (Graph tab) = |
150 fun del_nodes xs (Graph tab) = |
147 Graph (tab |
151 Graph (tab |
148 |> fold Table.delete xs |
152 |> fold Table.delete xs |
149 |> Table.map (fn (i, (preds, succs)) => |
153 |> Table.map (fn (i, (preds, succs)) => |
150 (i, (fold remove_key xs preds, fold remove_key xs succs)))); |
154 (i, (fold remove_key xs preds, fold remove_key xs succs)))); |