ldbc / sigmod2014-contest-graphblas

GraphBLAS solution for the 2014 SIGMOD Programming Contest
Apache License 2.0
3 stars 1 forks source link

Q3/Py implementation should produce p1|p2 output #9

Closed szarnyasg closed 4 years ago

szarnyasg commented 4 years ago

We select the upper triangle to ensure p1 < p2 in the dense ids. This only maps back to the sparse ids correctly, we need to make sure that they were originally sorted.

Temporary workaround:

sort -g person.csv > person-sorted.csv
mv person-sorted.csv person.csv 
less person.csv 

cc @sandordavid1124

A permanent solution would be to sort the persons.csv file beforehand.

marci543 commented 4 years ago

We can keep the current optimization (using of TRIU) without sorting the persons. The query is symmetric and comparison of IDs is only used to filter duplicates and have a consistent output. A simple solution is to transform the output by swapping the IDs if necessary:

p1_id=...
p2_id=...
if(p1_id>p2_id):
  temp=p1_id
  p1_id=p2_id
  p2_id=temp