This is an example of how to use a CSR graph data structure with Metall.
#include <iostream>
using index_t = uint64_t;
using vid_t = uint64_t;
#if 0
#else
using csr_graph_t =
#endif
{
std::size_t num_vertices = 16;
std::size_t num_edges = 256;
csr_graph_t *csr_graph =
manager.construct<csr_graph_t>(
"csr_graph")(
num_vertices, num_edges,
index_t *indices_array = csr_graph->indices();
vid_t *edges_array = csr_graph->edges();
edges_array[indices_array[1]++] = 10;
}
{
csr_graph_t *csr_graph =
manager.find<csr_graph_t>(
"csr_graph").first;
if (!csr_graph) {
std::cerr << "Object csr_graph does not exist" << std::endl;
std::abort();
}
index_t *indices_array = csr_graph->indices();
vid_t *edges_array = csr_graph->edges();
std::cout << edges_array[indices_array[0]] << std::endl;
}
return 0;
}
Simple CSR graph data structure that can take a custom C++ allocator and be stored in persistent memo...
Definition: csr_using_vector.hpp:20
Simple CSR graph data structure that can take a custom C++ allocator and be stored in persistent memo...
Definition: csr.hpp:17
int main()
Definition: jgraph.cpp:24