summaryrefslogtreecommitdiffstats
path: root/src/CS340.TSP/City.cs
diff options
context:
space:
mode:
authorToby Vincent <tobyv13@gmail.com>2021-04-22 02:12:26 -0500
committerToby Vincent <tobyv13@gmail.com>2021-04-22 02:12:26 -0500
commitf77dd59b7cfe5c8237e5410156dd940bc7d7b069 (patch)
tree67f3aefeb6fd488091ca882eec5917243cfd26ef /src/CS340.TSP/City.cs
parent29213f627ee0091a2a9a952e4ab3017896fe382a (diff)
added Coordinates to City
Diffstat (limited to 'src/CS340.TSP/City.cs')
-rw-r--r--src/CS340.TSP/City.cs16
1 files changed, 4 insertions, 12 deletions
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<double>;
using IVertex = IVertex<Edge<double>, double>;
using Road = Edge<double>;
+ using Vertex = Vertex<Edge<double>, double>;
- public class City : IVertex, IComparable<INode>
+ public partial class City : Vertex, IVertex, IComparable<INode>
{
- public int Id { get; set; }
- public double Key { get => this[Parent].Weight; set => Key = value; }
- public int Parent { get; set; } = -1;
- public List<Road> Edges { get; set; } = new List<Road>();
+ 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