Commit a4ce9994 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz

sccinfo: adjust to work with alternating automata

* spot/twaalgos/sccinfo.cc: Consider universal edges as if they were
existential edges.
* spot/twaalgos/sccinfo.hh: Document that.
* spot/twaalgos/dot.cc: Allow option 's' again, for easy testing.
* tests/core/alternating.test: Adjust tests.
* tests/python/_altscc.ipynb: New file (more tests).
* tests/Makefile.am: Add it.
parent d2f471da
......@@ -699,13 +699,13 @@ namespace spot
}
}
auto si =
std::unique_ptr<scc_info>((opt_scc_ && !aut->is_alternating())
? new scc_info(aut) : nullptr);
std::unique_ptr<scc_info>(opt_scc_ ? new scc_info(aut) : nullptr);
start();
if (si)
{
si->determine_unknown_acceptance();
if (!aut->is_alternating())
si->determine_unknown_acceptance();
unsigned sccs = si->scc_count();
for (unsigned i = 0; i < sccs; ++i)
......
This diff is collapsed.
......@@ -24,6 +24,18 @@
namespace spot
{
/// \brief Compute an SCC map and gather assorted information.
///
/// This takes twa_graph as input and compute its SCCs. This
/// class maps all input states to their SCCs, and vice-versa.
/// It allows iterating over all SCCs of the automaton, and check
/// their acceptance or non-acceptance.
///
/// Additionally this class can be used on alternating automata, but
/// in this case, universal transitions are handled like existential
/// transitions. It still make sense to check which states belong
/// to the same SCC, but the acceptance information computed by
/// this class is meaningless.
class SPOT_API scc_info
{
public:
......
......@@ -323,6 +323,7 @@ TESTS_ipython = \
# with a _.
TESTS_python = \
python/_aux.ipynb \
python/_altscc.ipynb \
python/accparse2.py \
python/alarm.py \
python/alternating.py \
......
......@@ -53,7 +53,6 @@ State: 6 "t"
--END--
EOF
# The 's' option should be ignored for alternating automata
autfilt --dot=bans alt.hoa >alt.dot
cat >expect.dot <<EOF
......@@ -66,7 +65,41 @@ digraph G {
-11 [label=<>,width=0,height=0,shape=none]
-11 -> 0
-11 -> 2
subgraph cluster_0 {
color=green
label=""
6 [label="t"]
}
subgraph cluster_1 {
color=red
label=""
4 [label="F(b)\n⓿"]
}
subgraph cluster_2 {
color=green
label=""
3 [label="GF(b)"]
}
subgraph cluster_3 {
color=green
label=""
2 [label="G(a)"]
}
subgraph cluster_4 {
color=red
label=""
1 [label="FG(a)\n⓿"]
}
subgraph cluster_5 {
color=red
label=""
5 [label="((a) U (b))\n⓿"]
}
subgraph cluster_6 {
color=black
label=""
0 [label="((((a) U (b)) && GF(b)) && FG(a))"]
}
0 -> -1 [label="b", dir=none]
-1 [label=<>,width=0,height=0,shape=none]
-1 -> 3
......@@ -76,24 +109,18 @@ digraph G {
-4 -> 5 [style=bold, color="#F15854"]
-4 -> 3 [style=bold, color="#F15854"]
-4 -> 1 [style=bold, color="#F15854"]
1 [label="FG(a)\n⓿"]
1 -> 2 [label="a"]
1 -> 1 [label="1"]
2 [label="G(a)"]
2 -> 2 [label="a"]
3 [label="GF(b)"]
3 -> 3 [label="b"]
3 -> -8 [label="!b", style=bold, color="#FAA43A", dir=none]
-8 [label=<>,width=0,height=0,shape=none]
-8 -> 4 [style=bold, color="#FAA43A"]
-8 -> 3 [style=bold, color="#FAA43A"]
4 [label="F(b)\n⓿"]
4 -> 6 [label="b"]
4 -> 4 [label="!b"]
5 [label="((a) U (b))\n⓿"]
5 -> 6 [label="b"]
5 -> 5 [label="a & !b"]
6 [label="t"]
6 -> 6 [label="1"]
}
EOF
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment