Optical Network Design and Planning

The C-code for several useful routing functions is provided in this appendix. The first set of routines uses the Breadth-First-Search method to find a shortest path between a source and a destination. The code for these routines follows the algorithm outlined in [Bhan99]. The second set of routines finds the K-shortest paths between a source and a destination. This code follows the equivalence method of [HeMS03]. The final set of routines finds N mutually disjoint paths between a source and a destination. This follows the algorithm outlined in [Bhan99]. Various parameters can be set to indicate whether the paths should be link-disjoint or link-and-node-disjoint. In scenarios where N mutually disjoint paths do not exist, the function can be used to find the N maximally disjoint paths.
For the most part, memory is pre-allocated for the routines, as this tends to run faster. The maximum size of the network can be adjusted if necessary by redefining the appropriate parameters, which appear at the start of the code.
A small main function is provided to demonstrate how to specify the network topology and how to call the three major routines.
Minimal amount of error checking has been added.
DISCLAIMER: NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED. YOU USE THE CODE AT YOUR OWN RISK. IN NO EVENT SHALL THE AUTHOR, THE AGENTS OF THE AUTHOR, OR THE PUBLISHER BE LIABLE FOR DATA LOSS, LOSS OF PROFITS, LOSS OF BENEFITS, OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES WHILE USING THIS CODE.