MCPcopy Create free account
hub / github.com/Tencent/plato / load_vertex_data

Function load_vertex_data

example/mutual.cc:131–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129 */
130template <typename T, typename TCSR>
131void load_vertex_data(TCSR& tcsr, std::true_type) {
132 using VDATA = typename TCSR::u_data_t;
133
134 auto& cluster_info = plato::cluster_info_t::get_instance();
135 plato::stop_watch_t watch;
136 watch.mark("t1");
137
138 auto pvcache = plato::load_vertices_cache<std::vector<T>>(
139 FLAGS_input_vertices, plato::edge_format_t::CSV, [&](std::vector<T>* item, char* content) {
140 const char* sep = FLAGS_separator.c_str();
141 char* pSave = nullptr;
142 char* pToken = nullptr;
143 pToken = strtok_r(content, sep, &pSave);
144 while (pToken) {
145 T val = std::strtoul(pToken, nullptr, 0);
146 item->emplace_back(val);
147 pToken = strtok_r(nullptr, sep, &pSave);
148 }
149 return true;
150 });
151
152 tcsr.template load_vertices_data_from_cache<std::vector<T>>(
153 *pvcache,
154 [](plato::vid_t /* v_i */, VDATA& v_data, std::vector<T>& value) {
155 std::copy(value.begin(), value.end(), std::back_inserter(v_data.mutual_));
156 }
157 );
158
159 LOG_IF(INFO, 0 == cluster_info.partition_id_) << "load tcsr vertices costs: " << watch.show("t1") / 1000.0 << "s";
160}
161
162/**
163 * @brief

Callers

nothing calls this directly

Calls 5

markMethod · 0.80
emplace_backMethod · 0.80
showMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected