sccinfo: implement PROCESS_UNREACHABLE_STATES

This is actually used by next patch.

* spot/twaalgos/sccinfo.cc, spot/twaalgos/sccinfo.hh: Here.
* tests/python/sccinfo.py: Add a small test case.
* NEWS: Mention it.
This commit is contained in:
Alexandre Duret-Lutz 2023-10-02 11:54:34 +02:00
parent 70812046d2
commit c016f561fa
4 changed files with 65 additions and 10 deletions

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2014-2022 Laboratoire de Recherche et Développement
// Copyright (C) 2014-2023 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -206,13 +206,21 @@ namespace spot
}
};
// Setup depth-first search from the initial state. But we may
// have a conjunction of initial state in alternating automata.
if (initial_state_ == -1U)
initial_state_ = aut->get_init_state_number();
for (unsigned init: aut->univ_dests(initial_state_))
push_init(init);
if (!!(options & scc_info_options::PROCESS_UNREACHABLE_STATES))
{
unsigned e = aut->num_states();
for (unsigned i = 0; i < e; ++i)
push_init(i);
}
else
{
// Setup depth-first search from the initial state. But we may
// have a conjunction of initial state in alternating automata.
if (initial_state_ == -1U)
initial_state_ = aut->get_init_state_number();
for (unsigned init: aut->univ_dests(initial_state_))
push_init(init);
}
while (!init_states.empty())
{
unsigned init = init_states.front();

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2014-2021 Laboratoire de Recherche et Développement
// Copyright (C) 2014-2021, 2023 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -393,6 +393,13 @@ namespace spot
/// Conditionally track states if the acceptance conditions uses Fin.
/// This is sufficiant for determine_unknown_acceptance().
TRACK_STATES_IF_FIN_USED = 8,
/// Also compute SCCs for the unreachable states. When this is
/// used, SCCs are first enumerated from state 0, and then from
/// the next unvisited states. In other words the initial state
/// does not play any role. If STOP_ON_ACC is used with
/// PROCESS_UNREACHABLE_STATES, the enumeration will stop as soon
/// as an SCC is found, but that SCC might not be reachable.
PROCESS_UNREACHABLE_STATES = 16,
/// Default behavior: explore everything and track states and succs.
ALL = TRACK_STATES | TRACK_SUCCS,
};