#include<stk.h>
#include<LINK/stkWrapper/LINK_STk.h>
#include<LINK/stkWrapper/Wrapper.h>
#include<LINK/algorithm/Algorithms.h>
#include<LINK/basic/Matrix.h>
#include<LINK/graph/Graph.h>

#include <stdio.h>
#include <stdlib.h>

static PRIMITIVE FloydWarshallCmd(SCM g)
{
        Graph *gr;
        if (!(gr = getGraph(g)))
                Err("floyd-warshall: bad arg 1, graph expected", g);
        Matrix<double> m = FloydWarshall(gr);
        Matrix<double>* mp = new Matrix<double>(m);

        return STk_make_CXXwrapper(Wrapper<Matrix<double> >::type,
                Wrapper<Matrix<double> >::name, (void *) mp, LINK_DYNAMIC);
}

void gen_FloydWarshall_Wrapper()
{
        STk_add_new_cpp_primitive("floyd-warshall", tc_subr_1,
                               (PRIMITIVE (*)(...))FloydWarshallCmd);
}
