Lines Matching defs:arc
39 template <class Arc, class Queue, class ArcFilter>
41 : public ShortestDistanceOptions<Arc, Queue, ArcFilter> {
42 typedef typename Arc::StateId StateId;
43 typedef typename Arc::Weight Weight;
60 : ShortestDistanceOptions<Arc, Queue, ArcFilter>(q, filt, kNoStateId, d),
70 // such as the queue discipline, the arc filter and delta.
77 template<class Arc, class Queue, class ArcFilter>
78 void SingleShortestPath(const Fst<Arc> &ifst,
79 MutableFst<Arc> *ofst,
80 vector<typename Arc::Weight> *distance,
81 ShortestPathOptions<Arc, Queue, ArcFilter> &opts) {
82 typedef typename Arc::StateId StateId;
83 typedef typename Arc::Weight Weight;
96 vector<Arc> arc_parent;
129 arc_parent.push_back(Arc(kNoLabel, kNoLabel, Weight::Zero(), kNoStateId));
133 arc_parent.push_back(Arc(kNoLabel, kNoLabel, Weight::Zero(), kNoStateId));
155 for (ArcIterator< Fst<Arc> > aiter(ifst, s);
158 const Arc &arc = aiter.Value();
159 while (distance->size() <= arc.nextstate) {
163 arc_parent.push_back(Arc(kNoLabel, kNoLabel, Weight::Zero(),
166 Weight &nd = (*distance)[arc.nextstate];
167 Weight w = Times(sd, arc.weight);
174 parent[arc.nextstate] = s;
175 arc_parent[arc.nextstate] = arc;
176 if (!enqueued[arc.nextstate]) {
177 state_queue->Enqueue(arc.nextstate);
178 enqueued[arc.nextstate] = true;
180 state_queue->Update(arc.nextstate);
275 template<class Arc, class RevArc>
277 MutableFst<Arc> *ofst,
278 const vector<typename Arc::Weight> &distance,
281 typename Arc::Weight weight_threshold = Arc::Weight::Zero(),
282 typename Arc::StateId state_threshold = kNoStateId) {
283 typedef typename Arc::StateId StateId;
284 typedef typename Arc::Weight Weight;
350 ofst->AddArc(ofst->Start(), Arc(0, 0, Weight::One(), state));
359 Arc arc(rarc.ilabel, rarc.olabel, rarc.weight.Reverse(), rarc.nextstate);
360 Weight w = Times(p.second, arc.weight);
362 pairs.push_back(Pair(arc.nextstate, w));
363 arc.nextstate = state;
364 ofst->AddArc(next, arc);
374 ofst->AddArc(next, Arc(0, 0, finalw, state));
394 // strings, the queue discipline, the arc filter and the convergence
412 template<class Arc, class Queue, class ArcFilter>
413 void ShortestPath(const Fst<Arc> &ifst, MutableFst<Arc> *ofst,
414 vector<typename Arc::Weight> *distance,
415 ShortestPathOptions<Arc, Queue, ArcFilter> &opts) {
416 typedef typename Arc::StateId StateId;
417 typedef typename Arc::Weight Weight;
418 typedef ReverseArc<Arc> ReverseArc;
448 const ReverseArc &arc = aiter.Value();
449 StateId s = arc.nextstate - 1;
451 d = Plus(d, Times(arc.weight.Reverse(), (*distance)[s]));
483 template<class Arc>
484 void ShortestPath(const Fst<Arc> &ifst, MutableFst<Arc> *ofst,
487 typename Arc::Weight weight_threshold = Arc::Weight::Zero(),
488 typename Arc::StateId state_threshold = kNoStateId) {
489 vector<typename Arc::Weight> distance;
490 AnyArcFilter<Arc> arc_filter;
491 AutoQueue<typename Arc::StateId> state_queue(ifst, &distance, arc_filter);
492 ShortestPathOptions< Arc, AutoQueue<typename Arc::StateId>,
493 AnyArcFilter<Arc> > opts(&state_queue, arc_filter, n, unique, false,