public double[] breadthFirstSearch(double intialValue,double firstValue,IBFSTraversable<N> traversable,IDoubleBfsNextLevelValueIterator<N> nextValueIterator,List<Integer> sources){
  double[] results=new double[nodes.length];
  Arrays.fill(results,intialValue);
  boolean[] alreadyScanned=new boolean[nodes.length];
  Arrays.fill(alreadyScanned,false);
  Set<Integer> currentNodesIndex=new HashSet<>(sources);
  iterativeDoubleBreadthFirstSearch(results,alreadyScanned,currentNodesIndex,firstValue,0,traversable,nextValueIterator);
  return results;
}

public double [ ] breadthFirstSearch ( double intialValue , double firstValue , IBFSTraversable < N > traversable , IDoubleBfsNextLevelValueIterator < N > nextValueIterator , List < Integer > sources ) { double [ ] results = new double [ nodes . length ] ; Arrays . fill ( results , intialValue ) ; boolean [ ] alreadyScanned = new boolean [ nodes . length ] ; Arrays . fill ( alreadyScanned , false ) ; Set < Integer > currentNodesIndex = new HashSet < > ( sources ) ; iterativeDoubleBreadthFirstSearch ( results , alreadyScanned , currentNodesIndex , firstValue , 0 , traversable , nextValueIterator ) ; return results ; }
breadth - first search implementation on your graph . it will iteratively : assign current level value to all source nodes scan source nodes neighbor to find the reachable nodes that have not been reached yet compute next level value and consider all the reachable neighbors as the new source nodes note : sadly i did not find a way to template this method as i would do in c + + without degrading performances . so i must implement it also for int . . .
