示例#1
0
 public void AddEdge(GraphVertex target, double distance)
 {
     if (target == null)
     {
         throw new ArgumentNullException("target");
     }
     if (target == this)
     {
         throw new ArgumentException("Current implementation neither expects nor allows Vertices to connect to themselves.");
     }
     if (distance < 0)
     {
         throw new ArgumentException("Distance must be positive.");
     }
     _edges.Add(new GraphEdge(target, distance));
 }
示例#2
0
        public void AddVertex(Vector2 v)
        {
            var vertex = new GraphVertex(v);

            Vertices.Add(v, vertex);
        }
示例#3
0
 public GraphEdge(GraphVertex terminator, double weight)
 {
     _weight     = weight;
     _terminator = terminator;
 }