dot: add an option to output id= attributes

This will be handy latter to develop widgets with interactive
highlighting of automata.

* spot/twaalgos/dot.cc: Implement it.
* bin/common_aoutput.cc, NEWS, doc/org/oaut.org,
doc/org/spot.css: Document it.
* tests/core/alternating.test, tests/core/readsave.test,
tests/core/sccdot.test: Test it.
This commit is contained in:
Alexandre Duret-Lutz 2021-09-02 22:43:22 +02:00
parent d5bbeceeb2
commit 4855d3c877
8 changed files with 230 additions and 112 deletions

View file

@ -1,7 +1,7 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2015, 2017, 2018, 2020 Laboratoire de Recherche et
# Développement de l'Epita
# Copyright (C) 2015, 2017, 2018, 2020, 2021 Laboratoire de Recherche
# et Développement de l'Epita
#
# This file is part of Spot, a model checking library.
#
@ -68,7 +68,7 @@ State: 10
--END--
EOF
run 0 autfilt --dot=as in.hoa > out.dot
run 0 autfilt --dot=asi in.hoa > out.dot
# The important stuff is the color=xxx lines
cat <<EOF >expected
@ -77,79 +77,88 @@ digraph "" {
label="(Inf(0)&Inf(1)) & Fin(2)\n[Streett-like 3]"
labelloc="t"
node [shape="ellipse",width="0.5",height="0.5"]
node [id="S\N"]
I [label="", style=invis, width=0]
I -> 1
subgraph cluster_0 {
color=grey
id="SCC0"
label=""
5 [label="5"]
6 [label="6"]
}
subgraph cluster_1 {
color=grey
id="SCC1"
label=""
0 [label="0"]
}
subgraph cluster_2 {
color=green
id="SCC2"
label=""
9 [label="9"]
10 [label="10"]
}
subgraph cluster_3 {
color=green
id="SCC3"
label=""
8 [label="8"]
}
subgraph cluster_4 {
color=green
id="SCC4"
label=""
7 [label="7"]
}
subgraph cluster_5 {
color=black
id="SCC5"
label=""
2 [label="2"]
}
subgraph cluster_6 {
color=red
id="SCC6"
label=""
4 [label="4"]
}
subgraph cluster_7 {
color=green
id="SCC7"
label=""
1 [label="1"]
3 [label="3"]
}
0 -> 0 [label="a & b\n{0,1,2}"]
0 -> 0 [label="!a & !b\n{2}"]
0 -> 5 [label="a\n{2}"]
1 -> 4 [label="b"]
1 -> 3 [label="a & !b"]
2 -> 0 [label="a"]
2 -> 7 [label="b"]
3 -> 1 [label="a & b\n{0,1}"]
4 -> 4 [label="!b\n{1,2}"]
4 -> 2 [label="b"]
5 -> 6 [label="1"]
6 -> 5 [label="1"]
7 -> 7 [label="!a & b\n{0,1}"]
7 -> 7 [label="a & b\n{0,2}"]
7 -> 8 [label="1"]
8 -> 8 [label="!a & b\n{0,2}"]
8 -> 8 [label="a & b\n{0,1}"]
8 -> 9 [label="1"]
9 -> 9 [label="!a & b\n{0,2}"]
9 -> 10 [label="a & b\n{0,1}"]
10 -> 9 [label="!a & b\n{0,1}"]
10 -> 10 [label="a & b\n{0,2}"]
0 -> 0 [label="a & b\n{0,1,2}", id="E1", tooltip="\\\\E\n#1"]
0 -> 0 [label="!a & !b\n{2}", id="E2", tooltip="\\\\E\n#2"]
0 -> 5 [label="a\n{2}", id="E3", tooltip="\\\\E\n#3"]
1 -> 4 [label="b", id="E4", tooltip="\\\\E\n#4"]
1 -> 3 [label="a & !b", id="E5", tooltip="\\\\E\n#5"]
2 -> 0 [label="a", id="E8", tooltip="\\\\E\n#8"]
2 -> 7 [label="b", id="E9", tooltip="\\\\E\n#9"]
3 -> 1 [label="a & b\n{0,1}", id="E10", tooltip="\\\\E\n#10"]
4 -> 4 [label="!b\n{1,2}", id="E6", tooltip="\\\\E\n#6"]
4 -> 2 [label="b", id="E7", tooltip="\\\\E\n#7"]
5 -> 6 [label="1", id="E11", tooltip="\\\\E\n#11"]
6 -> 5 [label="1", id="E12", tooltip="\\\\E\n#12"]
7 -> 7 [label="!a & b\n{0,1}", id="E13", tooltip="\\\\E\n#13"]
7 -> 7 [label="a & b\n{0,2}", id="E14", tooltip="\\\\E\n#14"]
7 -> 8 [label="1", id="E15", tooltip="\\\\E\n#15"]
8 -> 8 [label="!a & b\n{0,2}", id="E16", tooltip="\\\\E\n#16"]
8 -> 8 [label="a & b\n{0,1}", id="E17", tooltip="\\\\E\n#17"]
8 -> 9 [label="1", id="E18", tooltip="\\\\E\n#18"]
9 -> 9 [label="!a & b\n{0,2}", id="E19", tooltip="\\\\E\n#19"]
9 -> 10 [label="a & b\n{0,1}", id="E20", tooltip="\\\\E\n#20"]
10 -> 9 [label="!a & b\n{0,1}", id="E21", tooltip="\\\\E\n#21"]
10 -> 10 [label="a & b\n{0,2}", id="E22", tooltip="\\\\E\n#22"]
}
EOF
diff out.dot expected
# While we are here, make sure scc_filter remove those grey SCCs.
# While we are here, make sure scc_filter removes those grey SCCs.
autfilt --small -x simul=0 in.hoa -H > out.hoa
cat >expected.hoa <<EOF
HOA: v1