import fst t = fst.Transducer() t.add_arc(0, 1, 'a', 'A', 0.5) t.add_arc(0, 1, 'b', 'B', 1.5) t.add_arc(1, 2, 'c', 'C', 2.5) t[2].final = 3.5 t t.shortest_path()