C# 클래스 SharpNeat.Network.CyclicNetworkTest

An algorithm for testing for the presence of at least one connectivity cycle within a network. Method. ======= 1) We loop over all nodes in the network and perform a depth-first traversal from each node. (Note. the order that the nodes are traversed does not affect the correctness of the method) 2) Each traversal keeps track of its ancestor nodes (the path to the current node) for each step in the traversal. Thus if the traversal encounters an ancestor node then a cycle has been detected. 3) A set of visited nodes is maintained. This persists between traversals and allows each traversal to avoid traversing into nodes that have already been traversed. Note. We must traverse from each node rather then just e.g. the input nodes, because the network may have connectivity dead ends or even isolated connectivity that therefore would not be traversed into by following connectivity from the input nodes only, hence we perform a traversal from each node and attempt to maintain algorithmic efficiency by avoiding traversal into nodes that have already been traversed into.
파일 보기 프로젝트 열기: colgreen/sharpneat 1 사용 예제들

공개 메소드들

메소드 설명
IsNetworkCyclic ( INetworkDefinition networkDef ) : bool

Returns true if there is at least one connectivity cycle within the provided INetworkDefinition.

IsNetworkCyclicInternal ( INetworkDefinition networkDef ) : bool

Returns true if there is at least one connectivity cycle within the provided INetworkDefinition.

비공개 메소드들

메소드 설명
CyclicNetworkTest ( ) : System.Collections.Generic

Private constructor. Prevents construction from outside of this class.

TraverseNode ( uint nodeId ) : bool

메소드 상세

IsNetworkCyclic() 공개 정적인 메소드

Returns true if there is at least one connectivity cycle within the provided INetworkDefinition.
public static IsNetworkCyclic ( INetworkDefinition networkDef ) : bool
networkDef INetworkDefinition
리턴 bool

IsNetworkCyclicInternal() 공개 메소드

Returns true if there is at least one connectivity cycle within the provided INetworkDefinition.
public IsNetworkCyclicInternal ( INetworkDefinition networkDef ) : bool
networkDef INetworkDefinition
리턴 bool