/// /// Copyright (c) 2020 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; namespace SchematicDrawing { public class GNode { /// Graph node properties public IDrawingItem Item; public int NodeId; public readonly IList Edges; /// Distance from a start node public int Dist; /// Minimal heap index public int HeapIx; /// /// Constructor /// /// Item /// public GNode(IDrawingItem item, int nodeId) { Item = item; NodeId = nodeId; Edges = new List(); Dist = int.MaxValue; } public void AddEdge(GEdge edge) { Edges.Add(edge); } public GNode Reset(int heapIx, int dist = int.MaxValue) { HeapIx = heapIx; Dist = dist; return this; } public override string ToString() { return string.Format("{0}/{1} dist={2}", Item.Name, NodeId, Dist); } } }