private void AppendComponent(FhComponent c1, FhComponent c2, double weight, double k)
 {
     FhNode nodeB = c2.First;
     while (nodeB != null)
     {
         nodeB.Component = c1;
         nodeB = nodeB.Next;
     }
     c1.Last.Next = c2.First;
     c1.Last = c2.Last;
     c1.Count += c2.Count;
     c1.IntPtau = weight + k / (double)c1.Count;
 }
 private void CreateArrays(int width, int height)
 {
     nodes = new FhNode[width, height];
     for (int j = 0; j < height; j++)
         for (int i = 0; i < width; i++)
             nodes[i,j] = new FhNode();
     components = new FhComponent[width * height];
     for (int i = 0; i < components.Length; i++)
         components[i] = new FhComponent();
     edges = new FhEdge[4 * width * height];
     for (int i = 0; i < edges.Length; i++)
         edges[i] = new FhEdge();
     edgePockets = new FhEdge[256];
 }