tgbagraph: add a merge_transitions() method.

* src/graph/graph.hh: Add some framework to erase transitions, and
defrag the resulting transitions_ vector on demand.  Also remove
the nb_states() and nb_transitions() because num_states() and
num_transitions() already exist.
* src/graphtest/graph.cc, src/graphtest/ngraph.cc: Adjust to
use num_states().
* src/tgba/tgbagraph.hh (merge_transitions): New method.
* src/misc/hash.hh: Add a pair_hash class, needed by
merge_transitions().
* src/graphtest/tgbagraph.cc, src/graphtest/tgbagraph.test: Add states
for transitions removal and merge_transitions().
This commit is contained in:
Alexandre Duret-Lutz 2014-05-21 19:16:50 +02:00
parent 9909699c63
commit 424de90385
7 changed files with 286 additions and 10 deletions

View file

@ -37,6 +37,7 @@ digraph G {
0 [label="", style=invis, height=0]
0 -> 1
1 [label="0"]
1 -> 1 [label="0\n"]
1 -> 2 [label="p1\n"]
1 -> 3 [label="p2\n{Acc[p2]}"]
2 [label="1"]
@ -46,6 +47,55 @@ digraph G {
3 -> 2 [label="!p1 | p2\n"]
3 -> 3 [label="1\n{Acc[p2], Acc[p1]}"]
}
digraph G {
0 [label="", style=invis, height=0]
0 -> 1
1 [label="0"]
1 -> 1 [label="0\n"]
1 -> 2 [label="p1\n"]
1 -> 3 [label="p2\n{Acc[p2]}"]
2 [label="1"]
2 -> 3 [label="p1 & p2\n{Acc[p1]}"]
3 [label="2"]
3 -> 1 [label="p1 | p2\n{Acc[p2], Acc[p1]}"]
}
digraph G {
0 [label="", style=invis, height=0]
0 -> 1
1 [label="0"]
1 -> 1 [label="0\n"]
1 -> 2 [label="p1\n"]
1 -> 3 [label="p2\n{Acc[p2]}"]
2 [label="1"]
2 -> 3 [label="p1 & p2\n{Acc[p1]}"]
3 [label="2"]
}
digraph G {
0 [label="", style=invis, height=0]
0 -> 1
1 [label="0"]
1 -> 1 [label="0\n"]
1 -> 2 [label="p1\n"]
1 -> 3 [label="p2\n{Acc[p2]}"]
2 [label="1"]
2 -> 3 [label="p1 & p2\n{Acc[p1]}"]
3 [label="2"]
3 -> 1 [label="p1 | p2\n{Acc[p2], Acc[p1]}"]
3 -> 2 [label="!p1 | p2\n"]
3 -> 1 [label="1\n{Acc[p2], Acc[p1]}"]
}
digraph G {
0 [label="", style=invis, height=0]
0 -> 1
1 [label="0"]
1 -> 2 [label="p1\n"]
1 -> 3 [label="p2\n{Acc[p2]}"]
2 [label="1"]
2 -> 3 [label="p1 & p2\n{Acc[p1]}"]
3 [label="2"]
3 -> 1 [label="1\n{Acc[p2], Acc[p1]}"]
3 -> 2 [label="!p1 | p2\n"]
}
EOF
diff stdout expected