27#include <easy3d/core/graph.h>
28#include <easy3d/util/initializer.h>
44Graph* old_graph_from_previous_example() {
46 auto graph =
new Graph;
55 graph->add_edge(v0, v1);
56 graph->add_edge(v1, v2);
57 graph->add_edge(v2, v3);
58 graph->add_edge(v3, v0);
59 graph->add_edge(v1, v3);
65int main(
int argc,
char** argv) {
69 Graph* graph = old_graph_from_previous_example();
71 std::cout <<
"----------------------------------------\n";
72 std::cout <<
"The incident vertices of each vertex" << std::endl;
73 std::cout <<
"----------------------------------------\n";
77 std::cout <<
"incident vertices of vertex " << v <<
": ";
81 std::cout << vv <<
" ";
87 std::cout << vv <<
" ";
91 std::cout << std::endl;
94 std::cout <<
"\n--------------------------------------\n";
95 std::cout <<
"The incident edges of each vertex" << std::endl;
96 std::cout <<
"----------------------------------------\n";
100 std::cout <<
"incident edges of vertex " << v <<
": ";
103 for (
auto h : graph->
edges(v))
104 std::cout << h <<
" ";
110 std::cout << h <<
" ";
112 }
while (cir != end);
114 std::cout << std::endl;
117 std::cout <<
"\n--------------------------------------\n";
118 std::cout <<
"The two end points of each edge" << std::endl;
119 std::cout <<
"----------------------------------------\n";
122 for (
auto e : graph->
edges()) {
123 std::cout <<
"the two end points of edge " << e <<
": ";
125 std::cout << vs <<
" ";
127 std::cout << vt <<
" " << std::endl;
A Graph data structure with easy property management.
Definition: graph.h:51
EdgeContainer edges() const
returns edge container for C++11 range-based for-loops
Definition: graph.h:816
VertexContainer vertices() const
returns vertex container for C++11 range-based for-loops
Definition: graph.h:798
Vertex vertex(Edge e, unsigned int i) const
returns the i'th vertex of edge e. i has to be 0 or 1.
Definition: graph.h:618
Definition: collider.cpp:182
void initialize(bool use_log_file, bool use_setting_file, const std::string &resource_dir)
Initialization of Easy3D.
Definition: initializer.cpp:35