Finds the shortest string using BFS
    Args:
        graph (DFA): The DFA states
        start (DFA state): The DFA initial state
    Returns:
        str: The shortest string

def bfs(graph, start):
    """
    Finds the shortest string using BFS
    Args:
        graph (DFA): The DFA states
        start (DFA state): The DFA initial state
    Returns:
        str: The shortest string
    """
    # maintain a queue of paths
    queue = []
    visited = []
    # maintain a queue of nodes
    # push the first path into the queue
    queue.append([['', start]])
    while queue:
        # get the first path from the queue
        path = queue.pop(0)
        # get the last node from the path
        node = path[-1][1]
        if node.stateid not in visited:
            visited.append(node.stateid)
            # path found
            if node.final != TropicalWeight(float('inf')):
                return "".join([mnode[0] for mnode in path])
            # enumerate all adjacent nodes, construct a new path and push
            # it into the queue
            for arc in node.arcs:
                char = graph.isyms.find(arc.ilabel)
                next_state = graph[arc.nextstate]
                # print next_state.stateid
                if next_state.stateid not in visited:
                    new_path = list(path)
                    new_path.append([char, next_state])
                    queue.append(new_path)