Next: Edge Up: VertexMethods Previous: Integrating the Source Files

### Wrapping the New Algorithm into the Interface

Once the algorithm has been written and integrated into LINK's C++ libraries, programmers will be able to use it to build new C++ programs; however, the real power of LINK is its computing environment, so new algorithms should be wrapped into the latter so that they can be called from the command-line and graphical interfaces. Example wrappers are shown above in Figures and , and a similar wrapper should be written for our new algorithm. Since we are adding a fundamental graph algorithm (as opposed to a graph generating or layout algorithm), its wrapper belongs in the
`$LINK\_BASE/src/algorithm/manualSTkWrappers`
directory. Once the file is there, we must update the `Make.algorithmWrappers` file to include our new wrapper file in the ``SOURCES.cpp'' macro. The wrapper file must contain a function to create the new STk commands which will call our algorithm (for example, see the function called gen_Random_Wrapper() in Figure . We must now arrange for this function to be called. This is done by editing the file `$LINK\_BASE/src/wrappers/algorithmSTkInit.cpp` to make the appropriate call. This file simply contains prototypes for and calls to each wrapper generating function. Figure shows the contents of this file at the time of this writing.

Figure 2.6: algorithmSTkInit.cpp

The functions STk_algorithm_init() and STk_algorithm_cleanup are called at the beginning and ending, respectively of a LINK session.

Next: Edge Up: VertexMethods Previous: Integrating the Source Files