예제 #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;
 }