def METHOD_NAME(graph, nodes, samples):
    assert not graph.is_tensor(), "You must call Graph.numpy() first."
    graph_list = []
    for max_deg in samples:
        start_nodes = copy.deepcopy(nodes)
        edges = []
        if max_deg == -1:
            pred_nodes = graph.predecessor(start_nodes)
        else:
            pred_nodes = graph.sample_predecessor(
                start_nodes, max_degree=max_deg)
        for dst_node, src_nodes in zip(start_nodes, pred_nodes):
            for src_node in src_nodes:
                edges.append((src_node, dst_node))
        neigh_nodes = [start_nodes, pred_nodes]
        neigh_nodes = flat_node_and_edge(neigh_nodes)
        from_reindex = {x: i for i, x in enumerate(neigh_nodes)}
        sub_node_index = graph_kernel.map_nodes(nodes, from_reindex)
        sg = subgraph(
            graph,
            nodes=neigh_nodes,
            edges=edges,
            with_node_feat=False,
            with_edge_feat=False)
        #         sg = add_self_loop(sg, sub_node_index)
        sg = add_self_loop(sg, sub_node_index)
        graph_list.append((sg, neigh_nodes, sub_node_index))
        nodes = neigh_nodes
    graph_list = graph_list[::-1]
    return graph_list