Writing Layout Plugins

I read writing-layout-plugins guide and I can’t find functions like setEdgeType, common_init_node, gv_nodesize etc in /usr/include/graphviz (both in versions 2.44 and 13.1) (but nm -D /usr/lib/x86_64-linux-gnu/libgvc.so | grep setEdgeType shows that they are present in libgvc.so). (Also I find they in lib/gvc/gvc.def but it is for windows)

Can I use they? Should I find and copy definitions of they from graphviz sources or just include headrs from graphviz sources? What is best practices for writing layout plugins?

Also Is there any documentation for these functions?

Also how properly register my plugin? I’ve tried:

#include <graphviz/gvc.h>
#include <graphviz/gvplugin_layout.h>
#include <graphviz/cgraph.h>
//#include "my_gvc.h"
extern int common_init_edge(edge_t * e);
extern void common_init_node(node_t * n);
extern void gv_cleanup_edge(Agedge_t * e);
extern void gv_cleanup_node(Agnode_t * n);

static void
nop1_5_init_node(node_t * n)
{
  common_init_node(n);
  /* add algorithm-specific data, if desired */
}

static void
nop1_5_init_edge(edge_t * e)
{
  common_init_edge(e);
  /* add algorithm-specific data, if desired */
}

static void
nop1_5_init_node_edge(graph_t * g)
{
  for (node_t *n = agfstnode(g); n; n = agnxtnode(g, n)) {
      nop1_5_init_node(n);
  }
  for (node_t *n = agfstnode(g); n; n = agnxtnode(g, n)) {
      for (edge_t *e = agfstout(g, n); e; e = agnxtout(g, e)){
          nop1_5_init_edge(e);
      }
  }
}

void
nop1_5_layout (Agraph_t* g)
{
  nop1_5_init_node_edge(g);
  /* Set ND_pos(n) for each node n */
  //spline_edges(g);
  //dotneato_postprocess(g);
}

static void nop1_5_cleanup_graph(Agraph_t * g)
{
  /* Free any algorithm-specific data attached to the graph */
  //if (g != g->root) memset(&g->u, 0, sizeof(Agraphinfo_t));  // what is g->u ???
}

static void xxx_cleanup_edge (Agedge_t* e)
{
  /* Free any algorithm-specific data attached to the edge */
  gv_cleanup_edge(e);
}

static void xxx_cleanup_node (Agnode_t* n)
{
  /* Free any algorithm-specific data attached to the node */
  gv_cleanup_node(n);
}

void nop1_5_cleanup(Agraph_t * g)
{
  for (Agnode_t *n = agfstnode(g); n; n = agnxtnode(g, n)) {
      for (Agedge_t *e = agfstout(g, n); e; e = agnxtout(g, e)) {
          gv_cleanup_edge(e);
      }
      gv_cleanup_node(n);
  }
  //gv_cleanup_graph(g);
}   

typedef enum { LAYOUT_NOP1_5 } layout_type;

static gvlayout_features_t nop1_5gen_features = {
    0
};
gvlayout_engine_t nop1_5gen_engine = {
    nop1_5_layout,
    nop1_5_cleanup,
};
static gvplugin_installed_t gvlayout_nop1_5_types[] = {
    {LAYOUT_NOP1_5, "nop1_5", 0, &nop1_5gen_engine, &nop1_5gen_features},
    {0}
};
static gvplugin_api_t apis[] = {
    {API_layout, gvlayout_nop1_5_types},  // remove & before gvlayout_nop1_5_types
    {0},
};
gvplugin_library_t gvplugin_nop1_5_layout_LTX_library = { "nop1_5_layout", apis };
gcc -fPIC -shared -I/usr/include/graphviz -o libgvplugin_nop1_5.so nop1_5_layout.c -lgvc -lcgraph -lcdt
sudo cp libgvplugin_nop1_5.so /usr/lib/x86_64-linux-gnu/graphviz/
sudo dot -c
neato -K nop1_5 test.dot -Tsvg -o test.svg

There is no layout engine support for "nop1_5"
Use one of: circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi

System version is 2.33. Same behavior with version 13.1.

OK, I’ve read is_plugin() from gvconfig.c and gvplugin_library_load() from gvplugin.c. For version 13.1:
I should use libgvplugin_nop1_5.so.8 instead gvplugin_nop1_5.so
and in my nop1_5_layout.c I shoud define gvplugin_nop1_5_LTX_library insead gvplugin_nop1_5_layout_LTX_library.

But now I get:

$ neato -v -K nop1_5 test.dot -Tsvg -o test.svg
libgvplugin_pango.so.8
neato - graphviz version 13.1.0 (20250701.0955)
libdir = "/home/feelus/repos/graphviz-13-1/build/../inst/lib/graphviz"
libgvplugin_nop1_5.so.8
Activated plugin library: libgvplugin_nop1_5.so.8
Using layout: nop1_5:nop1_5_layout
libgvplugin_core.so.8
Activated plugin library: libgvplugin_core.so.8
Using render: svg:core
Using device: svg:svg:core
The plugin configuration file:
        /home/feelus/repos/graphviz-13-1/build/../inst/lib/graphviz/config8
                was successfully loaded.
    render      :  cairo dot dot_json fig gd json json0 map pic pov ps svg svg_inline tk vrml xdot xdot_json
    layout      :  circo dot fdp neato nop nop1 nop1_5 nop2 osage patchwork sfdp twopi
    textlayout  :  textlayout
    device      :  bmp canon cmap cmapx cmapx_np dot dot_json eps fig gd gd2 gif gv ico imap imap_np ismap jpe jpeg jpg json json0 kitty kittyz pdf pic plain plain-ext png pov ps ps2 svg svg_inline svgz tif tiff tk vrml vt vt-24bit vt-4up vt-6up vt-8up wbmp webp x11 xdot xdot1.2 xdot1.4 xdot_json xlib
    loadimage   :  (lib) bmp eps gd gd2 gif ico jpe jpeg jpg png ps svg webp xbm
fontname: "Times-Roman" resolved to: (ps:pango  DejaVu Serif, ) (PangoCairoFcFont) "DejaVu Serif, Book" /usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf
segmetation fault (core dumped)