C# Class 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.
ファイルを表示 Open project: colgreen/sharpneat Class Usage Examples

Public Methods

Method Description
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.

Private Methods

Method Description
CyclicNetworkTest ( ) : System.Collections.Generic

Private constructor. Prevents construction from outside of this class.

TraverseNode ( uint nodeId ) : bool

Method Details

IsNetworkCyclic() public static method

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

IsNetworkCyclicInternal() public method

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