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


C# INode.GetCompatibleIncoming方法代码示例

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


在下文中一共展示了INode.GetCompatibleIncoming方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: CountIncoming

 /// <summary>
 /// Returns count of the edges incoming to the start node, under the type constraints given
 /// </summary>
 public static int CountIncoming(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;
         ++count;
     }
     return count;
 }
开发者ID:jblomer,项目名称:GrGen.NET,代码行数:15,代码来源:GraphHelperParallel.cs

示例4: CountAdjacentIncoming

 public static int CountAdjacentIncoming(IGraph graph, INode startNode, EdgeType incidentEdgeType, NodeType adjacentNodeType, IActionExecutionEnvironment actionEnv, int threadId)
 {
     int count = 0;
     foreach(IEdge edge in startNode.Incoming)
     {
         ++actionEnv.PerformanceInfo.SearchStepsPerThread[threadId];
         if(!edge.InstanceOf(incidentEdgeType))
             continue;
         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

示例5: Incoming

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

示例6: BoundedReachableEdgesIncomingRec

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

示例7: BoundedReachableRec

 private static IEnumerable<INode> BoundedReachableRec(INode startNode, int depth, EdgeType incidentEdgeType, NodeType adjacentNodeType, IGraph graph, Dictionary<INode, int> adjacentNodesToMinDepth, 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;
         int nodeDepth;
         if(!adjacentNodesToMinDepth.TryGetValue(adjacentNode, out nodeDepth))
             yield return adjacentNode;
         if(adjacentNodesToMinDepth.TryGetValue(adjacentNode, out nodeDepth) && nodeDepth >= depth - 1)
             continue;
         adjacentNodesToMinDepth[adjacentNode] = depth - 1;
         foreach(INode node in BoundedReachableRec(adjacentNode, depth - 1, incidentEdgeType, adjacentNodeType, graph, adjacentNodesToMinDepth, actionEnv, threadId))
             yield return node;
     }
     foreach(IEdge edge in startNode.GetCompatibleIncoming(incidentEdgeType))
     {
         ++actionEnv.PerformanceInfo.SearchStepsPerThread[threadId];
         INode adjacentNode = edge.Source;
         if(!adjacentNode.InstanceOf(adjacentNodeType))
             continue;
         int nodeDepth;
         if(!adjacentNodesToMinDepth.TryGetValue(adjacentNode, out nodeDepth))
             yield return adjacentNode;
         if(adjacentNodesToMinDepth.TryGetValue(adjacentNode, out nodeDepth) && nodeDepth >= depth - 1)
             continue;
         adjacentNodesToMinDepth[adjacentNode] = depth - 1;
         foreach(INode node in BoundedReachableRec(adjacentNode, depth - 1, incidentEdgeType, adjacentNodeType, graph, adjacentNodesToMinDepth, actionEnv, threadId))
             yield return node;
     }
 }
开发者ID:jblomer,项目名称:GrGen.NET,代码行数:35,代码来源:GraphHelperParallel.cs

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

示例9: ReachableEdgesIncomingRec

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

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

示例10: IsReachableEdgesIncoming

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

            foreach(IEdge edge in startNode.GetCompatibleIncoming(incomingEdgeType))
            {
                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, threadId);
                if(result == true)
                    break;
            }

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

示例11: IsIncoming

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

示例12: IsAdjacent

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

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

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

示例14: Adjacent

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

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


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