This example shows how to construct a graph from its vertices and edges
27#include <easy3d/core/graph.h>
28#include <easy3d/util/initializer.h>
39int main(
int argc,
char** argv) {
44 auto graph =
new Graph;
53 graph->add_edge(v0, v1);
54 graph->add_edge(v1, v2);
55 graph->add_edge(v2, v3);
56 graph->add_edge(v3, v0);
57 graph->add_edge(v1, v3);
59 std::cout <<
"vertices: " << graph->n_vertices() << std::endl;
60 std::cout <<
"edges: " << graph->n_edges() << std::endl;
A Graph data structure with easy property management.
Definition graph.h:50
Definition collider.cpp:182
This type represents a vertex (internally it is basically an index).
Definition graph.h:132