Skip to content

Commit 579c42e

Browse files
committed
Use sqrt+round in IC14 implementations
Tracks change in the specification: ldbc/ldbc_snb_docs@0f4f335
1 parent f62bc62 commit 579c42e

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

cypher/queries/interactive-complex-14.cypher

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ CALL gds.shortestPath.dijkstra.stream({
2020
RETURN
2121
source,
2222
target,
23-
CASE WHEN floor(40-sqrt(numInteractions)) > 1 THEN floor(40-sqrt(numInteractions)) ELSE 1 END AS weight
23+
CASE WHEN round(40-sqrt(numInteractions)) > 1 THEN round(40-sqrt(numInteractions)) ELSE 1 END AS weight
2424
',
2525
sourceNode: person1,
2626
targetNode: person2,

mssql/ddl/func-bfs-weight.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ BEGIN
4848
UNION ALL
4949

5050
SELECT n.personId, d.OrderDiscovered,
51-
CAST(cte.Path + ';' + CAST(n.personId as varchar(MAX)) as varchar(MAX)), cte.score + CAST(FLOOR(40 - SQRT(d.weight)) AS bigint)
51+
CAST(cte.Path + ';' + CAST(n.personId as varchar(MAX)) as varchar(MAX)), cte.score + CAST(ROUND(40 - SQRT(d.weight)) AS bigint)
5252
FROM #Discovered d JOIN BacktraceCTE cte ON d.Predecessor = cte.Id
5353
JOIN dbo.Person n ON d.Id = n.personId
5454
)

mssql/ddl/func-calculate-weights.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ BEGIN
1818
GROUP BY mid1, mid2
1919
) tmp
2020
RETURN CASE
21-
WHEN (FLOOR(40 - SQRT(@score))) > 1
21+
WHEN (ROUND(40 - SQRT(@score))) > 1
2222
THEN @score
2323
ELSE 0
2424
END

postgres/queries/interactive-complex-14.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55
with recursive
66
pathb(a, b, w) AS (
7-
SELECT least(c.creatorpersonid, p.creatorpersonid) AS a, greatest(c.creatorpersonid, p.creatorpersonid) AS b, greatest(floor(40 - sqrt(count(*)))::bigint, 1) AS w
7+
SELECT least(c.creatorpersonid, p.creatorpersonid) AS a, greatest(c.creatorpersonid, p.creatorpersonid) AS b, greatest(round(40 - sqrt(count(*)))::bigint, 1) AS w
88
FROM message c, message p
99
WHERE c.parentmessageid = p.id AND EXISTS (SELECT * FROM person_knows_person WHERE person1id = c.creatorpersonid AND person2id = p.creatorpersonid)
1010
group by a, b

umbra/queries/interactive-complex-14.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55
with recursive
66
pathb(a, b, w) AS (
7-
SELECT least(c.creatorpersonid, p.creatorpersonid) AS a, greatest(c.creatorpersonid, p.creatorpersonid) AS b, greatest(floor(40 - sqrt(count(*)))::bigint, 1) AS w
7+
SELECT least(c.creatorpersonid, p.creatorpersonid) AS a, greatest(c.creatorpersonid, p.creatorpersonid) AS b, greatest(round(40 - sqrt(count(*)))::bigint, 1) AS w
88
FROM message c, message p
99
WHERE c.parentmessageid = p.id AND EXISTS (SELECT * FROM person_knows_person WHERE person1id = c.creatorpersonid AND person2id = p.creatorpersonid)
1010
group by a, b

0 commit comments

Comments
 (0)