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


C# INode.GetCompatibleOutgoing方法代码示例

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


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

示例1: FlushFile

 private void FlushFile(INode output)
 {
     int count = 0;
     foreach (IEdge e in output.GetCompatibleOutgoing(createOrOverwriteType))
     {
         CreateOrOverwrite(e.Target);
         graph.Remove(e);
         count++;
     }
     foreach (IEdge e in output.GetCompatibleOutgoing(createOrAppendType))
     {
         CreateOrAppend(e.Target);
         graph.Remove(e);
         count++;
     }
     Infrastructure.MsgToConsole("Wrote " + count + " file(s).");
 }
开发者ID:jblomer,项目名称:GrGen.NET,代码行数:17,代码来源:FileIO.cs

示例2: Incident

        //////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Returns set of edges incident to the start node, under the type constraints given
        /// </summary>
        public static Dictionary<IEdge, SetValueType> Incident(INode startNode, EdgeType incidentEdgeType, NodeType adjacentNodeType, int threadId)
        {
            Dictionary<IEdge, SetValueType> incidentEdgesSet = new Dictionary<IEdge, SetValueType>();
            foreach(IEdge edge in startNode.GetCompatibleOutgoing(incidentEdgeType))
            {
                INode adjacentNode = edge.Target;
                if(!adjacentNode.InstanceOf(adjacentNodeType))
                    continue;
                incidentEdgesSet[edge] = null;
            }
            foreach(IEdge edge in startNode.GetCompatibleIncoming(incidentEdgeType))
            {
                INode adjacentNode = edge.Source;
                if(!adjacentNode.InstanceOf(adjacentNodeType))
                    continue;
                incidentEdgesSet[edge] = null;
            }
            return incidentEdgesSet;
        }
开发者ID:jblomer,项目名称:GrGen.NET,代码行数:24,代码来源:GraphHelperParallel.cs

示例3: CountAdjacentOutgoing

 public static int CountAdjacentOutgoing(IGraph graph, INode startNode, EdgeType incidentEdgeType, NodeType adjacentNodeType, IActionExecutionEnvironment actionEnv, int threadId)
 {
     int count = 0;
     foreach(IEdge edge in startNode.Outgoing)
     {
         ++actionEnv.PerformanceInfo.SearchStepsPerThread[threadId];
         if(!edge.InstanceOf(incidentEdgeType))
             continue;
         INode adjacentNode = edge.Target;
         if(!adjacentNode.InstanceOf(adjacentNodeType))
             continue;
         if(graph.IsInternallyVisited(adjacentNode, threadId))
             continue;
         graph.SetInternallyVisited(adjacentNode, true, threadId);
         ++count;
     }
     foreach(IEdge edge in startNode.GetCompatibleOutgoing(incidentEdgeType))
     {
         INode adjacentNode = edge.Target;
         if(!adjacentNode.InstanceOf(adjacentNodeType))
             continue;
         graph.SetInternallyVisited(adjacentNode, false, threadId);
     }
     return count;
 }
开发者ID:jblomer,项目名称:GrGen.NET,代码行数:25,代码来源:GraphHelperParallel.cs

示例4: BoundedReachableEdgesOutgoingRec

 private static IEnumerable<IEdge> BoundedReachableEdgesOutgoingRec(INode startNode, int depth, EdgeType incidentEdgeType, NodeType adjacentNodeType, IGraph graph, Dictionary<IEdge, SetValueType> visitedEdges, Dictionary<INode, int> targetNodesToMinDepth, IActionExecutionEnvironment actionEnv, int threadId)
 {
     if(depth <= 0)
         yield break;
     foreach(IEdge edge in startNode.GetCompatibleOutgoing(incidentEdgeType))
     {
         ++actionEnv.PerformanceInfo.SearchStepsPerThread[threadId];
         INode adjacentNode = edge.Target;
         if(!adjacentNode.InstanceOf(adjacentNodeType))
             continue;
         if(!visitedEdges.ContainsKey(edge))
         {
             visitedEdges[edge] = null;
             yield return edge;
         }
         int nodeDepth;
         if(targetNodesToMinDepth.TryGetValue(adjacentNode, out nodeDepth) && nodeDepth >= depth - 1)
             continue;
         targetNodesToMinDepth[adjacentNode] = depth - 1;
         foreach(IEdge reachableEdge in BoundedReachableEdgesOutgoingRec(adjacentNode, depth - 1, incidentEdgeType, adjacentNodeType, graph, visitedEdges, targetNodesToMinDepth, actionEnv, threadId))
             yield return reachableEdge;
     }
 }
开发者ID:jblomer,项目名称:GrGen.NET,代码行数:23,代码来源:GraphHelperParallel.cs

示例5: BoundedReachableEdgesRec

 private static IEnumerable<IEdge> BoundedReachableEdgesRec(INode startNode, int depth, EdgeType incidentEdgeType, NodeType adjacentNodeType, IGraph graph, Dictionary<IEdge, SetValueType> visitedEdges, Dictionary<INode, int> adjacentNodesToMinDepth, int threadId)
 {
     if(depth <= 0)
         yield break;
     foreach(IEdge edge in startNode.GetCompatibleOutgoing(incidentEdgeType))
     {
         INode adjacentNode = edge.Target;
         if(!adjacentNode.InstanceOf(adjacentNodeType))
             continue;
         if(!visitedEdges.ContainsKey(edge))
         {
             visitedEdges[edge] = null;
             yield return edge;
         }
         int nodeDepth;
         if(adjacentNodesToMinDepth.TryGetValue(adjacentNode, out nodeDepth) && nodeDepth >= depth - 1)
             continue;
         adjacentNodesToMinDepth[adjacentNode] = depth - 1;
         foreach(IEdge reachableEdge in BoundedReachableEdgesRec(adjacentNode, depth - 1, incidentEdgeType, adjacentNodeType, graph, visitedEdges, adjacentNodesToMinDepth, threadId))
             yield return reachableEdge;
     }
     foreach(IEdge edge in startNode.GetCompatibleIncoming(incidentEdgeType))
     {
         INode adjacentNode = edge.Source;
         if(!adjacentNode.InstanceOf(adjacentNodeType))
             continue;
         if(!visitedEdges.ContainsKey(edge))
         {
             visitedEdges[edge] = null;
             yield return edge;
         }
         int nodeDepth;
         if(adjacentNodesToMinDepth.TryGetValue(adjacentNode, out nodeDepth) && nodeDepth >= depth - 1)
             continue;
         adjacentNodesToMinDepth[adjacentNode] = depth - 1;
         foreach(IEdge reachableEdge in BoundedReachableEdgesRec(adjacentNode, depth - 1, incidentEdgeType, adjacentNodeType, graph, visitedEdges, adjacentNodesToMinDepth, threadId))
             yield return reachableEdge;
     }
 }
开发者ID:jblomer,项目名称:GrGen.NET,代码行数:39,代码来源:GraphHelperParallel.cs

示例6: GetNextLineNode

 private INode GetNextLineNode(INode current)
 {
     foreach (IEdge nextEdge in current.GetCompatibleOutgoing(nextLineType))
     {
         return nextEdge.Target;
     }
     return null;
 }
开发者ID:jblomer,项目名称:GrGen.NET,代码行数:8,代码来源:FileIO.cs

示例7: CountOutgoing

 /// <summary>
 /// Returns count of the edges outgoing from the start node, under the type constraints given
 /// </summary>
 public static int CountOutgoing(INode startNode, EdgeType incidentEdgeType, NodeType adjacentNodeType, int threadId)
 {
     int count = 0;
     foreach(IEdge edge in startNode.GetCompatibleOutgoing(incidentEdgeType))
     {
         INode adjacentNode = edge.Target;
         if(!adjacentNode.InstanceOf(adjacentNodeType))
             continue;
         ++count;
     }
     return count;
 }
开发者ID:jblomer,项目名称:GrGen.NET,代码行数:15,代码来源:GraphHelperParallel.cs

示例8: ReachableEdgesOutgoingRec

        private static IEnumerable<IEdge> ReachableEdgesOutgoingRec(INode startNode, EdgeType incidentEdgeType, NodeType adjacentNodeType, IGraph graph, Dictionary<INode, SetValueType> visitedNodes, int threadId)
        {
            foreach(IEdge edge in startNode.GetCompatibleOutgoing(incidentEdgeType))
            {
                INode adjacentNode = edge.Target;
                if(!adjacentNode.InstanceOf(adjacentNodeType))
                    continue;
                yield return edge;

                if(visitedNodes.ContainsKey(adjacentNode))
                    continue;
                visitedNodes.Add(adjacentNode, null);
                foreach(IEdge reachableEdge in ReachableEdgesOutgoingRec(adjacentNode, incidentEdgeType, adjacentNodeType, graph, visitedNodes, threadId))
                    yield return reachableEdge;
            }
        }
开发者ID:jblomer,项目名称:GrGen.NET,代码行数:16,代码来源:GraphHelperParallel.cs

示例9: IsReachableEdgesOutgoing

        /// <summary>
        /// Returns whether the end edge is reachable from the start node, via outgoing edges, under the type constraints given
        /// </summary>
        private static bool IsReachableEdgesOutgoing(INode startNode, IEdge endEdge, EdgeType outgoingEdgeType, NodeType targetNodeType, IGraph graph, List<IGraphElement> visitedElems, int threadId)
        {
            bool result = false;

            foreach(IEdge edge in startNode.GetCompatibleOutgoing(outgoingEdgeType))
            {
                INode adjacentNode = edge.Target;
                if(!adjacentNode.InstanceOf(targetNodeType))
                    continue;
                if(graph.IsInternallyVisited(edge, threadId))
                    continue;
                graph.SetInternallyVisited(edge, true, threadId);
                visitedElems.Add(edge);
                if(edge.Target == endEdge)
                    return true;

                if(graph.IsInternallyVisited(adjacentNode, threadId))
                    continue;
                graph.SetInternallyVisited(adjacentNode, true, threadId);
                visitedElems.Add(adjacentNode);
                result = IsReachableEdgesOutgoing(adjacentNode, endEdge, outgoingEdgeType, targetNodeType, graph, visitedElems, threadId);
                if(result == true)
                    break;
            }

            return result;
        }
开发者ID:jblomer,项目名称:GrGen.NET,代码行数:30,代码来源:GraphHelperParallel.cs

示例10: IsOutgoing

 public static bool IsOutgoing(INode startNode, IEdge endEdge, EdgeType outgoingEdgeType, NodeType targetNodeType, int threadId)
 {
     foreach(IEdge edge in startNode.GetCompatibleOutgoing(outgoingEdgeType))
     {
         INode adjacentNode = edge.Target;
         if(!adjacentNode.InstanceOf(targetNodeType))
             continue;
         if(edge == endEdge)
             return true;
     }
     return false;
 }
开发者ID:jblomer,项目名称:GrGen.NET,代码行数:12,代码来源:GraphHelperParallel.cs

示例11: IsIncident

        //////////////////////////////////////////////////////////////////////////////////////////////

        public static bool IsIncident(INode startNode, IEdge endEdge, EdgeType incidentEdgeType, NodeType adjacentNodeType, int threadId)
        {
            foreach(IEdge edge in startNode.GetCompatibleOutgoing(incidentEdgeType))
            {
                INode adjacentNode = edge.Target;
                if(!adjacentNode.InstanceOf(adjacentNodeType))
                    continue;
                if(edge == endEdge)
                    return true;
            }
            foreach(IEdge edge in startNode.GetCompatibleIncoming(incidentEdgeType))
            {
                INode adjacentNode = edge.Source;
                if(!adjacentNode.InstanceOf(adjacentNodeType))
                    continue;
                if(edge == endEdge)
                    return true;
            }
            return false;
        }
开发者ID:jblomer,项目名称:GrGen.NET,代码行数:22,代码来源:GraphHelperParallel.cs

示例12: IsReachable

        /// <summary>
        /// Returns whether the end node is reachable from the start node, under the type constraints given
        /// </summary>
        private static bool IsReachable(INode startNode, INode endNode, EdgeType incidentEdgeType, NodeType adjacentNodeType, IGraph graph, List<INode> visitedNodes, int threadId)
        {
            bool result = false;

            foreach(IEdge edge in startNode.GetCompatibleOutgoing(incidentEdgeType))
            {
                INode adjacentNode = edge.Target;
                if(!adjacentNode.InstanceOf(adjacentNodeType))
                    continue;
                if(graph.IsInternallyVisited(adjacentNode, threadId))
                    continue;
                if(edge.Target == endNode)
                    return true;
                graph.SetInternallyVisited(adjacentNode, true, threadId);
                visitedNodes.Add(adjacentNode);
                result = IsReachable(adjacentNode, endNode, incidentEdgeType, adjacentNodeType, graph, visitedNodes, threadId);
                if(result == true)
                    break;
            }

            if(!result)
            {
                foreach(IEdge edge in startNode.GetCompatibleIncoming(incidentEdgeType))
                {
                    INode adjacentNode = edge.Source;
                    if(!adjacentNode.InstanceOf(adjacentNodeType))
                        continue;
                    if(graph.IsInternallyVisited(adjacentNode, threadId))
                        continue;
                    if(edge.Source == endNode)
                        return true;
                    graph.SetInternallyVisited(adjacentNode, true, threadId);
                    visitedNodes.Add(adjacentNode);
                    result = IsReachable(adjacentNode, endNode, incidentEdgeType, adjacentNodeType, graph, visitedNodes, threadId);
                    if(result == true)
                        break;
                }
            }

            return result;
        }
开发者ID:jblomer,项目名称:GrGen.NET,代码行数:44,代码来源:GraphHelperParallel.cs

示例13: ReachableEdgesOutgoing

 /// <summary>
 /// Fills set of outgoing edges reachable from the start node, under the type constraints given, in a depth-first walk
 /// </summary>
 private static void ReachableEdgesOutgoing(INode startNode, EdgeType outgoingEdgeType, NodeType targetNodeType, Dictionary<IEdge, SetValueType> outgoingEdgesSet, IGraph graph, int threadId)
 {
     foreach(IEdge edge in startNode.GetCompatibleOutgoing(outgoingEdgeType))
     {
         INode adjacentNode = edge.Target;
         if(!adjacentNode.InstanceOf(targetNodeType))
             continue;
         outgoingEdgesSet[edge] = null;
         if(graph.IsInternallyVisited(adjacentNode, threadId))
             continue;
         graph.SetInternallyVisited(adjacentNode, true, threadId);
         ReachableEdgesOutgoing(adjacentNode, outgoingEdgeType, targetNodeType, outgoingEdgesSet, graph, threadId);
     }
 }
开发者ID:jblomer,项目名称:GrGen.NET,代码行数:17,代码来源:GraphHelperParallel.cs

示例14: Outgoing

 /// <summary>
 /// Returns set of edges outgoing from the start node, under the type constraints given
 /// </summary>
 public static Dictionary<IEdge, SetValueType> Outgoing(INode startNode, EdgeType outgoingEdgeType, NodeType targetNodeType, int threadId)
 {
     Dictionary<IEdge, SetValueType> outgoingEdgesSet = new Dictionary<IEdge, SetValueType>();
     foreach(IEdge edge in startNode.GetCompatibleOutgoing(outgoingEdgeType))
     {
         INode adjacentNode = edge.Target;
         if(!adjacentNode.InstanceOf(targetNodeType))
             continue;
         outgoingEdgesSet[edge] = null;
     }
     return outgoingEdgesSet;
 }
开发者ID:jblomer,项目名称:GrGen.NET,代码行数:15,代码来源:GraphHelperParallel.cs

示例15: CountIncident

        //////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Returns count of the edges incident to the start node, under the type constraints given
        /// </summary>
        public static int CountIncident(INode startNode, EdgeType incidentEdgeType, NodeType adjacentNodeType, int threadId)
        {
            int count = 0;
            foreach(IEdge edge in startNode.GetCompatibleOutgoing(incidentEdgeType))
            {
                INode adjacentNode = edge.Target;
                if(!adjacentNode.InstanceOf(adjacentNodeType))
                    continue;
                ++count;
            }
            foreach(IEdge edge in startNode.GetCompatibleIncoming(incidentEdgeType))
            {
                INode adjacentNode = edge.Source;
                if(!adjacentNode.InstanceOf(adjacentNodeType))
                    continue;
                if(adjacentNode == startNode)
                    continue; // count reflexive edge only once
                ++count;
            }
            return count;
        }
开发者ID:jblomer,项目名称:GrGen.NET,代码行数:26,代码来源:GraphHelperParallel.cs


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