 
   // Update graph with new vertex positions.
   cudaMemcpy((void*) g->vertexXLocs, vxLocs, g->numvertices * sizeof(float),
-    cudaMemcpyDeviceToHost);
+      cudaMemcpyDeviceToHost);
   cudaMemcpy((void*) g->vertexYLocs, vyLocs, g->numvertices * sizeof(float),
-    cudaMemcpyDeviceToHost);
+      cudaMemcpyDeviceToHost);
   cudaMemcpy((void*) g->edgeSources, edgeSources,
-    g->numedges * sizeof(unsigned int), cudaMemcpyDeviceToHost);
+      g->numedges * sizeof(unsigned int), cudaMemcpyDeviceToHost);
   cudaMemcpy((void*) g->edgeTargets, edgeTargets,
-    g->numedges * sizeof(unsigned int), cudaMemcpyDeviceToHost);
-}
-
+      g->numedges * sizeof(unsigned int), cudaMemcpyDeviceToHost);
+}
+

// Attraction on edges
__device__ void fa2Attraction(unsigned int gid, unsigned int numvertices,
    float* vxLocs, float* vyLocs, int numedges, unsigned int* edgeSources,
    unsigned int* edgeTargets, float* forceX, float* forceY,
    unsigned int* deg);

__device__ void fa2UpdateSwing(unsigned int gid, unsigned int numvertices,
    float* forceX, float* forceY, float* oldForceX, float* oldForceY,

  }
}

__device__ void fa2Attraction(unsigned int gid, unsigned int numvertices,
    float* vxLocs, float* vyLocs, unsigned int numedges,
    unsigned int* edgeSources, unsigned int* edgeTargets, float* forceX,
    float* forceY, unsigned int* deg)
{
  if (gid < numvertices)
  {
    float vx1 = vxLocs[gid];
    float vy1 = vyLocs[gid];
    // Complete scan on edge array.
    for (size_t i = 0; i < numedges; i++)
    {
      unsigned int source = edgeSources[i];
      unsigned int target = edgeSources[i];
      // Edge source is this vertex.
      if (source == gid)
      {
        // Increase the degree of this node by one.
        deg[gid]++;

        // Compute attraction force.
        float vx2 = vxLocs[target];
        float vy2 = vyLocs[target];

        vectorSubtract(&vx2, &vy2, vx1, vy1);
        vectorMultiply(&vx2, &vy2, 0.5);
        vectorAdd(&forceX[gid], &forceY[gid], vx2, vy2);
      }
    }
  }
}

