Skip to content

Commit ba38b49

Browse files
authored
Merge pull request #143 from stdgraph/kdeweese_fixes
modify TC and CC
2 parents fb61ed3 + 5b97d17 commit ba38b49

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

data/tc_test.csv

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ A,E,1
66
B,C,1
77
B,D,1
88
B,E,1
9+
B,F,1
910
C,D,1
10-
E,C,1
11+
C,E,1
1112
D,E,1
12-
B,F,1
1313
E,F,1
1414
E,G,1
1515
F,H,1

include/graph/algorithm/connected_components.hpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ void kosaraju(G&& g, // graph
8888
template <adjacency_list G,
8989
random_access_range Component>
9090
requires random_access_range<vertex_range_t<G>> && integral<vertex_id_t<G>>
91-
void connected_components(G&& g, // graph
92-
Component& component // out: connected component assignment
91+
size_t connected_components(G&& g, // graph
92+
Component& component // out: connected component assignment
9393
) {
9494
size_t N(size(vertices(g)));
9595
std::vector<bool> visited(N, false);
@@ -114,6 +114,7 @@ void connected_components(G&& g, // graph
114114
}
115115
++cid;
116116
}
117+
return cid;
117118
}
118119

119120
} // namespace graph

include/graph/algorithm/tc.hpp

-4
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ size_t triangle_count(G&& g) {
4242
auto ie = end(edges(g, uid));
4343
while (i != ie) {
4444
auto&& [vid, uv] = *i;
45-
if (vid < uid) {
46-
++i;
47-
continue;
48-
}
4945
graph::incidence_iterator<G> j(g, vid);
5046

5147
auto je = end(edges(g, vid));

tests/tc_tests.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ TEST_CASE("triangle counting test", "[tc]") {
1919
init_console();
2020

2121
using G = routes_vol_graph_type;
22-
auto&& g = load_ordered_graph<G>(TEST_DATA_ROOT_DIR "tc_test.csv", name_order_policy::alphabetical, true);
22+
auto&& g = load_ordered_graph<G>(TEST_DATA_ROOT_DIR "tc_test.csv", name_order_policy::alphabetical);
2323

2424
size_t triangles = graph::triangle_count(g);
2525
REQUIRE(triangles == 11);
26-
}
26+
}

0 commit comments

Comments
 (0)