Vcsn  2.3a
Be Rational
has-lightening-cycle.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vcsn/dyn/automaton.hh>
4 #include <vcsn/dyn/fwd.hh>
6 #include <vcsn/weightset/fwd.hh>
7 
8 namespace vcsn
9 {
10 
11  /*-----------------------.
12  | has_lightening_cycle. |
13  `-----------------------*/
14 
15  template <Automaton Aut>
16  std::enable_if_t<weightset_t_of<Aut>::has_lightening_weights(), bool>
17  has_lightening_cycle(const Aut& aut)
18  {
19  return !detail::bellman_ford_impl(aut, aut->pre());
20  }
21 
22  template <Automaton Aut>
23  std::enable_if_t<!weightset_t_of<Aut>::has_lightening_weights(), bool>
24  has_lightening_cycle(const Aut& aut)
25  {
26  return false;
27  }
28 
29  namespace dyn
30  {
31  namespace detail
32  {
34  template <Automaton Aut>
36  {
37  const auto& a = aut->as<Aut>();
39  }
40  }
41  }
42 }
bool has_lightening_cycle(const automaton &aut)
Bridge.
Definition: a-star.hh:8
std::enable_if_t< weightset_t_of< Aut >::has_lightening_weights(), bool > has_lightening_cycle(const Aut &aut)
A dyn automaton.
Definition: automaton.hh:17
boost::optional< std::vector< transition_t_of< Aut > > > bellman_ford_impl(const Aut &aut, state_t_of< Aut > source)
Bellman-Ford implementation of lightest automaton.
Definition: bellman-ford.hh:29
auto & as()
Extract wrapped typed automaton.
Definition: automaton.hh:37