Skip to content

Bug in distance matrix #18

@verginer

Description

@verginer

the HigherOrderNetwork.getDistanceMatrix() has a strange bug.
For small networks it works fine passing all test but for larger node sets i.e. 10 -> matrix 10x10
the result becomes unstable.

For example in one iteration the distance matrix looks like:

[[  0.   2.   1.   2.   2.   1.   1.   2.   2.]
 [  2.   0.   2.   1.  inf   3.   2.  inf   1.]
 [  1.   1.   0.   2.   2.   2.   1.   2.   2.]
 [  1.   2.   1.   1.   3.   2.   2.   3.   3.]
 [  2.   3.   2.   3.   0.   3.   2.   3.   1.]
 [ inf  inf  inf  inf  inf   0.  inf  inf  inf]
 [  1.   2.   1.   1.   1.   2.   1.   1.   1.]
 [  2.   2.   1.   3.  inf   3.   2.   0.   3.]
 [  1.   2.   1.   2.   2.   2.   1.   2.   0.]]

and in the next

[[  0.   2.   1.   2.   2.   1.   1.   2.   2.]
 [  2.   0.   2.   1.   3.   3.   2.   3.   1.]
 [  1.   1.   0.   2.   2.   2.   1.   2.   2.]
 [  1.   2.   1.   1.  inf   2.   2.   3.   3.]
 [  2.  inf   2.  inf   0.   3.   2.   3.   1.]
 [ inf  inf  inf  inf  inf   0.  inf  inf  inf]
 [  1.   2.   1.   1.   1.   2.   1.   1.   1.]
 [  2.   2.   1.  inf  inf   3.   2.   0.   3.]
 [  1.   2.   1.   2.   2.   2.   1.   2.   0.]]
2c2
<  [  2.   0.   2.   1.   3.   3.   2.   3.   1.]
---
>  [  2.   0.   2.   1.  inf   3.   2.  inf   1.]
4,5c4,5
<  [  1.   2.   1.   1.  inf   2.   2.   3.   3.]
<  [  2.  inf   2.  inf   0.   3.   2.   3.   1.]
---
>  [  1.   2.   1.   1.   3.   2.   2.   3.   3.]
>  [  2.   3.   2.   3.   0.   3.   2.   3.   1.]
8c8
<  [  2.   2.   1.  inf  inf   3.   2.   0.   3.]
---
>  [  2.   2.   1.   3.  inf   3.   2.   0.   3.]

Note the position of the inf.

The test to reproduce the bug has been added in 37811ad.

Observation: only at position where there would be a 3 does an inf appear

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions