@staticmethod
def all_nodes_between(graph, begin, end):
    """Finds all nodes between begin and end. Returns None if there is any
           path starting at begin that does not reach end."""
    to_visit = [begin]
    seen = set()
    while len(to_visit) > 0:
        n = to_visit.pop()
        if n == end:
            continue
        if n in seen:
            continue
        seen.add(n)
        node_out_edges = graph.out_edges(n)
        if len(node_out_edges) == 0:
            return None
        for e in node_out_edges:
            next_node = e.dst
            if next_node != end and next_node not in seen:
                to_visit.append(next_node)
    return seen
