Graph.
More...
Go to the source code of this file.
|
| #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.
|
| |
|
|
static const struct VxGraphEmpty * | VX_GRAPH_EMPTY |
| | Empty graph - null pointer.
|
| |
◆ VX_GRAPH
| #define VX_GRAPH |
( |
|
name, |
|
|
|
deg, |
|
|
|
type |
|
) |
| |
Value: name \
{ \
struct Vertegs* vx_graph_nbor[deg]; \
type vx_graph_data; \
}
The data type for a graph vertex.
Definition vertex.h:80
Define the graph.
- Parameters
-
| [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.
◆ vx_graph_2vx
| #define vx_graph_2vx |
( |
|
graph | ) |
(0 ? (struct Vertegs*)(graph)->vx_graph_nbor : (struct Vertegs*)(graph)) |
Cast to generic vertex from a graph node.
- Parameters
-
- Returns
- The vertex.
◆ vx_graph_4vx
| #define vx_graph_4vx |
( |
|
v, |
|
|
|
graph |
|
) |
| |
Value: (0 ? (
VX_TYPEOF(graph))((graph)->vx_graph_nbor[0] = (v)->nbor[0]) \
#define VX_TYPEOF(var)
Get the type of a variable.
Definition graph.h:56
Cast from a generic vertex to a graph node.
- Parameters
-
| [in] | v | The vertex. |
| [in] | graph | A variable of the same type as the graph node. |
- Returns
- The graph node.
◆ vx_graph_datap
| #define vx_graph_datap |
( |
|
graph | ) |
(&(graph)->vx_graph_data) |
Get a pointer to the data member of a graph node.
- Parameters
-
- Returns
- The pointer to the data.
◆ vx_graph_foredge
| #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 index edge, assigning every node in turn to i.
◆ vx_graphp_2vxp
| #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.
- Parameters
-
| [in] | graphp | The graph node double pointer. |
- Returns
- The vertex double pointer.
◆ VX_TYPEOF
| #define VX_TYPEOF |
( |
|
var | ) |
__typeof__(var) |
Get the type of a variable.
- Note
- For strict ansi build this always returns a void pointer.
◆ vx_graph_empty()
| static inline const struct VxGraphEmpty * vx_graph_empty |
( |
void |
| ) |
|
|
inlinestatic |
Return an empty graph.
- Returns
- The empty graph.