NETWORK Procedure

CYCLE Statement

  • CYCLE < options >;

The CYCLE statement invokes an algorithm that finds the cycles (or the existence of a cycle) in the input graph. For more information about cycles, see the section Cycle Enumeration.

You can specify the following options:

ALGORITHM=BACKTRACK | BUILD

specifies which algorithm to use in enumerating cycles. You can specify the following values:

BACKTRACK

uses a backtracking algorithm based on Johnson (1975).

BUILD

uses a building algorithm based on Liu and Wang (2006).

By default, ALGORITHM=BACKTRACK for a MAXLENGTH= option value greater than 20; otherwise, ALGORITHM=BUILD.

MAXCYCLES=number | ALL

specifies the maximum number of cycles for cycle enumeration to return. You can specify either a number (any 64-bit integer greater than or equal to 1) or ALL (the maximum value that can be represented by a 64-bit integer). By default, MAXCYCLES=1.

MAXLENGTH=number

specifies the maximum number of links in a cycle. Any cycle whose length is greater than number is removed from the results. The default is the largest number that can be represented by a 32-bit integer. When the default is used, no cycles are removed from the results.

MAXLINKWEIGHT=number

specifies the maximum sum of link weights in a cycle. Any cycle whose sum of link weights is greater than number is removed from the results. The default is the largest number that can be represented by a double. When the default is used, no cycles are removed from the results.

MAXNODEWEIGHT=number

specifies the maximum sum of node weights in a cycle. Any cycle whose sum of node weights is greater than number is removed from the results. The default is the largest number that can be represented by a double. When the default is used, no cycles are removed from the results.

MAXTIME=number

specifies the maximum amount of time to spend finding cycles. The type of time (either CPU time or real time) is determined by the value of the TIMETYPE= option in the PROC NETWORK statement. The default is the largest number that can be represented by a double.

MINLENGTH=number

specifies the minimum number of links in a cycle. Any cycle that has fewer links than number is removed from the results. By default, MINLENGTH=1 and no cycles are removed from the results.

MINLINKWEIGHT=number

specifies the minimum sum of link weights in a cycle. Any cycle whose sum of link weights is less than number is removed from the results. The default is the largest (in magnitude) negative number that can be represented by a double. When the default is used, no cycles are removed from the results.

MINNODEWEIGHT=number

specifies the minimum sum of node weights in a cycle. Any cycle whose sum of node weights is less than number is removed from the results. The default is the largest (in magnitude) negative number that can be represented by a double, which causes no cycles to be removed from the results.

OUTCYCLESLINKS=libref.data-table

specifies the output data table to contain the links of the cycles found. libref.data-table is a two-level name, where libref refers to the library, and data-table specifies the name of the output data table. For more information about this two-level name, see the section Using CAS Sessions and CAS Engine Librefs in Chapter 1, Introduction.

OUTCYCLESNODES=libref.data-table
OUT=libref.data-table

specifies the output data table to contain the nodes of the cycles found. libref.data-table is a two-level name, where libref refers to the library, and data-table specifies the name of the output data table. For more information about this two-level name, see the section Using CAS Sessions and CAS Engine Librefs in Chapter 1, Introduction.

SOURCE=source-node

specifies the source node for cycle calculations.

Last updated: February 09, 2026