forked from gaolk/graph-database-benchmark
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathwcc-graph500.gsql
More file actions
executable file
·39 lines (30 loc) · 940 Bytes
/
wcc-graph500.gsql
File metadata and controls
executable file
·39 lines (30 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#################################
# this wcc algorithm keep sending
# the minimum vertex id it has seen
# to each neighbor, update the neighbor
# minimum seen vertex id.
# Stop when there is no vertex that
# can update its minumum seen
# vertex id.
#################################
use graph graph500
drop query wcc
create query wcc() for graph graph500 {
SumAccum<int> @@group_cnt = 0;
int loop_count = 0;
MinAccum<int> @cc_id;
OrAccum<bool> @changed_group= false;
Start = {MyNode.*};
@@group_cnt = Start.size();
Start = select x from Start:x accum x.@cc_id = uid_to_vid(x);
while (Start.size()>0) do
Start= select y from Start:x - (MyEdge:e)-> :y
where x.@cc_id < y.@cc_id
accum y.@cc_id += x.@cc_id
post-accum if (y.@changed_group ==false) then
@@group_cnt += -1, y.@changed_group+=true
end;
loop_count += 1;
end;
Print @@group_cnt, loop_count;
}