The cycle action calculates the elementary cycles (simple circuits) of a graph. A cycle is a path that starts and ends at the same node and visits other nodes at most once. This action supports both directed and undirected graphs and provides options to filter cycles based on their length (number of links) or total weight. It is widely used in fraud detection, process analysis, and circular dependency resolution.
| Parameter | Description |
|---|---|
| direction | Specifies whether the graph is directed or undirected. Default is UNDIRECTED. |
| links | Specifies the input data table that contains the graph link information (edges). |
| nodes | Specifies the input data table that contains the graph node information. |
| maxCycles | Specifies the maximum number of cycles to return. The default is 1. Set to 'ALL' to find all cycles. |
| minLength | Specifies the minimum number of links required for a cycle to be included in the results. |
| maxLength | Specifies the maximum number of links allowed for a cycle to be included in the results. |
| out | Specifies the output data table to contain the nodes of the identified cycles. |
| outCyclesLinks | Specifies the output data table to contain the links of the identified cycles. |
Creates a dataset defining a directed graph with two potential cycles: A-B-C-A (total weight 6) and A-D-C-A (total weight 18).
| 1 | DATA mycas.LinkSetIn; |
| 2 | INPUT from $ to $ weight; |
| 3 | DATALINES; |
| 4 | A B 1 |
| 5 | B C 2 |
| 6 | C A 3 |
| 7 | A D 10 |
| 8 | D C 5 |
| 9 | ; |
| 10 | RUN; |
Detects a cycle in the directed graph using default settings (returns the first cycle found).
| 1 | PROC CAS; |
| 2 | optNetwork.cycle RESULT=r STATUS=s / |
| 3 | direction="DIRECTED", |
| 4 | links={name="LinkSetIn"}, |
| 5 | out={name="CyclesNodes", replace=true}, |
| 6 | outCyclesLinks={name="CyclesLinks", replace=true}; |
| 7 | RUN; |
Finds all cycles that meet a specific weight criteria (total weight >= 10) by using the 'minLinkWeight' parameter.
| 1 | PROC CAS; |
| 2 | optNetwork.cycle RESULT=r STATUS=s / |
| 3 | direction="DIRECTED", |
| 4 | links={name="LinkSetIn"}, |
| 5 | maxCycles="ALL", |
| 6 | minLinkWeight=10, |
| 7 | out={name="HeavyCycles", replace=true}; |
| 8 | RUN; |
A banking institution needs to identify 'smurfing' or circular money laundering patterns where funds are transferred through a series of accounts and return to the originator (e...
A car manufacturer wants to validate the Bill of Materials (BOM) for a new vehicle. With thousands of parts, they must ensure no process inadvertently waits for itself (Infinite...
In a microservices architecture, mapping dependencies is crucial. The goal is to find 'Deadlocks' where a service waits for itself (Self-Link) or two services wait for each othe...