Menu

#824 tlp.maxDistance incorrect return

4.0.0
closed-fixed
5
2016-05-10
2016-05-10
No

Hi,

The tlp.maxDistance function of the python API does not seem to return the maximum distance between a given node and all other nodes of a given graph.

Look at the code below:

distMetric = graph.getIntegerProperty('distMetric')
maxDist = tlp.maxDistance(graph, tlp.node(int(node_id)), graph["distMetric"], tlp.DIRECTED)
print 'maxDist'
print maxDist
print 'distMetric'
for n in graph.getNodes():
print distMetric.getNodeValue(n)

The output is:

maxDist
0
distMetric
-1
-1
-1
-1
-1
1
-1
0
-1
-1
-1
17
-1
-1
-1
-1
-1
-1
10
-1
16
-1
-1
-1
-1
3
-1
-1
-1
-1
-1
-1
2
10
-1
-1
10
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
4
-1
-1
-1
-1
-1
-1
7
-1
-1
-1
21
-1
20
-1
-1
-1
15
-1
-1
-1
-1
-1
-1
-1
-1
19
-1
-1
9
-1
-1
-1
-1
-1
14
-1
1
11
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
12
11
-1
-1
-1
-1
-1
13
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
13
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
9
-1
11
-1
1
18
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
8
-1
7
14
-1
-1
11
12
-1
-1
6
5
12
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1

According to the documentation, maxDistance should return 21 but not 0.

Best,
Florent

Discussion

  • Antoine Lambert

    Antoine Lambert - 2016-05-10

    Thanks for reporting the issue.

    Indeed, there was a bug in the tlp::maxDistance Python wrapper implementation : return value was ignored and not transmitted to the Python world. It is now fixed in the tulip trunk.
    As a workaround until the next Tulip release, you can call 'distMetric.getNodeMax()' to retrieve the max computed distance.

    Cheers,
    Antoine

     
  • Patrick Mary

    Patrick Mary - 2016-05-10
    • status: open --> closed-fixed
    • assigned_to: Antoine Lambert
     
  • Patrick Mary

    Patrick Mary - 2016-05-10

    Thanks a lot for your input.
    This bug is now fixed in the current svn code line (commit #11331).
    As a workaround until the next Tulip release,
    you can call 'distMetric.getNodeMax()' to retrieve the max computed distance.

     

Log in to post a comment.