[英]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.
由于他的输入数据集很小,他将最低(无限距离)定义为125。
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.
我以为我可以将最低声明为比Integer.MAX_VALUE小一些的数字,但是每个“最短路径”最终都会导致Integer.MIN_VALUE。
What am I missing here and how can I fix this? 我在这里想念什么,我该如何解决?
The problem is with Math.min()
问题出在
Math.min()
Try this solution Math.max and Math.min outputting highest and lowest values allowed 尝试此解决方案Math.max和Math.min输出允许的最高和最低值
OR 要么
Just write a function to return minimum value. 只需编写一个函数即可返回最小值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.