6 #ifndef METALL_EXAMPLE_GRAPH_DATA_STRUCTURE_ADJACENCY_LIST_HPP
7 #define METALL_EXAMPLE_GRAPH_DATA_STRUCTURE_ADJACENCY_LIST_HPP
10 #include <boost/container/scoped_allocator.hpp>
11 #include <boost/container/vector.hpp>
12 #include <boost/unordered_map.hpp>
21 template <
typename vid_t = uint64_t,
22 typename allocator_t = std::allocator<char>>
26 using index_allocator_t =
27 typename std::allocator_traits<allocator_t>::template rebind_alloc<vid_t>;
28 using vector_type = vector<vid_t, index_allocator_t>;
36 typename std::allocator_traits<allocator_t>::template rebind_alloc<
37 std::pair<const vid_t, vector_type>>>;
38 using map_type = unordered_map<vid_t, vector_type, std::hash<vid_t>,
39 std::equal_to<vid_t>, map_allocator_type>;
46 m_map[source].emplace_back(target);
49 auto edges_begin(
const vid_t source) {
return m_map[source].begin(); }
51 auto edges_end(
const vid_t source) {
return m_map[source].end(); }
Simple adjacency-list graph data structure that can take a custom C++ allocator and be stored in pers...
Definition: adjacency_list.hpp:23
auto edges_begin(const vid_t source)
Definition: adjacency_list.hpp:49
adjacency_list(allocator_t allocator=allocator_t())
Definition: adjacency_list.hpp:42
auto edges_end(const vid_t source)
Definition: adjacency_list.hpp:51
void add_edge(vid_t source, vid_t target)
Definition: adjacency_list.hpp:45