27#include <easy3d/core/graph.h>
28#include <easy3d/util/initializer.h>
40Graph* old_graph_from_previous_example() {
42 auto graph =
new Graph;
51 graph->add_edge(v0, v1);
52 graph->add_edge(v1, v2);
53 graph->add_edge(v2, v3);
54 graph->add_edge(v3, v0);
55 graph->add_edge(v1, v3);
61int main(
int argc,
char** argv) {
65 Graph* graph = old_graph_from_previous_example();
74 colors[v] = points[v];
75 std::cout <<
"vertex: " << v <<
", position: " << points[v] <<
", color: " << colors[v] << std::endl;
80 for (
auto e : graph->
edges()) {
82 std::cout <<
"edge: " << e <<
", length: " << lengths[e] << 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
VertexProperty< T > vertex_property(const std::string &name, const T t=T())
Definition: graph.h:684
VertexProperty< T > add_vertex_property(const std::string &name, const T t=T())
Definition: graph.h:642
float edge_length(Edge e) const
compute the length of edge e.
Definition: graph.cpp:256
EdgeProperty< T > add_edge_property(const std::string &name, const T t=T())
Definition: graph.h:649
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