misc: add spot::is_colored()
This function checks whether an automaton is colored, an automaton
is said to be colored iff all the transitions belong to exactly one
acceptance set.
* spot/twaalgos/iscolored.cc, spot/twaalgos/iscolored.hh: Here.
* spot/twaalgos/Makefile.am: add spot/twaalgos/iscolored.{cc,hh}
* python/spot/impl.i: add spot/twaalgos/iscolored.hh
This commit is contained in:
parent
5e5a69488e
commit
b7ef7c55d7
4 changed files with 69 additions and 0 deletions
|
|
@ -144,6 +144,7 @@
|
|||
#include <spot/twaalgos/sccfilter.hh>
|
||||
#include <spot/twaalgos/stats.hh>
|
||||
#include <spot/twaalgos/isdet.hh>
|
||||
#include <spot/twaalgos/iscolored.hh>
|
||||
#include <spot/twaalgos/isunamb.hh>
|
||||
#include <spot/twaalgos/isweakscc.hh>
|
||||
#include <spot/twaalgos/langmap.hh>
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ twaalgos_HEADERS = \
|
|||
emptiness_stats.hh \
|
||||
gv04.hh \
|
||||
hoa.hh \
|
||||
iscolored.hh \
|
||||
isdet.hh \
|
||||
isunamb.hh \
|
||||
isweakscc.hh \
|
||||
|
|
@ -110,6 +111,7 @@ libtwaalgos_la_SOURCES = \
|
|||
emptiness.cc \
|
||||
gv04.cc \
|
||||
hoa.cc \
|
||||
iscolored.cc \
|
||||
isdet.cc \
|
||||
isunamb.cc \
|
||||
isweakscc.cc \
|
||||
|
|
|
|||
32
spot/twaalgos/iscolored.cc
Normal file
32
spot/twaalgos/iscolored.cc
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2017 Laboratoire de Recherche et Développement de l'Epita
|
||||
// (LRDE).
|
||||
//
|
||||
// This file is part of Spot, a model checking library.
|
||||
//
|
||||
// Spot is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Spot is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
// License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <spot/twaalgos/iscolored.hh>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
bool
|
||||
is_colored(const const_twa_graph_ptr& aut)
|
||||
{
|
||||
for (auto t: aut->edges())
|
||||
if (t.acc.count() != 1)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
34
spot/twaalgos/iscolored.hh
Normal file
34
spot/twaalgos/iscolored.hh
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2017 Laboratoire de Recherche et Développement de l'Epita
|
||||
// (LRDE).
|
||||
//
|
||||
// This file is part of Spot, a model checking library.
|
||||
//
|
||||
// Spot is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Spot is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
// License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <spot/twa/twagraph.hh>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
/// \addtogroup twa_misc
|
||||
///
|
||||
/// \brief Return true iff \a aut is colored
|
||||
///
|
||||
/// An automaton is colored iff all the transitions belong to exactly one
|
||||
/// acceptance set. This function simply iterates over all the transitions.
|
||||
SPOT_API bool
|
||||
is_colored(const const_twa_graph_ptr& aut);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue