def path_sequence(list_of_links, source, target):
    """
    Convert set of tuples representing path in random order to a path
    :param list_of_links: set of tuples representing path
    :param source: source node
    :param target: destination node
    :return: pretty path as sequence of nodes
    """

    pretty_path = []
    nxt = source
    pretty_path.append(source)

    # iterate through list till target is reached
    while (nxt != target):
        for pair in list_of_links:
            if pair[0] == nxt:
                nxt = pair[1]
                pretty_path.append(nxt)
                list_of_links.remove(pair)

    return pretty_path