27#include <easy3d/core/graph.h>
28#include <easy3d/fileio/graph_io.h>
29#include <easy3d/util/resource.h>
30#include <easy3d/util/initializer.h>
41int main(
int argc,
char** argv) {
46 const std::string file_name = resource::directory() +
"/data/graph.ply";
47 Graph* graph = GraphIO::load(file_name);
49 LOG(ERROR) <<
"failed to load model. Please make sure the file exists and format is correct.";
52 std::cout <<
"graph loaded. " << std::endl;
53 std::cout <<
"\tvertices: " << graph->
n_vertices() << std::endl;
54 std::cout <<
"\tedges: " << graph->
n_edges() << std::endl;
61 const std::string save_file_name =
"./graph-copy.ply";
62 if (GraphIO::save(save_file_name, graph))
63 std::cout <<
"graph saved to \'" << save_file_name <<
"\'" << std::endl;
65 std::cerr <<
"failed create the new file" << std::endl;
A Graph data structure with easy property management.
Definition: graph.h:51
unsigned int n_edges() const
returns number of edges in the graph
Definition: graph.h:557
unsigned int n_vertices() const
returns number of vertices in the graph
Definition: graph.h:555
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