class DiffusionMethods {

    public static Node[] getNeighbors(Graph graph, Node[] nodes) {
        Set<Node> nodeTree = new HashSet<>();

        graph.readLock();
        try {
            for (Node n : nodes) {
                nodeTree.addAll(graph.getNeighbors(n).toCollection());
            }
        } finally {
            graph.readUnlock();
        }

        //remove original nodes
        for (Node n : nodes) {
            nodeTree.remove(n);
        }
        return nodeTree.toArray(new Node[0]);
    }

    public static Node[] getNeighborsOfNeighbors(Graph graph, Node[] nodes) {<FILL_FUNCTION_BODY>}

    public static Node[] getPredecessors(DirectedGraph graph, Node[] nodes) {
        Set<Node> nodeTree = new HashSet<>();

        graph.readLock();
        try {
            for (Node n : nodes) {
                nodeTree.addAll(graph.getPredecessors(n).toCollection());
            }
        } finally {
            graph.readUnlock();
        }

        //remove original nodes
        for (Node n : nodes) {
            nodeTree.remove(n);
        }
        return nodeTree.toArray(new Node[0]);
    }

    public static Node[] getSuccessors(DirectedGraph graph, Node[] nodes) {
        Set<Node> nodeTree = new HashSet<>();

        graph.readLock();
        try {
            for (Node n : nodes) {
                nodeTree.addAll(graph.getSuccessors(n).toCollection());
            }
        } finally {
            graph.readUnlock();
        }

        //remove original nodes
        for (Node n : nodes) {
            nodeTree.remove(n);
        }
        return nodeTree.toArray(new Node[0]);
    }

    public static enum DiffusionMethod {

        NONE("DiffusionMethod.None"),
        NEIGHBORS("DiffusionMethod.Neighbors"),
        NEIGHBORS_OF_NEIGHBORS("DiffusionMethod.NeighborsOfNeighbors"),
        PREDECESSORS("DiffusionMethod.Predecessors"),
        SUCCESSORS("DiffusionMethod.Successors");
        private final String name;

        DiffusionMethod(String name) {
            this.name = name;
        }

        public String getName() {
            return NbBundle.getMessage(DiffusionMethods.class, name);
        }

        @Override
        public String toString() {
            return getName();
        }
    }
}

        Set<Node> nodeTree = new HashSet<>();

        graph.readLock();
        try {
            for (Node n : nodes) {
                nodeTree.addAll(graph.getNeighbors(n).toCollection());
            }
            //remove original nodes
            for (Node n : nodes) {
                nodeTree.remove(n);
            }
            for (Node n : nodeTree.toArray(new Node[0])) {
                nodeTree.addAll(graph.getNeighbors(n).toCollection());
            }
        } finally {
            graph.readUnlock();
        }

        //remove original nodes
        for (Node n : nodes) {
            nodeTree.remove(n);
        }
        return nodeTree.toArray(new Node[0]);
    
<no_super_class>