MCPcopy Create free account
hub / github.com/DeepGraphLearning/graphvite / flatten

Method flatten

include/core/graph.h:87–101  ·  view source on GitHub ↗

Flatten the adjacency list to an edge list */

Source from the content-addressed store, hash-verified

85
86 /** Flatten the adjacency list to an edge list */
87 virtual void flatten() {
88 if (!edges.empty())
89 return;
90
91 size_t offset = 0;
92 flat_offsets.resize(num_vertex);
93 for (Index u = 0; u < num_vertex; u++) {
94 for (auto &&vertex_edge : vertex_edges[u]) {
95 edges.push_back(std::tuple_cat(std::tie(u), vertex_edge));
96 edge_weights.push_back(std::get<1>(vertex_edge));
97 }
98 flat_offsets[u] = offset;
99 offset += vertex_edges[u].size();
100 }
101 }
102
103 virtual inline std::string name() const {
104 std::stringstream ss;

Callers 1

get_sample_functionMethod · 0.80

Calls 1

resizeMethod · 0.80

Tested by

no test coverage detected