当前位置: 首页>>代码示例>>C#>>正文


C# Node.GetChildren方法代码示例

本文整理汇总了C#中GraphToDSCompiler.Node.GetChildren方法的典型用法代码示例。如果您正苦于以下问题:C# Node.GetChildren方法的具体用法?C# Node.GetChildren怎么用?C# Node.GetChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GraphToDSCompiler.Node的用法示例。


在下文中一共展示了Node.GetChildren方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DFSVisit

 static void DFSVisit(Node node, Dictionary<Node, int> nodeStateMap, List<Node> list)
 {
     nodeStateMap.Add(node, VISITING);
     List<Node> nodes = node.GetChildren();
     IEnumerable iter = nodes;
     foreach (Node nodeI in iter)
     {
         if (IsNotVisited(nodeI, nodeStateMap))
             DFSVisit(nodeI, nodeStateMap, list);
     }
     nodeStateMap[node] = VISITED;
     list.Add(node);
 }
开发者ID:ankushraizada,项目名称:Dynamo,代码行数:13,代码来源:TopSort.cs

示例2: DFSVisit

 /// <summary>
 /// Returns false if a depth-first search of Graph yields no back edges.
 /// If back edges found then return true and update cycleStack.
 /// </summary>
 /// <param name="node"></param>
 /// <param name="nodeStateMap"></param>
 /// <param name="cycleStack"></param>
 /// <returns></returns>
 public static Boolean DFSVisit(Node node, Dictionary<Node, int> nodeStateMap, List<Node> cycleStack)
 {
     cycleStack.Add(node);
     nodeStateMap.Add(node, visiting);
     List<Node> nodes = node.GetChildren();
     IEnumerable iter = nodes;
     foreach (Node nodeI in iter)
     {
         if (IsNotVisited(nodeI, nodeStateMap))
         {
             if (DFSVisit(nodeI, nodeStateMap, cycleStack)) return true;
         }
         else if (IsVisiting(nodeI, nodeStateMap))
         {
             cycleStack.Insert(0,node);
             return true;
         }
     }
     nodeStateMap[node] = visited;
     cycleStack.RemoveAt(0);
     return false;
 }
开发者ID:samuto,项目名称:designscript,代码行数:30,代码来源:CheckForCycle.cs

示例3: RemoveNode

        /// <summary>
        /// Removes the node passed as parameter from the graph(represented using NodeMap)
        /// </summary>
        /// <param name="rem"></param>
        /// <returns></returns>
        public bool RemoveNode(Node rem)
        {
            if (nodeMap.ContainsKey(rem.Guid))
            {
                IEnumerable iter = rem.GetChildren();
                foreach (Node child in iter)
                {
                    child.RemoveParent(rem);
                }
                iter = rem.GetParents();
                foreach (Node dad in iter)
                {
                    dad.RemoveChild(rem);
                }

                nodeMap.Remove(rem.Guid); 
                nodeList.Remove(rem); 
                return true;
            }
            return false;
        }
开发者ID:RobertiF,项目名称:Dynamo,代码行数:26,代码来源:AST.cs

示例4: RemoveAllEdges

 /// <summary>
 /// Remove all edges from or to the node passed as parameter.
 /// </summary>
 /// <param name="rem"></param>
 /// <returns></returns>
 public bool RemoveAllEdges(Node rem)
 {
     if (nodeMap.ContainsKey(rem.Guid))
     {
         IEnumerable iter = rem.GetChildren();
         foreach (Node child in iter)
         {
             rem.RemoveChild(child); 
             child.RemoveParent(rem);
         }
         iter = rem.GetParents();
         foreach (Node dad in iter)
         {
             rem.RemoveChild(dad); 
             dad.RemoveChild(rem);
         }
         return true;
     }
     return false;
 }
开发者ID:RobertiF,项目名称:Dynamo,代码行数:25,代码来源:AST.cs


注:本文中的GraphToDSCompiler.Node.GetChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。