Weakly connected components algo

I am looking into the algo in https://github.com/tigergraph/gsql-graph-algorithms/blob/master/algorithms/Community/connected_components/weakly_connected_components/tg_wcc.gsql
and wondering that condition: HAVING t.@cc_id != t.@cc_id
what does the cc_id’ means? the cc_id’ is not set in anywhere in the code.
can you explain please the algo?
and if there is a way to print to the file the following “tuple”:
(componentId, componentSize, vertexIdAndTypesList)

The purpose of the HAVING clause is to filter based on an accumulator value - and in this case, the cc_id was set during the ACCUM phase of the query. However, I do think there is a typo, since this should say

HAVING t.@cc_id != s.@cc_id

So to explain this more completely, you cannot evaluate an accumulator value during the WHERE clause phase, since the value hasn’t been set yet, so you do that in the HAVING clause.

1 Like

Thanks for the response,
i tried to fix it to “HAVING t.@cc_id != s.@cc_id” BUT it not compiled : “Error: The SELECT block selects tgt, but the HAVING clause uses src”

And can you advice please about the second request:
is there a way to print to the file the following “tuple”:
(componentId, componentSize, vertexIdAndTypesList) into the file for this algorithm?