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

public int [ ] breadthFirstSearch ( int intialValue , IBFSTraversable < N > traversable , int firstValue , IIntegerBfsNextValueIterator < N > nextValueIterator , List < Integer > sourcesIndex ) { int [ ] results = new int [ nodes . length ] ; Arrays . fill ( results , intialValue ) ; boolean [ ] alreadyScanned = new boolean [ nodes . length ] ; Arrays . fill ( alreadyScanned , false ) ; Set < Integer > currentNodesIndex = new HashSet < > ( sourcesIndex ) ; iterativeIntegerBreadthFirstSearch ( results , alreadyScanned , currentNodesIndex , firstValue , 0 , traversable , nextValueIterator ) ; return results ; }
breadth - first search implementation for integers . see double implementation for the parameters details . note that for compilation reasons parameters are in a different order compared to the double version hint : you can compute distances by providing to the sources by providing a + 1 next value visitor
