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

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

        return UNDEFINED;
}

static PRIMITIVE HyperBipartiteLayoutAnimCmd(SCM g, SCM gv)
{
        Graph *gr;
        if (!(gr = getGraph(g)))
                Err("bipartite-layout!: bad arg 1, graph expected", g);
        HyperBipartiteLayout(gr);
	char *vname = getViewName(gv);
	star_draw(vname);
	layoutVertices(vname);
	layoutEdges(vname);

        return UNDEFINED;
}

void gen_HyperBipartiteLayout_Wrapper()
{
        STk_add_new_cpp_primitive("bipartite-layout", tc_subr_1,
                               (PRIMITIVE (*)(...))HyperBipartiteLayoutCmd);
        STk_add_new_cpp_primitive("bipartite-layout*", tc_subr_2,
                               (PRIMITIVE (*)(...))HyperBipartiteLayoutAnimCmd);
}
