This repository has been archived by the owner on Oct 8, 2021. It is now read-only.
[BUG] Intermittently-failing tests in Parallel.Closeness #1555
Labels
bug
confirmed bug producing incorrect results
Description of bug
I saw several
Parallel.Closeness
tests fail with a message like the one below, but cannot reproduce now. I think it has to do with an uninitialized value in an array (see below). I have only seen it on the branch where I was development #1554, but I think it is unrelated.How to reproduce
I cannot reproduce the behavior reliably.
Expected behavior
Test should reliably pass.
Actual behavior
Test occasionally fails.
Version information
versioninfo()
surrounded by backticks (``)] status LightGraphs
surrounded by backticks (``)Additional context
I think what is happening is that there is this code starting at line 40 of
closeness.jl
:If the edge has zero degree, then closeness short-circuits and sets closeness to 0.0. If it has non-zero degree, it performs a shortest path search and counts the number of nodes reached. Otherwise, if >= 1 node was reached then it computes the centrality. However, if degree > 0 and number of nodes reached == 0, then the closeness will not be set, and that element of the array will remain
undef
. This is exactly the situation we have with vertex 4 (which is the vertex causing the test failure), because the graph used in the test looks like this:Vertex 4 has degree 1 but outdegree 0, so nothing is reached in the path search. I think that
degree
on line 40 should be replaced withoutdegree
, and/or there should be an else clause for when a path search was performed but nothing was reached.In my testing,
undef
seems to usually be pretty close to zero, which is probably why the test usually works.The text was updated successfully, but these errors were encountered: