The NETWORK Procedure

SHORTESTPATH Statement

  • SHORTESTPATH < options >;

The SHORTESTPATH statement invokes an algorithm that calculates shortest paths between pairs of nodes in the input graph. By default, PROC NETWORK finds a shortest path for each possible combination of source and sink nodes. For more information about the shortest path algorithm, see the section Shortest Path.

You can specify the following options:

MAXABSOBJGAP=number
MAXABSOLUTEOBJECTIVEGAP=number

specifies an acceptance criterion for the sum of link weights (CandidatePath) in paths relative to the sum of link weights in the shortest path (ShortestPath). The absolute objective gap is equal to

Any path whose absolute objective gap is greater than number is removed from the results. The value of number can be any nonnegative number. The default is the largest number that can be represented by a double. When the default is used, no paths are removed from the results.

MAXLINKWEIGHT=number
MAXPATHWEIGHT=number

specifies the maximum sum of link weights in a path. Any shortest path 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 paths are removed from the results.

MAXPATHSPERPAIR=number

specifies the maximum number of ranked paths to find for each source-sink pair. The algorithm finds at most number best paths between each source-sink pair. The paths that are returned are arranged in ascending order in the sum of link weights for each path. By default, MAXPATHSPERPAIR=1 and the algorithm finds one shortest path between each source-sink pair.

MAXRELOBJGAP=number
MAXRELATIVEOBJECTIVEGAP=number

specifies an acceptance criterion for the sum of link weights (CandidatePath) in paths relative to the sum of link weights in the shortest path (ShortestPath). The relative objective gap is equal to

Any path whose relative objective gap is greater than number is removed from the results. The value of number can be any nonnegative number. The default is the largest number that can be represented by a double. When the default is used, no paths are removed from the results.

MINLINKWEIGHT=number
MINPATHWEIGHT=number

specifies the minimum sum of link weights in a path. Any shortest path 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 paths are removed from the results.

OUTPATHSLINKS=CAS-libref.data-table
OUT=CAS-libref.data-table
OUTPATHS=CAS-libref.data-table

specifies the output data table to contain the shortest path links. CAS-libref.data-table is a two-level name, where CAS-libref refers to the caslib and session identifier, 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.

OUTPATHSNODES=CAS-libref.data-table

specifies the output data table to contain the shortest path nodes. CAS-libref.data-table is a two-level name, where CAS-libref refers to the caslib and session identifier, 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.

OUTSUMMARY=CAS-libref.data-table

specifies the output data table to contain descriptive statistics of the finite shortest paths for each source. CAS-libref.data-table is a two-level name, where CAS-libref refers to the caslib and session identifier, 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.

OUTWEIGHTS=CAS-libref.data-table

specifies the output data table to contain the total weight of the shortest path for each source-sink pair. CAS-libref.data-table is a two-level name, where CAS-libref refers to the caslib and session identifier, 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.

SEQUENCE=column

specifies which data variable in the nodes subset table defines the sequence of nodes to visit. The variable data type must be numeric. The values must define an ordering from lowest (visit first) to highest (visit last). The resulting path contains a node subsequence that matches the specified node sequence. You cannot use this SEQUENCE= option in combination with the SOURCE= or SINK= option in the SHORTESTPATH statement. In addition, the nodes subset table cannot contain a source or sink variable. To specify the source and sink nodes for the path, include them as the first and last nodes, respectively, in the sequence of nodes that you specify with the SEQUENCE= option.

SINK=sink-node

specifies the sink node for shortest path calculations. This setting overrides the use of the variable sink in the data table that you specify in the NODESSUBSET= option in the PROC NETWORK statement.

SOURCE=source-node

specifies the source node for shortest path calculations. This setting overrides the use of the variable source in the data table that you specify in the NODESSUBSET= option in the PROC NETWORK statement.

Last updated: June 11, 2021