public int countEdges() {
        boolean end = false;
        int size = 0;
        int i=0;
        while (adj[i].size() != 0) {
            size += adj[i].size();
            i++;
        }
        size /= 2;
        return size;
    }