def get_nodes(pipe_ptr, node_set):
    if pipe_ptr is None:
        return
    if pipe_ptr in node_set:
        return
    node_set.add(pipe_ptr)
    for next_node in pipe_ptr.next_.values():
        get_nodes(next_node, node_set)