You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@madlib.apache.org by "kaknikhil (via GitHub)" <gi...@apache.org> on 2023/02/21 19:44:43 UTC

[GitHub] [madlib] kaknikhil commented on a diff in pull request #592: SSSP: Fix negative cycle check

kaknikhil commented on code in PR #592:
URL: https://github.com/apache/madlib/pull/592#discussion_r1113499040


##########
src/ports/postgres/modules/graph/sssp.py_in:
##########
@@ -325,7 +325,10 @@ def graph_sssp(schema_madlib, vertex_table, vertex_id, edge_table,
                     WHERE {vertex_id} IS NOT NULL
                     """.format(**locals()))[0]['count']
 
-            for i in range(0, v_cnt + 1):
+            # The algorithm should converge in less than |V|+1 iterations.
+            # Otherwise there is a negative cycle in the graph.
+            # We check for v_cnt+1 because the first iteration is spent on the setup

Review Comment:
   shouldn't this comment be `We check for v_cnt+2`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@madlib.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org