Sturk 1.0.2
Publish-subscribe C implementation.
|
Graph. More...
#include "vx/vertegs.h"
Go to the source code of this file.
Macros | |
#define | VX_TYPEOF(var) __typeof__(var) |
Get the type of a variable. | |
#define | VX_GRAPH(name, deg, type) |
Define the graph. | |
#define | vx_graph_2vx(graph) (0 ? (struct Vertegs*)(graph)->vx_graph_nbor : (struct Vertegs*)(graph)) |
Cast to generic vertex from a graph node. | |
#define | vx_graph_4vx(v, graph) |
Cast from a generic vertex to a graph node. | |
#define | vx_graphp_2vxp(graphp) (0 ? (*(graphp))->vx_graph_nbor : (struct Vertegs**)(graphp)) |
Cast to generic vertex double pointer from a graph node double pointer. | |
#define | vx_graph_datap(graph) (&(graph)->vx_graph_data) |
Get a pointer to the data member of a graph node. | |
#define | vx_graph_foredge(type, i, graphp, edge) for (type** i = graphp; *i; i = (type**)&(*i)->vx_graph_nbor[edge]) |
Traverse a graph. | |
Graph.
#define VX_GRAPH | ( | name, | |
deg, | |||
type | |||
) |
Define the graph.
[in] | name | The name of the type used for the graph. |
[in] | deg | The degree of vertices - the number of neighbours. |
[in] | type | The type of the data held by name. |
This macro will define a compound type (must be struct or union) name, a type for a graph entry that holds the data of the type type.
#define vx_graph_2vx | ( | graph | ) | (0 ? (struct Vertegs*)(graph)->vx_graph_nbor : (struct Vertegs*)(graph)) |
Cast to generic vertex from a graph node.
[in] | graph | The graph node. |
#define vx_graph_4vx | ( | v, | |
graph | |||
) |
#define vx_graph_datap | ( | graph | ) | (&(graph)->vx_graph_data) |
Get a pointer to the data member of a graph node.
[in] | graph | The graph node. |
#define vx_graph_foredge | ( | type, | |
i, | |||
graphp, | |||
edge | |||
) | for (type** i = graphp; *i; i = (type**)&(*i)->vx_graph_nbor[edge]) |
Traverse a graph.
Traverse the graph of type type referenced by graphp along the edges of of index edge, assigning every node in turn to i.
#define vx_graphp_2vxp | ( | graphp | ) | (0 ? (*(graphp))->vx_graph_nbor : (struct Vertegs**)(graphp)) |
Cast to generic vertex double pointer from a graph node double pointer.
[in] | graphp | The graph node double pointer. |
#define VX_TYPEOF | ( | var | ) | __typeof__(var) |
Get the type of a variable.