orhankislal commented on a change in pull request #486: Graph: Filter out
infinite paths
URL: https://github.com/apache/madlib/pull/486#discussion_r390564263
##########
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:
It seems the average path length is usually defined for connected graphs. If
a graph is unconnected, the average path length becomes infinity as well. There
are suggestions like using the largest connected component's avg path length
(which is possible to do with MADlib wcc function)
[https://mathinsight.org/definition/network_mean_path_length](url).
I think the previous way of calculating was plain wrong. With this commit,
the average length of non-infinite paths is calculated, which may or may not be
useful. If we want to specifically limit this function to connected graphs, we
can do that as well.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services