Network Action Set

Finding the Block-Cut Tree of an Undirected Graph

This section contains PROC CAS code.

Note: Input data must be accessible in your CAS session, either as a CAS table or as a transient-scope table. A CAS table has a two-level name: the first level is your CAS engine libref, and the second level is the table name. You refer to this table in the CAS procedure by specifying only the second level. For more information about two-level names, see Chapter 2, Shared Concepts (SAS Viya: Machine Learning Procedures). A transient-scope table is called directly from the action and exists in memory for the duration of the action. For more information about accessing data, see SAS Viya: System Programming Guide. For more information about PROC CAS and programming in CASL, see SAS Cloud Analytic Services: CASL Programmer’s Guide and SAS Cloud Analytic Services: CASL Reference.

Consider again the undirected graph shown in Figure 1, which is represented by the links data table LinkSetIn. The statements that define the LinkSetIn data table are listed in Example 28.1. The following statements calculate the block-cut tree and output the results in the data tables BCTreeNodesOut and BCTreeLinksOut. To indicate the mapping to the original node labels, the bcTree_node variable is added to the NodeSetOut data table.

proc cas;
   loadactionset "network";
   action network.biconnectedComponents result=r status=s /
      indexOffset    = 1
      links          = {name = "LinkSetIn"}
      outNodes       = {name = "NodeSetOut", replace="true"}
      outLinks       = {name = "LinkSetOut", replace="true"}
      outBCTreeNodes = {name = "BCTreeNodesOut", replace="true"}
      outBCTreeLinks = {name = "BCTreeLinksOut", replace="true"};
   run;
   print r.ProblemSummary; run;
   print r.SolutionSummary; run;
   action table.fetch / table = "NodeSetOut" sortBy = "node"; run;
   action table.fetch / table = "BCTreeNodesOut" sortBy = "node"; run;
   action table.fetch / table = "BCTreeLinksOut" sortBy = {"from","to"}; run;
quit;

The problem summary output from this action is shown in Output 28.2.1.

Output 28.2.1: Problem Summary

Problem Summary
Number of Nodes9
Number of Links11
Graph DirectionUndirected


The solution summary output from this action is shown in Output 28.2.2.

Output 28.2.2: Solution Summary

Solution Summary
Problem TypeBiconnected Components
Solution StatusOK
Number of Components4
Number of Articulation Points3
CPU Time0.00
Real Time0.00


The BCTreeNodesOut output data table contains the nodes in the block-cut tree, as shown in Output 28.2.3.

Output 28.2.3: Block-Cut Tree Nodes Data Table

Selected Rows from Table BCTREENODESOUT
_Index_nodeartpoint
1a_1A
2a_2B
3a_3G
4b_1 
5b_2 
6b_3 
7b_4 


The BCTreeLinksOut output data table contains the links in the block-cut tree, as shown in Output 28.2.4.

Output 28.2.4: Block-Cut Tree Links Data Table

Selected Rows from Table BCTREELINKSOUT
_Index_fromto
1a_1b_1
2a_1b_2
3a_2b_1
4a_2b_3
5a_3b_2
6a_3b_4


The NodeSetOut output data table contains the articulation points of the input graph as well as the bcTree_node variable, which indicates the map from nodes in the original graph to nodes in the block-cut tree, as shown in Output 28.2.5.

Output 28.2.5: Articulation Points and Block-Cut Tree Node Mappings

Selected Rows from Table NODESETOUT
_Index_nodeartpointbcTree_node
1A1a_1
2B1a_2
3C0b_3
4D0b_3
5E0b_1
6F0b_1
7G1a_3
8H0b_4
9I0b_4


The block-cut tree is shown graphically in Figure 2.

Figure 2: Block-Cut Tree of the Undirected Graph G

Block-Cut Tree of the Undirected Graph


Finding the Block-Cut Tree of an Undirected Graph

This section contains Lua code for the analysis in the CASL version of this example, which contains details about the results.

Note: In order to run this code, the data that are described in the CASL version need to be accessible to the CAS server. One way to do this is to convert the LinkSetIn data to the comma-separated-value (CSV) file LinkSetIn.csv and then use the following code to load the CSV file into CAS:

s:loadtable{casLib="casuser", path="LinkSetIn.csv"}

For more information about coding in Lua, see Getting Started with SAS Viya for Lua and SAS Viya: System Programming Guide.

The following statements calculate the biconnected components and articulation points for G and output the results in the data tables LinkSetOut and NodeSetOut:

s:network_biconnectedComponents{
   indexOffset    = 1,
   links          = {name = "LinkSetIn"},
   outNodes       = {name = "NodeSetOut", replace=true},
   outLinks       = {name = "LinkSetOut", replace=true},
   outBCTreeNodes = {name = "BCTreeNodesOut", replace=true},
   outBCTreeLinks = {name = "BCTreeLinksOut", replace=true}}

Finding the Block-Cut Tree of an Undirected Graph

This section contains Python code for the analysis in the CASL version of this example, which contains details about the results.

Note: In order to run this code, the data that are described in the CASL version need to be accessible to the CAS server. One way to do this is to convert the LinkSetIn data to the comma-separated-value (CSV) file LinkSetIn.csv and then use the following code to load the CSV file into CAS:

s.upload_file('LinkSetIn.csv')

For more information about coding in Python, see Getting Started with SAS Viya for Python and SAS Viya: System Programming Guide.

The following statements calculate the biconnected components and articulation points for G and output the results in the data tables LinkSetOut and NodeSetOut:

s.network.biconnectedComponents(
    indexOffset    = 1,
    links          = {"name":"LinkSetIn"},
    outNodes       = {"name":"NodeSetOut", "replace":True},
    outLinks       = {"name":"LinkSetOut", "replace":True},
    outBCTreeNodes = {"name":"BCTreeNodesOut", "replace":True},
    outBCTreeLinks = {"name":"BCTreeLinksOut", "replace":True})

Finding the Block-Cut Tree of an Undirected Graph

This example is not available for the R programming language.

Last updated: September 01, 2026