ASSUME THE EDGES ARE INSERTED INTO THE GRAPH AS FOLLOWS: S, T (SAME AS T, S) S, Z T, Y T, Z V, Y V, Z X, Y X, Z PERFORM A BREADTH-FIRST ITERATION FROM S.
vertex_queue vertex where iterator returned by ++ is positioned S T, ZS Z, YT Y, V, XZ V, XY XV X
NOTE: FOR A BREADTH-FIRST ITERATION OF A DIRECTED GRAPH, THE ALGORITHM IS THE SAME, BUT NEIGHBOR TAKES INTO ACCOUNT THE DIRECTION OF THE ARROW. A B C D FOR A BREADTH-FIRST ITERATION STARTING AT A, THE NEIGHBORS OF A ARE B AND C, BUT NOT D. D NEVER GETS ENQUEUED, AND NEVER GETS RETURNED BY next( ).
Your consent to our cookies if you continue to use this website.