From f77dd59b7cfe5c8237e5410156dd940bc7d7b069 Mon Sep 17 00:00:00 2001 From: Toby Vincent Date: Thu, 22 Apr 2021 02:12:26 -0500 Subject: added Coordinates to City --- src/CS340.TSP/City.cs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src/CS340.TSP/City.cs') diff --git a/src/CS340.TSP/City.cs b/src/CS340.TSP/City.cs index eaf4ef3..962a864 100644 --- a/src/CS340.TSP/City.cs +++ b/src/CS340.TSP/City.cs @@ -9,17 +9,14 @@ namespace TSP using INode = INode; using IVertex = IVertex, double>; using Road = Edge; + using Vertex = Vertex, double>; - public class City : IVertex, IComparable + public partial class City : Vertex, IVertex, IComparable { - public int Id { get; set; } - public double Key { get => this[Parent].Weight; set => Key = value; } - public int Parent { get; set; } = -1; - public List Edges { get; set; } = new List(); + public new double Key { get => this[Parent].Weight; set => Key = value; } - // indexer for accessing edge with v of index - public Road this[int index] { get => Edges.Find(edge => edge.V == index); } + public Coordinates Location { get; set; } public City() { } @@ -39,10 +36,5 @@ namespace TSP Edges.Add(newEdge); } } - - public int CompareTo(INode node) => - Key.CompareTo(node.Key); - - public override string ToString() => $"{Id} {String.Join(" ", Edges.Select(e => (e.V, e.Weight)))}"; } } \ No newline at end of file -- cgit v1.2.3-70-g09d2