18 #ifndef FST_SCRIPT_SHORTEST_PATH_H_ 19 #define FST_SCRIPT_SHORTEST_PATH_H_ 49 weight_threshold(weight_threshold),
50 state_threshold(state_threshold) {}
57 template <
class Arc,
class Queue>
59 std::vector<typename Arc::Weight> *distance,
62 using Weight =
typename Arc::Weight;
64 const std::unique_ptr<Queue> queue(
68 false, opts.
delta,
false,
72 FSTERROR() <<
"ShortestPath: Weight needs to have the path property: " 73 << Arc::Weight::Type();
81 using StateId =
typename Arc::StateId;
82 using Weight =
typename Arc::Weight;
83 std::vector<Weight> distance;
86 ShortestPath<Arc, AutoQueue<StateId>>(ifst, ofst, &distance, opts);
90 ShortestPath<Arc, FifoQueue<StateId>>(ifst, ofst, &distance, opts);
94 ShortestPath<Arc, LifoQueue<StateId>>(ifst, ofst, &distance, opts);
99 ShortestPath<Arc, NaturalShortestFirstQueue<StateId, Weight>>(
100 ifst, ofst, &distance, opts);
102 FSTERROR() <<
"ShortestPath: Bad queue type SHORTEST_FIRST_QUEUE for" 103 <<
" non-idempotent Weight " << Weight::Type();
109 ShortestPath<Arc, StateOrderQueue<StateId>>(ifst, ofst, &distance, opts);
113 ShortestPath<Arc, TopOrderQueue<StateId>>(ifst, ofst, &distance, opts);
131 const Fst<Arc> &ifst = *std::get<0>(*args).GetFst<Arc>();
137 void ShortestPath(
const FstClass &ifst, MutableFstClass *ofst,
143 #endif // FST_SCRIPT_SHORTEST_PATH_H_
ShortestPathOptions(QueueType queue_type, int32_t nshortest, bool unique, float delta, const WeightClass &weight_threshold, int64_t state_threshold=kNoStateId)
const QueueType queue_type
constexpr uint64_t kError
void ShortestPath(const FstClass &ifst, const std::vector< std::pair< int64_t, int64_t >> &parens, MutableFstClass *ofst, const PdtShortestPathOptions &opts)
std::bool_constant<(W::Properties()&kIdempotent)!=0 > IsIdempotent
const WeightClass & weight_threshold
virtual void SetProperties(uint64_t props, uint64_t mask)=0
void ShortestPath(const Fst< Arc > &ifst, MutableFst< Arc > *ofst, std::vector< typename Arc::Weight > *distance, const ShortestPathOptions &opts)
const W * GetWeight() const
const int64_t state_threshold
std::tuple< const FstClass &, MutableFstClass *, const ShortestPathOptions & > FstShortestPathArgs
std::bool_constant<(W::Properties()&kPath)!=0 > IsPath