                         cudaMemcpyHostToDevice),
                         "ProblemBase cudaMemcpy d_column_indices failed", __FILE__, __LINE__)) break;
 
+                    if (retval = util::GRError(cudaMalloc(
+                        (void**)&graph_slices[0]->d_out_degrees,
+                        (graph_slices[0]->nodes) * sizeof(SizeT)),
+                        "ProblemBase cudaMalloc d_out_degrees failed", __FILE__, __LINE__)) break;
+
+                    // count number of out-going degrees for each node
+                    util::MemsetMadVectorKernel<<<128, 128>>>(
+                        data_slices[0]->d_out_degrees,
+                        graph_slices[0]->d_row_offsets,
+                        &graph_slices[0]->d_row_offsets[1], -1, nodes);
+
                     if (h_column_offsets != NULL) {
                         // Allocate and initialize d_column_offsets
                         if (retval = util::GRError(cudaMalloc(

                                        graph_slices[0]->edges * sizeof(VertexId),
                                        cudaMemcpyHostToDevice),
                                    "ProblemBase cudaMemcpy d_row_indices failed", __FILE__, __LINE__)) break;
                    }

                } //end if(stream_from_host)

            if (d_column_indices)   util::GRError(cudaFree(d_column_indices), "GpuSlice cudaFree d_column_indices failed", __FILE__, __LINE__);
            if (d_column_offsets)   util::GRError(cudaFree(d_column_offsets), "GpuSlice cudaFree d_column_offsets failed", __FILE__, __LINE__);
            if (d_row_indices)      util::GRError(cudaFree(d_row_indices), "GpuSlice cudaFree d_row_indices failed", __FILE__, __LINE__);
            if (d_in_degrees)       util::GRError(cudaFree(d_in_degrees), "GpuSlice cudaFree d_in_degrees failed", __FILE__, __LINE__);
            if (d_out_degrees)      util::GRError(cudaFree(d_out_degrees), "GpuSlice cudaFree d_out_degrees failed", __FILE__, __LINE__);
            for (int i = 0; i < 2; ++i) {
                if (frontier_queues.d_keys[i])      util::GRError(cudaFree(frontier_queues.d_keys[i]), "GpuSlice cudaFree frontier_queues.d_keys failed", __FILE__, __LINE__);
                if (frontier_queues.d_values[i])    util::GRError(cudaFree(frontier_queues.d_values[i]), "GpuSlice cudaFree frontier_queues.d_values failed", __FILE__, __LINE__);
