本文整理汇总了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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}