| 11 | |
| 12 | /// This function checks if the graph (consisting of directed edges) is undirected |
| 13 | template <typename GraphT> bool isUndirectedGraph(const GraphT &graph) |
| 14 | { |
| 15 | for (auto source = 0u; source < graph.GetNumberOfNodes(); ++source) |
| 16 | { |
| 17 | for (auto edge = graph.BeginEdges(source); edge < graph.EndEdges(source); ++edge) |
| 18 | { |
| 19 | const auto &data = graph.GetEdgeData(edge); |
| 20 | |
| 21 | auto target = graph.GetTarget(edge); |
| 22 | BOOST_ASSERT(target != SPECIAL_NODEID); |
| 23 | |
| 24 | bool found_reverse = false; |
| 25 | for (auto rev_edge = graph.BeginEdges(target); rev_edge < graph.EndEdges(target); |
| 26 | ++rev_edge) |
| 27 | { |
| 28 | auto rev_target = graph.GetTarget(rev_edge); |
| 29 | BOOST_ASSERT(rev_target != SPECIAL_NODEID); |
| 30 | |
| 31 | if (rev_target != source) |
| 32 | { |
| 33 | continue; |
| 34 | } |
| 35 | |
| 36 | BOOST_ASSERT_MSG(!found_reverse, "Found more than one reverse edge"); |
| 37 | found_reverse = true; |
| 38 | } |
| 39 | |
| 40 | if (!found_reverse) |
| 41 | { |
| 42 | return false; |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | return true; |
| 48 | } |
| 49 | |
| 50 | /// Since DynamicGraph assumes directed edges we have to make sure we transformed |
| 51 | /// the compressed edge format into single directed edges. We do this to make sure |
nothing calls this directly
no test coverage detected