python: better support for explicit Kripke

Part of issue #376, reported by Hashim Ali.

* python/spot/impl.i: Add bindings for kripke_graph.
* python/spot/__init__.py (automaton): Add a want_kripke option.
* spot/kripke/kripkegraph.hh: Honnor the "state-names" property
when displaying states.
* spot/twaalgos/hoa.cc: Preserve names of Kripke states.
* tests/python/ltsmin-dve.ipynb: Illustrate all the above.
* NEWS: Mention those changes.
* THANKS: Add Hashim.
This commit is contained in:
Alexandre Duret-Lutz 2019-02-13 17:43:40 +01:00
parent a86925e20e
commit f26dd904ff
7 changed files with 393 additions and 33 deletions

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011-2018 Laboratoire de Recherche et Développement de
// Copyright (C) 2011-2019 Laboratoire de Recherche et Développement de
// l'Epita (LRDE)
//
// This file is part of Spot, a model checking library.
@ -239,9 +239,11 @@ namespace spot
std::string format_state(unsigned n) const
{
std::stringstream ss;
ss << n;
return ss.str();
auto named = get_named_prop<std::vector<std::string>>("state-names");
if (named && n < named->size())
return (*named)[n];
return std::to_string(n);
}
virtual std::string format_state(const state* st) const override