src/main/java/de/dfki/lt/loot/digraph/DiGraph.java
public List<Integer> findSources() {
	  List<Integer> result = new ArrayList<>();
	  BitSet source = new BitSet();
	  source.set(0, getNumberOfVertices(), true);
	  for(int vertex = 0; vertex < getNumberOfVertices(); ++vertex) {
		  if (! isDeletedVertex(vertex)) { 
			  for (Edge<EI> e : _outEdges.get(vertex)) {
				  source.clear(e.getTarget());
			  }
		  }
	  }
	  for (int i = source.nextSetBit(0); i >= 0; i = source.nextSetBit(i+1)) {
		  if (i == Integer.MAX_VALUE) {
			  break; // or (i+1) would overflow
		  }
		  result.add(i);
	  }
	  return result;
  }
/** Return all nodes that have no incoming edges (complexity O(E)) */
Return all nodes that have no incoming edges (complexity O(E))
Return all nodes that have no incoming edges ( complexity O ( E ))
public List<Integer> findSources() {
	  List<Integer> result = new ArrayList<>();
	  BitSet source = new BitSet();
	  source.set(0, getNumberOfVertices(), true);
	  for(int vertex = 0; vertex < getNumberOfVertices(); ++vertex) {
		  if (! isDeletedVertex(vertex)) { 
			  for (Edge<EI> e : _outEdges.get(vertex)) {
				  source.clear(e.getTarget());
			  }
		  }
	  }
	  for (int i = source.nextSetBit(0); i >= 0; i = source.nextSetBit(i+1)) {
		  if (i == Integer.MAX_VALUE) {
			  break; 
		  }
		  result.add(i);
	  }
	  return result;
  }
public List < Integer > findSources ( ) { List < Integer > result = new ArrayList < > ( ) ; BitSet source = new BitSet ( ) ; source . set ( 0 , getNumberOfVertices ( ) , true ) ; for ( int vertex = 0 ; vertex < getNumberOfVertices ( ) ; ++ vertex ) { if ( ! isDeletedVertex ( vertex ) ) { for ( Edge < EI > e : _outEdges . get ( vertex ) ) { source . clear ( e . getTarget ( ) ) ; } } } for ( int i = source . nextSetBit ( 0 ) ; i >= 0 ; i = source . nextSetBit ( i + 1 ) ) { if ( i == Integer . MAX_VALUE ) { break ; } result . add ( i ) ; } return result ; }
Return all nodes that have no incoming edges (complexity O(E))
Return all nodes that have no incoming edges ( complexity O ( E ))
// or (i+1) would overflow