/// <summary>
        /// Updates the vertex internal information.
        /// Maintains consistency between the vertex's position on the
        /// screen and ins internal information.
        /// </summary>
        /// <param name="vertex"></param>
        /// <param name="graphLayout"></param>
        public void UpdateVertexInfo(ref VertexCity vertex, ref GraphLayoutCity graphLayout)
        {
            if (vertex != null)
            {
                // Get the vertex control
                VertexControl vertexControl = graphLayout.GetVertexControl(vertex);

                // If we could find the verex control
                if (vertexControl != null)
                {
                    double tempXCoord, tempYCoord;

                    // Get the vertex screen coordinates
                    tempXCoord = GraphCanvas.GetX(vertexControl);
                    tempYCoord = GraphCanvas.GetY(vertexControl);

                    // Update the internal information if the coordinates
                    // are in range from 0 to 800
                    if ((tempXCoord > 0) && (tempXCoord < 800) &&
                        (tempYCoord > 0) && (tempYCoord < 800))
                    {
                        vertex.CityCoordinates.setX((int)tempXCoord);
                        vertex.CityCoordinates.setY((int)tempYCoord);
                    }

                    // Set the new screen coordinates
                    GraphCanvas.SetX(vertexControl, vertex.CityCoordinates.getX());
                    GraphCanvas.SetY(vertexControl, vertex.CityCoordinates.getY());
                }
            }
        }
        /// <summary>
        /// Set the nodes coordinates to the coordinates from the
        /// locations file.
        /// </summary>
        /// <param name="graphLayout">
        /// Graph layout
        /// </param>
        /// <param name="citiesLocations">
        /// Locations file that has the desired coordinates for the graph's vertices
        /// </param>
        public void EstablishCoordinates(ref GraphLayoutCity graphLayout,
                                         CitiesLocations citiesLocations)
        {
            VertexControl vertexControl = new VertexControl();
            Coordinates   tempVertexCoordinates;

            if (citiesLocations != null)
            {
                foreach (VertexCity vertex in graphLayout.Graph.Vertices)
                {
                    // Get the coordinates from the locations file
                    citiesLocations.locations.TryGetValue(vertex.City, out tempVertexCoordinates);

                    // Update the vertex data
                    vertex.CityCoordinates.setX(tempVertexCoordinates.getX());
                    vertex.CityCoordinates.setY(tempVertexCoordinates.getY());

                    // Update the vertex position on the screen
                    vertexControl = graphLayout.GetVertexControl(vertex);
                    GraphCanvas.SetX(vertexControl, vertex.CityCoordinates.getX());
                    GraphCanvas.SetY(vertexControl, vertex.CityCoordinates.getY());
                }
            }
        }