optNetwork biconnectedComponents

Edge Case: Disconnected and Imperfect Infrastructure Graph

Scénario de test & Cas d'usage

Business Context

A city's water department is analyzing its pipe network from raw, potentially messy data. The network contains separate, unconnected water systems (e.g., for potable water and reclaimed water). The data may also contain errors like self-loops (a pipe connecting a junction to itself) and multi-links (multiple pipes recorded for the same two junctions).
About the Set : optNetwork

Network analysis and graph algorithms.

Discover all actions of optNetwork
Data Preparation

Creation of a dataset with two disconnected components, a self-link, and a multi-link to simulate imperfect data.

Copied!
1DATA mycas.WaterPipes;
2 INPUT from $ to $;
3 DATALINES;
4J1 J2
5J2 J3
6J3 J1 /* Component 1: A triangle */
7J4 J5 /* Component 2: A simple link */
8J6 J6 /* Self-link */
9J2 J3 /* Multi-link */
10;
11RUN;

Étapes de réalisation

1
Run the analysis with default settings, which should process self-links and multi-links.
Copied!
1PROC 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};
6RUN;
7QUIT;
2
Run the analysis again, but this time explicitly ignoring self-links and multi-links to see how it affects the results.
Copied!
1PROC 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};
8RUN;
9QUIT;
3
Compare the component assignments in both output link tables.
Copied!
1PROC CAS;
2 TABLE.fetch / TABLE={name='Pipes_Default'};
3 TABLE.fetch / TABLE={name='Pipes_Filtered'};
4RUN;
5QUIT;

Expected Result


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.