5 #include <vcsn/dyn/fwd.hh>
16 template <Automaton Aut>
21 return d[aut->post()];
26 template <Automaton Aut>
27 std::unordered_map<state_t_of<Aut>, weight_t_of<Aut>>
31 for (
auto s : aut->states())
42 template <Automaton Aut>
49 auto ws = *
res->weightset();
50 distances[
res->post()] = ws.one();
53 auto ds = distances[
res->src_of(t)];
54 auto de = distances[
res->dst_of(t)];
55 auto w = ws.mul(
res->weight_of(t), de);
56 if (
res->src_of(t) ==
res->pre())
57 res->set_weight(t, de);
58 else if (!ws.is_zero(ds))
59 res->set_weight(t, ws.rdivide(w, ds));
69 template <Automaton Aut>
73 const auto& a = aut->
as<Aut>();
std::vector< weight_t_of< Aut > > ss_shortest_distance(const Aut &aut, state_t_of< Aut > s0)
Single source shortest distance.
auto push_weights(const Aut &aut) -> decltype(::vcsn::copy(aut))
The algorithm weight pushing.
typename detail::weight_t_of_impl< base_t< ValueSet >>::type weight_t_of
auto all_transitions(const Aut &aut)
All the transition indexes between all states (including pre and post).
automaton push_weights(const automaton &aut)
Bridge.
typename detail::state_t_of_impl< base_t< ValueSet >>::type state_t_of
auto copy(const AutIn &input, KeepState keep_state, KeepTrans keep_trans) -> decltype(keep_state(input->null_state()), keep_trans(input->null_transition()), make_fresh_automaton< AutIn, AutOut >(input))
A copy of input keeping only its states that are accepted by keep_state, and transitions accepted by ...
weight_t_of< Aut > shortest_distance_to_finals(Aut aut, state_t_of< Aut > s0)
Find shorhest of s0 to the final states of aut by using single source shortest distance.
auto & as()
Extract wrapped typed automaton.