40 lines
847 B
C#
40 lines
847 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace SchematicDrawing
|
|
{
|
|
public class GNode
|
|
{
|
|
public IDrawingItem Item;
|
|
public int NodeId;
|
|
public readonly IList<GEdge> Edges;
|
|
|
|
public int Dist;
|
|
public bool Visited;
|
|
|
|
public GNode(IDrawingItem item, int nodeId)
|
|
{
|
|
this.Item = item;
|
|
this.NodeId = nodeId;
|
|
this.Edges = new List<GEdge>();
|
|
Reset();
|
|
}
|
|
|
|
public void AddEdge(GEdge edge)
|
|
{
|
|
Edges.Add(edge);
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
Visited = false;
|
|
Dist = int.MaxValue;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return string.Format("{0}/{1} {2} dist={3}", Item.Name, NodeId, Visited ? "V" : "", Dist);
|
|
}
|
|
}
|
|
}
|