Scénario de test & Cas d'usage
Network analysis and graph algorithms.
Discover all actions of optNetworkCreation of a dataset with two disconnected components, a self-link, and a multi-link to simulate imperfect data.
| 1 | DATA mycas.WaterPipes; |
| 2 | INPUT from $ to $; |
| 3 | DATALINES; |
| 4 | J1 J2 |
| 5 | J2 J3 |
| 6 | J3 J1 /* Component 1: A triangle */ |
| 7 | J4 J5 /* Component 2: A simple link */ |
| 8 | J6 J6 /* Self-link */ |
| 9 | J2 J3 /* Multi-link */ |
| 10 | ; |
| 11 | RUN; |
| 1 | PROC CAS; |
| 2 | ACTION optNetwork.biconnectedComponents / |
| 3 | links={name='WaterPipes'} |
| 4 | outLinks={name='mycas.Pipes_Default', replace=true} |
| 5 | outNodes={name='mycas.Junctions_Default', replace=true}; |
| 6 | RUN; |
| 7 | QUIT; |
| 1 | PROC CAS; |
| 2 | ACTION optNetwork.biconnectedComponents / |
| 3 | links={name='WaterPipes'} |
| 4 | selfLinks=FALSE |
| 5 | multiLinks=FALSE |
| 6 | outLinks={name='mycas.Pipes_Filtered', replace=true} |
| 7 | outNodes={name='mycas.Junctions_Filtered', replace=true}; |
| 8 | RUN; |
| 9 | QUIT; |
| 1 | PROC CAS; |
| 2 | TABLE.fetch / TABLE={name='Pipes_Default'}; |
| 3 | TABLE.fetch / TABLE={name='Pipes_Filtered'}; |
| 4 | RUN; |
| 5 | QUIT; |
The action should correctly identify two main biconnected components corresponding to the two disconnected water systems. In the first run, the self-link on J6 will form its own biconnected component. In the second run, this J6 component will disappear. The multi-link between J2 and J3 will be treated as a single link in the second run. This demonstrates the action's ability to handle disconnected graphs and validates the behavior of the `selfLinks` and `multiLinks` parameters.