using System; using System.Collections.Generic; using Graph; using Interfaces; namespace TSP { using INode = INode; using IVertex = IVertex, double>; using Road = Edge; using Vertex = Vertex, double>; public partial class City : Vertex, IVertex, IComparable { public new double Key { get => this[Parent].Weight; set => Key = value; } public Coordinate Location { get; set; } public City() { } public City(int id) => Id = id; public City(int id, List edges) : this(id) { foreach (Road edge in edges) { Road newEdge = new Road(edge.U, edge.V, edge.Weight); Edges.Add(newEdge); } } public City(IVertex city) : this(city.Id, city.Edges) => Parent = city.Parent; public City(IVertex city, Coordinate location) : this(city) => Location = new Coordinate(location.X, location.Y); public City(City city) : this(city, city.Location) { } } }