Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c5dc6bf

Browse files
committed
Update topologicalSort.java
1 parent 116303d commit c5dc6bf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

DataAndAlgoL/Chpt9GraphAlgorithms/topologicalSort.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ public class topologicalSort {
1212
// int v, w;
1313

1414
// for(int i =0; i< DFSandBFSGraph.vertexCount; i++){
15-
// if(indegree[v]==0){
16-
// Q.deQueue(v);
15+
// if(indegree[i]==0){
16+
// Q.deQueue(i); //if indegree is 0 remove those vertices from queue (dequeue the vertices)
1717
// }
1818
// }
1919

2020
// while(!Q.isEmpty()){
2121
// v=Q.deQueue();
2222
// topologicalOrder[v]=counter++;
2323
// for each w adjacent to v
24-
// if(--indegree[w]==0){
24+
// if(--indegree[w]==0){ //decrement indegree of w (adjacent vertex), if that indegree is 0, enqueue vertex to queue
2525
// Q.enQueue(w);
2626
// }
2727
// }

0 commit comments

Comments
 (0)