                          int32_t* scores,
                          uint8_t* consensus)
 {
+    // Initialize scores and predecessors to default value.
     for(uint16_t i = 0; i < node_count; i++)
     {
         predecessors[i] = -1;

            }
        }

        if (predecessors[node_id] != -1)
        {
            score_node_id += scores[predecessors[node_id]];
        }

        if (max_score < score_node_id)
        {
            max_score_id = node_id;


    for(uint16_t graph_pos = 0; graph_pos < node_count; graph_pos++)
    {
        uint16_t node_id = graph[graph_pos];
        uint16_t in_edges = incoming_edge_count[node_id];

        int32_t score_node_id = scores[node_id];

        // For each node, go through it's incoming edges.
        // If the weight of any of the incoming edges is greater
        // than the score of the current node, or if the weight is equal
        // but the predecessors of the edge are heavier than the current node,
        // then update the score of the node to be the incoming edge weight.
        for(uint16_t e = 0; e < in_edges; e++)
        {
            uint16_t edge_w = incoming_edge_w[node_id * CUDAPOA_MAX_NODE_EDGES + e];
