Commit b7ef7c55 authored by Laurent XU's avatar Laurent XU

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
parent 5e5a6948
......@@ -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 \
......
// -*- 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;
}
}
// -*- 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);
}
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