Topsort

Description

This operation topologically sorts its input if acyclic, modifying it. Otherwise, the input is unchanged. When sorted, all transitions are from lower to higher state IDs.

Usage

template<class Arc>
void Topsort(MutableFst<Arc> *fst);
doc
fsttopsort a.fst out.fst
 

Examples

A:

topsort1.jpg

Topsort of A:

topsort2.jpg

Topsort(&A);
fsttopsort a.fst out.fst

Complexity

Topsort:

  • Time: O(V + E)
  • Space: O(V + E)
where V = # of states and E = # of arcs.

-- MichaelRiley - 02 Jul 2007

Topic attachments
I Attachment Action Size Date Who Comment
jpgjpg topsort1.jpg manage 15.4 K 03 Jul 2007 - 00:36 MichaelRiley  
jpgjpg topsort2.jpg manage 15.3 K 03 Jul 2007 - 00:37 MichaelRiley  
Topic revision: r1 - 03 Jul 2007 - 00:37:24 - MichaelRiley
 
This site is powered by the TWiki collaboration platformCopyright &© by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback