protected void CalculateRepulsiveForces()
 {
     IVertexEnumerator enumerator = this.graph.get_Vertices().GetEnumerator();
     while (enumerator.MoveNext())
     {
         IVertex vertex = enumerator.get_Current();
         Vector2D vectord2 = new Vector2D();
         this.disp.set_Item(vertex, vectord2);
         IVertexEnumerator enumerator2 = this.graph.get_Vertices().GetEnumerator();
         while (enumerator2.MoveNext())
         {
             IVertex vertex2 = enumerator2.get_Current();
             if (vertex2 != vertex)
             {
                 VertexVector2DDictionary dictionary;
                 IVertex vertex3;
                 Vector2D vectord = (Vector2D) (this.pos.get_Item(vertex) - this.pos.get_Item(vertex2));
                 while (vectord.Norm() == 0.0)
                 {
                     Random random = new Random();
                     vectord = new Vector2D((random.NextDouble() * 2.0) - 1.0, (random.NextDouble() * 2.0) - 1.0);
                 }
                 (dictionary = this.disp).set_Item(vertex3 = vertex, dictionary.get_Item(vertex3) + ((Vector2D) ((vectord / vectord.Norm()) * this.RepulsiveForce(vectord.Norm()))));
             }
         }
     }
 }
        protected void CalculateRepulsiveForces()
        {
            foreach (IVertex v in graph.Vertices)
            {
                disp[v] = new Vector2D();

                foreach (IVertex u in graph.Vertices)
                {
                    if (u != v)
                    {
                        Vector2D delta = (Vector2D)pos[v] - (Vector2D)pos[u];
                        while (delta.Norm() == 0)
                        {
                            //The vertices are occupying the same location, so randomly repel
                            Random random = new Random();
                            delta = new Vector2D(
                                random.NextDouble() * 2 - 1,
                                random.NextDouble() * 2 - 1
                                );
                        }

                        disp[v] += delta / delta.Norm() * RepulsiveForce(delta.Norm());
                    }
                }
            }
        }