本文整理汇总了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).");
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例6: GetNextLineNode
private INode GetNextLineNode(INode current)
{
foreach (IEdge nextEdge in current.GetCompatibleOutgoing(nextLineType))
{
return nextEdge.Target;
}
return null;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}