summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToby Vincent <tobyv13@gmail.com>2021-03-28 01:01:30 +0000
committerToby Vincent <tobyv13@gmail.com>2021-03-28 01:01:30 +0000
commitbf4c7f3d9d7c69976aaa2f7c1b59d5e837d511c1 (patch)
treea3753e1234e1bc4bb50787f7cc9aaf69d46d2d17
parenta5c5bf0b5fe32a19a173af31e0199deb7456a74a (diff)
fixed ToString
-rw-r--r--Edge.cs2
-rw-r--r--Vertex.cs3
2 files changed, 3 insertions, 2 deletions
diff --git a/Edge.cs b/Edge.cs
index b05c367..9b31169 100644
--- a/Edge.cs
+++ b/Edge.cs
@@ -18,6 +18,6 @@ namespace Graph
public int CompareTo(Edge<T> edge) =>
Weight.CompareTo(edge.Weight);
- public override string ToString() => $"{V} {Weight}";
+ public override string ToString() => $"{U} {V} {Weight}";
}
}
diff --git a/Vertex.cs b/Vertex.cs
index 31a40b4..1f1fbbc 100644
--- a/Vertex.cs
+++ b/Vertex.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using PriorityQueue;
using PriorityQueue.Interfaces;
@@ -15,6 +16,6 @@ namespace Graph
public Vertex(int id, List<Edge<T>> edges) : this(id) =>
Edges = edges;
- public override string ToString() => $"{Id} {String.Join(" ", Edges)}";
+ public override string ToString() => $"{Id} {String.Join(" ", Edges.Select(e => (e.V, e.Weight)))}";
}
}