| 49 | } |
| 50 | |
| 51 | std::vector<std::pair<const GeometryGraph::Node&, const GeometryGraph::Node&>> |
| 52 | GeometryGraph::get_edge_pairs() const |
| 53 | { |
| 54 | std::vector<std::pair<const GeometryGraph::Node&, const GeometryGraph::Node&>> pairs; |
| 55 | // A heuristic. |
| 56 | pairs.reserve(m_nodes.size() * 2); |
| 57 | for (const auto& node : m_nodes) |
| 58 | { |
| 59 | for (const auto adj : node.adjacencies) |
| 60 | { |
| 61 | // Only print each edge once. |
| 62 | if (node.index < adj) |
| 63 | { |
| 64 | pairs.emplace_back(node, m_nodes[adj]); |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | return pairs; |
| 69 | } |
| 70 | |
| 71 | std::vector<std::unique_ptr<geos::geom::LineString>> GeometryGraph::get_edges() const |
| 72 | { |