Skip to content

Commit 95a4d49

Browse files
committed
Modified dumbbell test to show error in scc.
1 parent 63bcd5d commit 95a4d49

1 file changed

Lines changed: 21 additions & 24 deletions

File tree

src/tests/streaming_connected_components_test/scc_test.cpp

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <stinger_net/stinger_alg.h>
12
#include "scc_test.h"
23

34
#define restrict
@@ -82,37 +83,33 @@ TEST_F(SCCTest, UndirectedGraph) {
8283

8384

8485
TEST_F(SCCTest, UndirectedGraphDumbbell) {
85-
stinger_insert_edge_pair(S, 0, 0, 1, 1, 1);
86-
stinger_insert_edge_pair(S, 0, 0, 2, 1, 1);
87-
stinger_insert_edge_pair(S, 0, 0, 3, 1, 1);
88-
stinger_insert_edge_pair(S, 0, 1, 2, 1, 1);
89-
stinger_insert_edge_pair(S, 0, 1, 3, 1, 1);
90-
stinger_insert_edge_pair(S, 0, 2, 3, 1, 1);
91-
92-
stinger_insert_edge_pair(S, 0, 3, 4, 1, 1);
93-
94-
stinger_insert_edge_pair(S, 0, 4, 5, 1, 1);
95-
stinger_insert_edge_pair(S, 0, 4, 6, 1, 1);
96-
stinger_insert_edge_pair(S, 0, 4, 7, 1, 1);
97-
stinger_insert_edge_pair(S, 0, 5, 6, 1, 1);
98-
stinger_insert_edge_pair(S, 0, 5, 7, 1, 1);
99-
10086
int64_t nv = stinger_max_nv(S);
10187
stinger_scc_internal scc_internal;
10288
stinger_scc_initialize_internals(S,nv,&scc_internal,4);
10389
stinger_connected_components_stats stats;
10490
stinger_scc_reset_stats(&stats);
10591

106-
stinger_edge_update insertion,deletion;
107-
insertion.source = 6;
108-
insertion.destination = 7;
109-
deletion.source = 3;
110-
deletion.destination = 4;
111-
112-
stinger_insert_edge_pair(S, 0, insertion.source, insertion.destination, 1, 2);
92+
// Insert (1,2)
93+
stinger_edge_update insertion = {0};
94+
insertion.source = 1; insertion.destination = 2;
95+
stinger_insert_edge_pair(S, 0, insertion.source, insertion.destination, 1, 1);
96+
stinger_scc_insertion(S, nv, scc_internal, &stats, &insertion, 1);
97+
98+
// Insert (2,3)
99+
insertion.source = 2; insertion.destination = 3;
100+
stinger_insert_edge_pair(S, 0, insertion.source, insertion.destination, 1, 1);
101+
stinger_scc_insertion(S, nv, scc_internal, &stats, &insertion, 1);
102+
103+
// Insert (3,4)
104+
insertion.source = 3; insertion.destination = 4;
105+
stinger_insert_edge_pair(S, 0, insertion.source, insertion.destination, 1, 1);
106+
stinger_scc_insertion(S, nv, scc_internal, &stats, &insertion, 1);
107+
108+
// Now we have a simple chain, 1-2-3-4
109+
// We delete (2,3) breaking the chain into two components 1-2 3-4
110+
stinger_edge_update deletion = {0};
111+
deletion.source = 2; deletion.destination = 3;
113112
stinger_remove_edge_pair(S, 0, deletion.source, deletion.destination);
114-
115-
stinger_scc_insertion(S,nv,scc_internal,&stats,&insertion,1);
116113
stinger_scc_deletion(S,nv,scc_internal,&stats,&deletion,1);
117114

118115
const int64_t* actual_components = stinger_scc_get_components(scc_internal);

0 commit comments

Comments
 (0)