コード例 #1
0
        // AddEdge adds the edge, creating endpoint nodes if necessary.
        // Edge is added to adjacency list of from edges.
        public void AddEdge(string name1, string name2, string relationship)
        {
            AddNode(name1);                     // create the node if it doesn't already exist
            GraphNode n1 = nodeDict[name1];     // now fetch a reference to the node

            AddNode(name2);
            GraphNode n2 = nodeDict[name2];
            GraphEdge e  = new GraphEdge(n1, n2, relationship);

            n1.AddIncidentEdge(e);
        }