using System; using System.Collections.Generic; using System.Linq; 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 Coordinates Location { get; set; } public City() { } public City(int id) => Id = id; public City(int id, List edges) : this(id) => Edges = edges; public City(IVertex city) { Id = city.Id; Parent = city.Parent; foreach (Road edge in city.Edges) { Road newEdge = new Road(edge.U, edge.V, edge.Weight); Edges.Add(newEdge); } } } }