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


C# IGraph.IsInternallyVisited方法代码示例

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


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

示例1: ReachableEdges

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

示例2: CountAdjacentIncoming

 /// <summary>
 /// Returns the count of the nodes adjacent to the start node via incoming edges, under the type constraints given
 /// </summary>
 public static int CountAdjacentIncoming(IGraph graph, INode startNode, EdgeType incidentEdgeType, NodeType adjacentNodeType, int threadId)
 {
     int count = 0;
     foreach(IEdge edge in startNode.GetCompatibleIncoming(incidentEdgeType))
     {
         INode adjacentNode = edge.Source;
         if(!adjacentNode.InstanceOf(adjacentNodeType))
             continue;
         if(graph.IsInternallyVisited(adjacentNode, threadId))
             continue;
         graph.SetInternallyVisited(adjacentNode, true, threadId);
         ++count;
     }
     foreach(IEdge edge in startNode.GetCompatibleIncoming(incidentEdgeType))
     {
         INode adjacentNode = edge.Source;
         if(!adjacentNode.InstanceOf(adjacentNodeType))
             continue;
         graph.SetInternallyVisited(adjacentNode, false, threadId);
     }
     return count;
 }
开发者ID:jblomer,项目名称:GrGen.NET,代码行数:25,代码来源:GraphHelperParallel.cs

示例3: IsReachableEdgesIncoming

        private static bool IsReachableEdgesIncoming(INode startNode, IEdge endEdge, EdgeType incomingEdgeType, NodeType sourceNodeType, IGraph graph, List<IGraphElement> visitedElems, IActionExecutionEnvironment actionEnv, int threadId)
        {
            bool result = false;

            foreach(IEdge edge in startNode.Incoming)
            {
                ++actionEnv.PerformanceInfo.SearchStepsPerThread[threadId];
                if(!edge.InstanceOf(incomingEdgeType))
                    continue;
                INode adjacentNode = edge.Source;
                if(!adjacentNode.InstanceOf(sourceNodeType))
                    continue;
                if(graph.IsInternallyVisited(edge, threadId))
                    continue;
                graph.SetInternallyVisited(edge, true, threadId);
                visitedElems.Add(edge);
                if(edge.Source == endEdge)
                    return true;

                if(graph.IsInternallyVisited(adjacentNode, threadId))
                    continue;
                graph.SetInternallyVisited(adjacentNode, true, threadId);
                visitedElems.Add(adjacentNode);
                result = IsReachableEdgesIncoming(adjacentNode, endEdge, incomingEdgeType, sourceNodeType, graph, visitedElems, actionEnv, threadId);
                if(result == true)
                    break;
            }

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

示例4: IsReachableOutgoing

        private static bool IsReachableOutgoing(INode startNode, INode endNode, EdgeType outgoingEdgeType, NodeType targetNodeType, IGraph graph, List<INode> visitedNodes, IActionExecutionEnvironment actionEnv, int threadId)
        {
            bool result = false;

            foreach(IEdge edge in startNode.Outgoing)
            {
                ++actionEnv.PerformanceInfo.SearchStepsPerThread[threadId];
                if(!edge.InstanceOf(outgoingEdgeType))
                    continue;
                INode adjacentNode = edge.Target;
                if(!adjacentNode.InstanceOf(targetNodeType))
                    continue;
                if(graph.IsInternallyVisited(adjacentNode, threadId))
                    continue;
                if(edge.Target == endNode)
                    return true;
                graph.SetInternallyVisited(adjacentNode, true, threadId);
                visitedNodes.Add(adjacentNode);
                result = IsReachableOutgoing(adjacentNode, endNode, outgoingEdgeType, targetNodeType, graph, visitedNodes, actionEnv, threadId);
                if(result == true)
                    break;
            }

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

示例5: 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


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