                         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(

            d_column_indices(NULL),
            d_column_offsets(NULL),
            d_row_indices(NULL),
            nodes(0),
            edges(0),
            stream(stream)

        VertexId        *d_column_indices;          // CSR format column indices on device memory
        SizeT           *d_column_offsets;          // CSR format column offset on device memory
        VertexId        *d_row_indices;             // CSR format row indices on device memory
        SizeT           *d_in_degrees;              // array that stores the In-degree value for directed graph
        SizeT           *d_out_degrees;             // array that stores the Out-degree value for directed graph and degree value for undirected graph

        //Frontier queues. Used to track working frontier.
        util::DoubleBuffer<VertexId, VertexId>      frontier_queues;
