dot: use circles if state names are all short
* spot/twaalgos/dot.cc: Check for state names sizes. * tests/core/readsave.test: Test the change. * tests/core/tgbagraph.test: Adjust.
This commit is contained in:
parent
b11c07b351
commit
eb0a0b6b34
3 changed files with 34 additions and 2 deletions
|
|
@ -33,6 +33,7 @@
|
|||
#include <spot/twaalgos/sccinfo.hh>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <algorithm>
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
|
|
@ -541,9 +542,18 @@ namespace spot
|
|||
if (opt_shape_ == ShapeAuto)
|
||||
{
|
||||
if (sn_ || sprod_ || aut->num_states() > 100)
|
||||
opt_shape_ = ShapeEllipse;
|
||||
{
|
||||
opt_shape_ = ShapeEllipse;
|
||||
// If all state names are short, prefer circles.
|
||||
if (sn_ && std::all_of(sn_->begin(), sn_->end(),
|
||||
[](const std::string& s)
|
||||
{ return s.size() <= 2; }))
|
||||
opt_shape_ = ShapeCircle;
|
||||
}
|
||||
else
|
||||
opt_shape_ = ShapeCircle;
|
||||
{
|
||||
opt_shape_ = ShapeCircle;
|
||||
}
|
||||
}
|
||||
auto si =
|
||||
std::unique_ptr<scc_info>(opt_scc_ ? new scc_info(aut) : nullptr);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue