You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@madlib.apache.org by GitBox <gi...@apache.org> on 2020/03/10 02:24:29 UTC

[GitHub] [madlib] reductionista commented on a change in pull request #486: Graph: Filter out infinite paths

reductionista commented on a change in pull request #486: Graph: Filter out infinite paths
URL: https://github.com/apache/madlib/pull/486#discussion_r390059084
 
 

 ##########
 File path: src/ports/postgres/modules/graph/measures.py_in
 ##########
 @@ -184,10 +184,7 @@ class Graph(object):
                 -- Filtering 'Infinity' occurs in CASE instead of WHERE clause
                 -- so that the edge is part of the average value i.e. part of
                 -- the count of paths but zero addition to sum of distances.
-                AVG(CASE WHEN {e.weight} = 'Infinity'::double precision
-                            THEN 0::double precision
-                            ELSE {e.weight}::double precision
-                    END) as avg_path_length
+                AVG({e.weight}::double precision) as avg_path_length
 
 Review comment:
   We should remove the comment above, which still references the CASE block that's no longer there.
   
   Also wondering:
   
   As I understand it, the original author thought it was important for infinite paths to be included in the denominator of the average value calculation (avg = sum(weights) / count(weights) ) but not in the numerator.  That doesn't seem right to me, but the fact they went to the trouble of specifically pointing it out in the comment makes me wonder if there was some reason for it that we're missing. 
   
   Since we are changing the way in which average path length is calculated, affecting the result that gets returned (not just omitting infinite rows from the table), I just want to make sure we're doing this intentionally.  The average path length returned previously would have been a smaller number than it will be now for disconnected graphs, right?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services