Find cycles

Parent Previous Next

This tool searches for cycles within the river network. A cycle is formed when the direction of one or more polylines causes a downstream search to revisit a polyline already visited in the search. Such cycles would affect the outcome of any processing such as stream ordering or site linking.


By removing cycles from a network you are ensuring that the river network is a Directed Acyclic Graph, this is a river network which has all polylines flowing in a downstream direction.


The tool works by starting at all nodes that are a bifurcation and traversing the network in a downstream direction until a mouth node is found. If the search downstream visits a polyline that had already been traversed then a cycle exists and this needs to be corrected. You would correct the cycle by flipping the orientation of a polyline to ensure its flowing in a source to sea (downstream) direction. Guidance on flipping a polyline is given here.


The output of this quality control tool is an error log file called cycles.txt.


Warning The error log file is recording the ID of the polyline that identifies if a cycle exists, it may not be the actual polyline that is causing the cycle


In the image below, polyline 226484 is reported in the error log. In ArcMap with direction of polyline visualized it is clear 246320 & 251608 are pointing in the upstream direction and require flipping. You must treat the ID's in the cycles.txt error log file as a pointer to the general location within the river network where a cycle is forming. The polylines that are actually causing the cycle are usually within a few segments of the reported polyline.



Which polylines actually need flipping


WarningFlipping a polyline alters the direction of the line but does not swap node values in the attribute table.  You must re-run RivEX and compute the new node ID values once all the polylines have been flipped. Using RivEX to update the nodes also updates the TopoCache.