MCPcopy Create free account
hub / github.com/Notgnoshi/generative / read_edge

Method read_edge

generative/io/tgf-graph-reader.cpp:137–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135}
136
137void TGFGraphReader::read_edge(const std::string& _line) noexcept
138{
139 const auto line = trim(_line);
140 std::istringstream input(line);
141
142 std::size_t src = 0;
143 std::size_t dst = 0;
144
145 input >> src >> dst;
146
147 if (input.fail())
148 {
149 LOG4CPLUS_WARN(s_logger, "Failed to parse edge '" << line << "'");
150 return;
151 }
152
153 if (src >= m_nodes_vec.size() || dst >= m_nodes_vec.size())
154 {
155 LOG4CPLUS_WARN(s_logger,
156 "Failed to add edge '" << src << " -> " << dst << "' because there are only "
157 << m_nodes_vec.size() << " nodes");
158 return;
159 }
160
161 //! @todo We need a way of guaranteeing that m_nodes_vec[src].index == src.
162 m_nodes_vec[src].adjacencies.emplace(dst);
163 m_nodes_vec[dst].adjacencies.emplace(src);
164}
165} // namespace generative::io

Callers

nothing calls this directly

Calls 1

trimFunction · 0.85

Tested by

no test coverage detected