简体   繁体   中英

Dijkstra in Hadoop MapReduce - Selecting infinite distance

I am trying to use this code in my virtual cluster environment. He defines lowest (infinite distance) as 125 since his input data set is pretty small.

But I am going to use big data sets such as this one. I thought I could just declare lowest as some number less than the Integer.MAX_VALUE but every "shortest path" results in Integer.MIN_VALUE in the end.

What am I missing here and how can I fix this?

The problem is with Math.min()

Try this solution Math.max and Math.min outputting highest and lowest values allowed

OR

Just write a function to return minimum value.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM