Sturk 1.1.0
Publish-subscribe C implementation.
Loading...
Searching...
No Matches
Vertegs

Vertegs is a library with C header files only that provide data types, macros and functions that operate on graphs.

All procedures are implemented for a vertex data type that stores a single pointer that points to the neighbourhood of the vertex. The graph template extends the vertex type with additional member of a type specified by the template parameter. The purpose of this template is to provide an interface for defining intrusive data structures.

vertegs-hierarchy
Vertegs hierarchy

Vertegs examples

List

Define a list data type

typedef SomeData MyData;
VX_LIST(struct MyList, MyData);
#define VX_LIST(name, type)
Define the list.
Definition list.h:67

List example "push"

void push(struct MyList** listp, MyData data)
{
struct MyList* entry = malloc(sizeof(*entry));
*vx_graph_datap(entry) = data;
*listp = vx_list_ins(*listp, entry);
}
#define vx_graph_datap(graph)
Get a pointer to the data member of a graph node.
Definition graph.h:126
#define vx_list_ins(list,...)
Insert, at a given position, an entry into a list.
Definition list.h:89

Cirq

Define a cirq data type

typedef SomeData MyData;
VX_CIRQ(struct MyCirq, MyData);
#define VX_CIRQ(name, type)
Define the cirq.
Definition cirq.h:67

Cirq example "push"

void push(struct MyCirq** headp, MyData data)
{
struct MyCirq* entry = malloc(sizeof(*entry));
*vx_graph_datap(entry) = data;
*headp = vx_cirq_ins(*headp, entry);
}
#define vx_cirq_ins(cirq,...)
Insert, at a given position, an entry into a cirq.
Definition cirq.h:81