#include<stk.h>
#include<strstream.h>
#include<LINK/stkWrapper/LINK_STk.h>
#include<LINK/layout/Layouts.h>
#include<LINK/algorithm/Algorithms.h>
#include<LINK/graph/Graph.h>

static PRIMITIVE RandomLayoutCmd(SCM g)
{
        Graph *gr;
        if (!(gr = getGraph(g)))
                Err("circle-layout!: bad arg 1, graph expected", g);
        RandomLayout(gr);

        return UNDEFINED;
}

static PRIMITIVE RandomLayoutAnimCmd(SCM g, SCM gv)
{
        Graph *gr;
        if (!(gr = getGraph(g)))
                Err("circle-layout!: bad arg 1, graph expected", g);
        RandomLayout(gr);
	char *vname = getViewName(gv);
	path_draw(vname);
	layoutVertices(vname);

        return UNDEFINED;
}

void gen_RandomLayout_Wrapper()
{
        STk_add_new_cpp_primitive("random-layout", tc_subr_1,
                               (PRIMITIVE (*)(...))RandomLayoutCmd);
        STk_add_new_cpp_primitive("random-layout*", tc_subr_2,
                               (PRIMITIVE (*)(...))RandomLayoutAnimCmd);
}
