示例#1
0
        private void CreateEdge(GraphNode source, GraphNode target)
        {
            if (source == null || target == null)
            {
                return;
            }
            var graphEdge = new GraphEdge(source, target);

            source.OutEdges.Add(graphEdge);
            target.InEdges.Add(graphEdge);
        }
示例#2
0
 private void UnBuildRelation(GraphNode graphNode)
 {
     for (int i = 0; i < graphNode.OutEdges.Count; i++)
     {
         GraphEdge outEdge    = graphNode.OutEdges[i];
         GraphNode targetNode = outEdge.Target;
         foreach (var edge in targetNode.InEdges)
         {
             if (edge.Source.Equals(graphNode))
             {
                 continue;
             }
             var binaryAltNode = edge.Source;
             binaryAltNode.OutEdges.Remove(edge);
         }
         targetNode.InEdges.Clear();
     }
     for (int j = 0; j < graphNode.InEdges.Count; j++)
     {
         var inEdge     = graphNode.InEdges[j];
         var sourceNode = inEdge.Source;
         sourceNode.OutEdges.Remove(inEdge);
     }
 }
 private void CreateEdge(GraphNode source, GraphNode target)
 {
     if (source == null || target == null) return;
     var graphEdge = new GraphEdge(source, target);
     source.OutEdges.Add(graphEdge);
     target.InEdges.Add(graphEdge);
 }