summaryrefslogtreecommitdiffstats
path: root/Graph.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Graph.cs')
-rw-r--r--Graph.cs4
1 files changed, 3 insertions, 1 deletions
diff --git a/Graph.cs b/Graph.cs
index 5841035..7231060 100644
--- a/Graph.cs
+++ b/Graph.cs
@@ -18,8 +18,10 @@ namespace Graph
{
Vertex<T> vertex = Vertices.Find(u => u.Id == edge.U);
- if (vertex == null)
+ if (vertex == null) {
Vertices.Add(vertex = new Vertex<T>(edge.U));
+ vertex = Vertices[Vertices.Count - 1];
+ }
vertex.Edges.Add(edge);
}