/ *
Algorithm Description: The algorithm of this implementation is the FLOYED algorithm, matrix Matrix storage source node to other nodes
The shortest path, and result stores the return result - the routing table.
Parameter Description:
_NetArray: Routnum * Routnum matrix, network topology information
_Valarray: Routnum * Routnum matrix, network dissipation information
Result: RoutNum * 2 matrix, routing table - return
ROUTNUM: Number of routers
Index: Source Routor
* /
Void __declspec (dllexport) computemethods (int ** _ netArray, int ** _Valarray
, int ** & result, int routnum, int index
{
//
INT ** Matrix = 0;
Bool bval = true;
Matrix = new int * [routnum];
For (int i = 0; i Matrix [i] = new int [routnum]; For (int i = 0; i For (int J = 0; j Matrix [i] [j] = _Valarray [i] [j]; For (int i = 0; i Result [i] [0] = - 1; Result [i] [1] = - 1; } While (True) { For (int K = 0; k For (int i = 0; i For (int J = 0; j { IF (Matrix [i] [j]> = (Matrix [i] [k] matrix [k] [j])) { Matrix [i] [j] = matrix [i] [k] matrix [k] [j]; IF (i == Index && _netArray [i] [k] == 1) { IF (i! = k || K == J) { Result [j] = j; Result [J] = K; } } } // end of if } // End of for For (int i = 0; i Bval = BVAL && (Result [i] [0]! = - 1) && (Result [i] [1]! = - 1); IF (BVAL) Break; Else BVAL = true; } // end of while Matrix; }