graph: store the source indices in the transition vector

... and use it to sort transitions.

* src/graph/graph.hh: Adjust storage of source index.  Provide
remove_dead_transitions_(), sort_transitions_() and
chain_transitions_() methods.
* src/tgba/tgbagraph.cc (merge_transitions): Rewrite using
above methods.
* src/tgba/tgbagraph.hh: Add a comparison operator for
transitions.
* src/tgbatest/degenlskip.test, src/tgbatest/det.test,
src/tgbatest/ltl2ta.test, src/tgbatest/neverclaimread.test,
src/tgbatest/readsave.test: Adjust expected transition order in test
cases.
This commit is contained in:
Alexandre Duret-Lutz 2014-12-02 20:16:06 +01:00
parent 80ce0e2129
commit 0db0eca14e
8 changed files with 201 additions and 80 deletions

View file

@ -38,15 +38,15 @@ digraph G {
0 -> 1
1 [label="0", peripheries=2]
1 -> 1 [label="a & b\n{0}"]
1 -> 2 [label="!a & b\n{0}"]
1 -> 3 [label="!b\n{0}"]
1 -> 2 [label="!b\n{0}"]
1 -> 3 [label="!a & b\n{0}"]
2 [label="1"]
2 -> 1 [label="a"]
2 -> 2 [label="!a"]
2 -> 1 [label="a & b"]
2 -> 2 [label="!b"]
2 -> 3 [label="!a & b"]
3 [label="2"]
3 -> 1 [label="a & b"]
3 -> 2 [label="!a & b"]
3 -> 3 [label="!b"]
3 -> 1 [label="a"]
3 -> 3 [label="!a"]
}
EOF
@ -58,13 +58,14 @@ digraph G {
1 [label="0", peripheries=2]
1 -> 2 [label="1\n{0}"]
2 [label="1"]
2 -> 3 [label="b"]
2 -> 2 [label="!b"]
2 -> 3 [label="b"]
3 [label="2"]
3 -> 1 [label="a"]
3 -> 3 [label="!a"]
}
EOF
# FIXME: use are-isomorphic once it is available
diff out2 expected2
diff out3 expected3

View file

@ -72,23 +72,24 @@ EOF
# FIXME: we should improve this output
cat >ex.tgba <<'EOF'
acc = "0";
"0", "1", "a",;
"0", "0", "!a",;
"0", "1", "a",;
"0", "3", "!a",;
"1", "2", "a",;
"1", "0", "!a",;
"1", "2", "a",;
"1", "3", "!a",;
"3", "3", "!a", "0";
"2", "2", "a",;
"2", "0", "!a",;
"2", "5", "a",;
"2", "2", "a",;
"2", "3", "!a",;
"5", "5", "a", "0";
"2", "5", "a",;
"5", "3", "!a", "0";
"5", "5", "a", "0";
EOF
run 0 ../ltl2tgba -b -DC -X in.tgba > out.tgba
# FIXME: use are-isomorphic once it is available
diff out.tgba ex.tgba

View file

@ -403,7 +403,7 @@ in: FG((WaitRight4 M (HasRight1 W GWaitLeft0)) M HasLeft4)
-TA -DS -RT | 42 | 600 | 19
-TA -DS -lv | 55 | 800 | 19
-TA -DS -lv -RT | 44 | 694 | 13
-TA -DS -sp | 54 | 797 | 18
-TA -DS -sp | 54 | 795 | 18
-TA -DS -sp -RT | 43 | 683 | 12
-TA -DS -lv -sp | 55 | 800 | 19
-TA -DS -lv -sp -RT | 44 | 694 | 13

View file

@ -51,9 +51,9 @@ digraph G {
1 -> 1 [label="1"]
1 -> 2 [label="p0 & p1"]
2 [label="1"]
2 -> 3 [label="p1 & !p0"]
2 -> 2 [label="!p1"]
2 -> 1 [label="!p1"]
2 -> 2 [label="!p1"]
2 -> 3 [label="p1 & !p0"]
3 [label="2", peripheries=2]
3 -> 3 [label="1\n{0}"]
}
@ -63,6 +63,7 @@ EOF
# (The order is not guaranteed by SPOT.)
sed -e 's/!p0 & p1/p1 \& !p0/g' -e 's/p1 & p0/p0 \& p1/g' stdout \
> tmp_ && mv tmp_ stdout
# FIXME: use are-isomorphic once it is available
diff stdout expected
rm input stdout expected
@ -95,9 +96,9 @@ digraph G {
1 -> 1 [label="1"]
1 -> 2 [label="p0 & p1"]
2 [label="1"]
2 -> 3 [label="p1 & !p0"]
2 -> 2 [label="!p1"]
2 -> 1 [label="!p1"]
2 -> 2 [label="!p1"]
2 -> 3 [label="p1 & !p0"]
3 [label="2", peripheries=2]
3 -> 3 [label="1\n{0}"]
}
@ -107,6 +108,7 @@ EOF
# (The order is not guaranteed by SPOT.)
sed -e 's/!p0 & p1/p1 \& !p0/g' -e 's/p1 & p0/p0 \& p1/g' stdout \
> tmp_ && mv tmp_ stdout
# FIXME: use are-isomorphic once it is available
diff stdout expected
rm input stdout expected

View file

@ -72,13 +72,14 @@ EOF
cat >expected <<\EOF
acc = "0";
"0", "1", "a", "0";
"0", "1", "!b",;
"0", "1", "a", "0";
"1", "0", "!b",;
"1", "0", "a", "0";
EOF
run 0 ../ltl2tgba -b -X input > stdout
# FIXME: use are-isomorphic once it is available
diff stdout expected
# Likewise, with a randomly generated TGBA.