示例#1
0
        public ET ConnectTo <ET>(VertexT targetVertex) where ET : EdgeT
        {
            var ps  = new[] { typeof(GraphT), typeof(VertexT), typeof(VertexT) };
            var pss = new object[] { Graph, this, targetVertex };
            var e   = (ET)typeof(ET).GetConstructor(ps).Invoke(pss);

            Graph.Edges.Add(e);

            OutEdges.Add(e);
            targetVertex.InEdges.Add(e);
            return(e);
        }
示例#2
0
 // Add an edge from this node to dest. If this is a cBranch type of node and it already
 // has an edge to dest then node edge is added and the node type is changed to fall
 public void AddEdgeTo(StructureNode dest)
 {
     if (BlockType != BlockTerminationType.Branch || !HasEdgeTo(dest))
     {
         OutEdges.Add(dest);
     }
     else
     {
         //reset the type to fall if no edge was added (i.e. this edge already existed)
         BlockType = BlockTerminationType.FallThrough;
     }
 }
示例#3
0
 private void AddEdge(Edge edge)
 {
     OutEdges.Add(edge);
     edge.TargetNode.InEdges.Add(edge);
 }