public Vertex getMinDegreeVertexNotInsulated() {
        Integer[] degrees = new Integer[vertices.length];
        for (int i = 0; i < degrees.length; i++) {
            degrees[i] = 0;
        }
        for (Edge edge : edges) {
            Vertex start = edge.getVertexStart();
            Vertex end = edge.getVertexEnd();
            degrees[start.index]++;
            degrees[end.index]++;
        }
        Integer index = null;
        for (int i = 0; i < degrees.length; i++) {
            if (degrees[i] > 0) {
                index = i;
                break;
            }
        }
        if (index == null) {
            throw new RuntimeException("Not uninsulates vertex in grapf");
        }
        for (int i = 0; i < degrees.length; i++) {
            if (degrees[i] < degrees[index] && degrees[i] > 0) {
                index = i;
            }
        }
        return vertices[index];
    }