Standard BFS Loop
while ( q . Count != 0 ) { int u = q . Peek ( ) ; q . Dequeue ( ) ; for ( int v = 0 ; v < V ; v ++ ) { if ( visited [ v ] == false && rGraph [ u , v ] > 0 ) { q . Enqueue ( v ) ; parent [ v ] = u ; visited [ v ] = true ; } } }