コード例 #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
ファイル: Graph.cs プロジェクト: lpekelharing/Dev6Algo
        public void AddVertex(Vector2 v)
        {
            var vertex = new GraphVertex(v);

            Vertices.Add(v, vertex);
        }
コード例 #3
0
ファイル: GraphEdge.cs プロジェクト: lpekelharing/Dev6Algo
 public GraphEdge(GraphVertex terminator, double weight)
 {
     _weight     = weight;
     _terminator = terminator;
 }