From b88e1a8dfc3bf6f6ea473b877e2a43a858ced3a7 Mon Sep 17 00:00:00 2001 From: C9Glax <13404778+C9Glax@users.noreply.github.com> Date: Thu, 3 Nov 2022 19:13:26 +0100 Subject: [PATCH] Added Distance --- Graph/Edge.cs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/Graph/Edge.cs b/Graph/Edge.cs index 26faf6f..b834a4e 100644 --- a/Graph/Edge.cs +++ b/Graph/Edge.cs @@ -1,22 +1,18 @@ namespace Graph { - public struct Edge + public class Edge { public ulong id { get; } public Node neighbor { get; } - public float weight { get; } - public Edge(Node neighbor, float weight) - { - this.neighbor = neighbor; - this.weight = weight; - this.id = 0; - } + public float time { get; } + public float distance { get; } - public Edge(Node neighbor, float weight, ulong id) + public Edge(Node neighbor, float time, float distance, ulong? id) { this.neighbor = neighbor; - this.weight = weight; - this.id = id; + this.time = time; + this.distance = distance; + this.id = (id != null) ? id.Value : 0; } } }