{"algorithm":"bfs","about":["Breadth-first search keeps a queue of the vertices it has found but not visited yet. It takes the vertex at the front and puts each neighbor it hasn't seen at the back. So every vertex one edge from the start comes out before any vertex two edges away, and so on, one level at a time.","When every edge counts the same, that order gives the fewest edges from the start to each vertex, such as the fewest hops between two machines. gograph marks a vertex as seen when it joins the queue, so each one is visited once and the search costs O(V+E). Vertices the start can't reach are never visited.","traverse.BFS and traverse.BFSWithDepth return an iter.Seq, so a range loop can break as soon as it finds what it needs, and BFSWithDepth gives each vertex with its number of edges from the start. path.BFSPaths runs the same search and keeps the edge that first found each vertex, so PathTo on its result gives a route with the fewest edges to any vertex, start first, and false for one out of reach. When edges have different weights, the fewest edges isn't the shortest route, and Closest-first or Dijkstra gives the real distances."],"template":{"id":"maze","name":"Maze","description":"A maze of 30 cells in five rows, A to E, and six columns, 1 to 6, so C4 is row C, column 4. Each edge is an open passage between two cells. The way from A1 to E6 winds through most of the maze, and two short loops give a few cells a second route.","family":"undirected","directed":false,"weighted":false,"acyclic":false,"vertices":[{"id":"A1","x":100,"y":180},{"id":"A2","x":260,"y":180},{"id":"A3","x":420,"y":180},{"id":"A4","x":580,"y":180},{"id":"A5","x":740,"y":180},{"id":"A6","x":900,"y":180},{"id":"B1","x":100,"y":340},{"id":"B2","x":260,"y":340},{"id":"B3","x":420,"y":340},{"id":"B4","x":580,"y":340},{"id":"B5","x":740,"y":340},{"id":"B6","x":900,"y":340},{"id":"C1","x":100,"y":500},{"id":"C2","x":260,"y":500},{"id":"C3","x":420,"y":500},{"id":"C4","x":580,"y":500},{"id":"C5","x":740,"y":500},{"id":"C6","x":900,"y":500},{"id":"D1","x":100,"y":660},{"id":"D2","x":260,"y":660},{"id":"D3","x":420,"y":660},{"id":"D4","x":580,"y":660},{"id":"D5","x":740,"y":660},{"id":"D6","x":900,"y":660},{"id":"E1","x":100,"y":820},{"id":"E2","x":260,"y":820},{"id":"E3","x":420,"y":820},{"id":"E4","x":580,"y":820},{"id":"E5","x":740,"y":820},{"id":"E6","x":900,"y":820}],"edges":[{"from":"A1","to":"A2"},{"from":"A2","to":"A3"},{"from":"A3","to":"B3"},{"from":"A4","to":"A5"},{"from":"A4","to":"B4"},{"from":"A5","to":"A6"},{"from":"A6","to":"B6"},{"from":"B1","to":"B2"},{"from":"B1","to":"C1"},{"from":"B2","to":"B3"},{"from":"B4","to":"C4"},{"from":"B5","to":"B6"},{"from":"B5","to":"C5"},{"from":"B6","to":"C6"},{"from":"C1","to":"C2"},{"from":"C2","to":"D2"},{"from":"C3","to":"C4"},{"from":"C3","to":"D3"},{"from":"C4","to":"D4"},{"from":"C5","to":"C6"},{"from":"C5","to":"D5"},{"from":"D1","to":"E1"},{"from":"D2","to":"E2"},{"from":"D3","to":"E3"},{"from":"D4","to":"E4"},{"from":"D5","to":"D6"},{"from":"D6","to":"E6"},{"from":"E1","to":"E2"},{"from":"E2","to":"E3"},{"from":"E3","to":"E4"},{"from":"E5","to":"E6"}],"details":{"vertices":30,"edges":31,"directed":false,"weighted":false,"acyclic":false,"negativeWeights":false,"density":0.07126436781609195,"degree":{"min":1,"avg":2.066666666666667,"max":3},"selfLoops":0,"components":1}},"problem":"Starting at A1, find every cell of the maze, the cells fewest steps away first.","params":{"start":"A1"},"result":{"kind":"order","vertices":["A1","A2","A3","B3","B2","B1","C1","C2","D2","E2","E1","E3","D1","D3","E4","C3","D4","C4","B4","A4","A5","A6","B6","B5","C6","C5","D5","D6","E6","E5"]},"answer":"From A1, breadth-first visits 30 vertices: A1, A2, A3, B3, B2, B1, C1, C2, D2, E2, and so on to E5.","legend":{"vertex":[{"id":"idle","label":"Not reached","color":"#64748B","shape":"hollow"},{"id":"waiting","label":"In queue","color":"#E69F00","shape":"dashed-square"},{"id":"current","label":"Current","color":"#56B4E9","shape":"ring"},{"id":"done","label":"Visited","color":"#009E73","shape":"filled"}],"edge":[{"id":"idle","label":"Edge","color":"#475569","shape":"line"},{"id":"tree","label":"Used to reach a vertex","color":"#009E73","shape":"thick"}],"panels":[{"id":"queue","title":"Queue","kind":"list"},{"id":"order","title":"Visit order","kind":"list"}]},"steps":[{"say":"Start at A1. Put it in the queue.","ops":[{"v":"A1","state":"waiting"},{"panel":"queue","list":[{"key":"A1"}]}]},{"say":"Take A1 from the front of the queue.","ops":[{"v":"A1","state":"current"},{"panel":"queue","list":[]},{"panel":"order","list":[{"key":"A1"}]}]},{"say":"Add A2, the only unseen neighbor of A1, to the back of the queue.","ops":[{"v":"A1","state":"done"},{"v":"A2","state":"waiting"},{"e":["A1","A2"],"state":"tree"},{"panel":"queue","list":[{"key":"A2"}]}]},{"say":"Take A2 from the front of the queue.","ops":[{"v":"A2","state":"current"},{"panel":"queue","list":[]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"}]}]},{"say":"Add A3, the only unseen neighbor of A2, to the back of the queue.","ops":[{"v":"A2","state":"done"},{"v":"A3","state":"waiting"},{"e":["A2","A3"],"state":"tree"},{"panel":"queue","list":[{"key":"A3"}]}]},{"say":"Take A3 from the front of the queue.","ops":[{"v":"A3","state":"current"},{"panel":"queue","list":[]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"}]}]},{"say":"Add B3, the only unseen neighbor of A3, to the back of the queue.","ops":[{"v":"A3","state":"done"},{"v":"B3","state":"waiting"},{"e":["A3","B3"],"state":"tree"},{"panel":"queue","list":[{"key":"B3"}]}]},{"say":"Take B3 from the front of the queue.","ops":[{"v":"B3","state":"current"},{"panel":"queue","list":[]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"}]}]},{"say":"Add B2, the only unseen neighbor of B3, to the back of the queue.","ops":[{"v":"B3","state":"done"},{"v":"B2","state":"waiting"},{"e":["B3","B2"],"state":"tree"},{"panel":"queue","list":[{"key":"B2"}]}]},{"say":"Take B2 from the front of the queue.","ops":[{"v":"B2","state":"current"},{"panel":"queue","list":[]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"}]}]},{"say":"Add B1, the only unseen neighbor of B2, to the back of the queue.","ops":[{"v":"B2","state":"done"},{"v":"B1","state":"waiting"},{"e":["B2","B1"],"state":"tree"},{"panel":"queue","list":[{"key":"B1"}]}]},{"say":"Take B1 from the front of the queue.","ops":[{"v":"B1","state":"current"},{"panel":"queue","list":[]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"},{"key":"B1"}]}]},{"say":"Add C1, the only unseen neighbor of B1, to the back of the queue.","ops":[{"v":"B1","state":"done"},{"v":"C1","state":"waiting"},{"e":["B1","C1"],"state":"tree"},{"panel":"queue","list":[{"key":"C1"}]}]},{"say":"Take C1 from the front of the queue.","ops":[{"v":"C1","state":"current"},{"panel":"queue","list":[]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"},{"key":"B1"},{"key":"C1"}]}]},{"say":"Add C2, the only unseen neighbor of C1, to the back of the queue.","ops":[{"v":"C1","state":"done"},{"v":"C2","state":"waiting"},{"e":["C1","C2"],"state":"tree"},{"panel":"queue","list":[{"key":"C2"}]}]},{"say":"Take C2 from the front of the queue.","ops":[{"v":"C2","state":"current"},{"panel":"queue","list":[]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"},{"key":"B1"},{"key":"C1"},{"key":"C2"}]}]},{"say":"Add D2, the only unseen neighbor of C2, to the back of the queue.","ops":[{"v":"C2","state":"done"},{"v":"D2","state":"waiting"},{"e":["C2","D2"],"state":"tree"},{"panel":"queue","list":[{"key":"D2"}]}]},{"say":"Take D2 from the front of the queue.","ops":[{"v":"D2","state":"current"},{"panel":"queue","list":[]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"},{"key":"B1"},{"key":"C1"},{"key":"C2"},{"key":"D2"}]}]},{"say":"Add E2, the only unseen neighbor of D2, to the back of the queue.","ops":[{"v":"D2","state":"done"},{"v":"E2","state":"waiting"},{"e":["D2","E2"],"state":"tree"},{"panel":"queue","list":[{"key":"E2"}]}]},{"say":"Take E2 from the front of the queue.","ops":[{"v":"E2","state":"current"},{"panel":"queue","list":[]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"},{"key":"B1"},{"key":"C1"},{"key":"C2"},{"key":"D2"},{"key":"E2"}]}]},{"say":"Add E1 and E3, the unseen neighbors of E2, to the back of the queue.","ops":[{"v":"E2","state":"done"},{"v":"E1","state":"waiting"},{"e":["E2","E1"],"state":"tree"},{"v":"E3","state":"waiting"},{"e":["E2","E3"],"state":"tree"},{"panel":"queue","list":[{"key":"E1"},{"key":"E3"}]}]},{"say":"Take E1 from the front of the queue.","ops":[{"v":"E1","state":"current"},{"panel":"queue","list":[{"key":"E3"}]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"},{"key":"B1"},{"key":"C1"},{"key":"C2"},{"key":"D2"},{"key":"E2"},{"key":"E1"}]}]},{"say":"Add D1, the only unseen neighbor of E1, to the back of the queue.","ops":[{"v":"E1","state":"done"},{"v":"D1","state":"waiting"},{"e":["E1","D1"],"state":"tree"},{"panel":"queue","list":[{"key":"E3"},{"key":"D1"}]}]},{"say":"Take E3 from the front of the queue.","ops":[{"v":"E3","state":"current"},{"panel":"queue","list":[{"key":"D1"}]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"},{"key":"B1"},{"key":"C1"},{"key":"C2"},{"key":"D2"},{"key":"E2"},{"key":"E1"},{"key":"E3"}]}]},{"say":"Add D3 and E4, the unseen neighbors of E3, to the back of the queue.","ops":[{"v":"E3","state":"done"},{"v":"D3","state":"waiting"},{"e":["E3","D3"],"state":"tree"},{"v":"E4","state":"waiting"},{"e":["E3","E4"],"state":"tree"},{"panel":"queue","list":[{"key":"D1"},{"key":"D3"},{"key":"E4"}]}]},{"say":"Take D1 from the front of the queue.","ops":[{"v":"D1","state":"current"},{"panel":"queue","list":[{"key":"D3"},{"key":"E4"}]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"},{"key":"B1"},{"key":"C1"},{"key":"C2"},{"key":"D2"},{"key":"E2"},{"key":"E1"},{"key":"E3"},{"key":"D1"}]}]},{"say":"D1 has no unseen neighbors.","ops":[{"v":"D1","state":"done"}]},{"say":"Take D3 from the front of the queue.","ops":[{"v":"D3","state":"current"},{"panel":"queue","list":[{"key":"E4"}]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"},{"key":"B1"},{"key":"C1"},{"key":"C2"},{"key":"D2"},{"key":"E2"},{"key":"E1"},{"key":"E3"},{"key":"D1"},{"key":"D3"}]}]},{"say":"Add C3, the only unseen neighbor of D3, to the back of the queue.","ops":[{"v":"D3","state":"done"},{"v":"C3","state":"waiting"},{"e":["D3","C3"],"state":"tree"},{"panel":"queue","list":[{"key":"E4"},{"key":"C3"}]}]},{"say":"Take E4 from the front of the queue.","ops":[{"v":"E4","state":"current"},{"panel":"queue","list":[{"key":"C3"}]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"},{"key":"B1"},{"key":"C1"},{"key":"C2"},{"key":"D2"},{"key":"E2"},{"key":"E1"},{"key":"E3"},{"key":"D1"},{"key":"D3"},{"key":"E4"}]}]},{"say":"Add D4, the only unseen neighbor of E4, to the back of the queue.","ops":[{"v":"E4","state":"done"},{"v":"D4","state":"waiting"},{"e":["E4","D4"],"state":"tree"},{"panel":"queue","list":[{"key":"C3"},{"key":"D4"}]}]},{"say":"Take C3 from the front of the queue.","ops":[{"v":"C3","state":"current"},{"panel":"queue","list":[{"key":"D4"}]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"},{"key":"B1"},{"key":"C1"},{"key":"C2"},{"key":"D2"},{"key":"E2"},{"key":"E1"},{"key":"E3"},{"key":"D1"},{"key":"D3"},{"key":"E4"},{"key":"C3"}]}]},{"say":"Add C4, the only unseen neighbor of C3, to the back of the queue.","ops":[{"v":"C3","state":"done"},{"v":"C4","state":"waiting"},{"e":["C3","C4"],"state":"tree"},{"panel":"queue","list":[{"key":"D4"},{"key":"C4"}]}]},{"say":"Take D4 from the front of the queue.","ops":[{"v":"D4","state":"current"},{"panel":"queue","list":[{"key":"C4"}]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"},{"key":"B1"},{"key":"C1"},{"key":"C2"},{"key":"D2"},{"key":"E2"},{"key":"E1"},{"key":"E3"},{"key":"D1"},{"key":"D3"},{"key":"E4"},{"key":"C3"},{"key":"D4"}]}]},{"say":"D4 has no unseen neighbors.","ops":[{"v":"D4","state":"done"}]},{"say":"Take C4 from the front of the queue.","ops":[{"v":"C4","state":"current"},{"panel":"queue","list":[]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"},{"key":"B1"},{"key":"C1"},{"key":"C2"},{"key":"D2"},{"key":"E2"},{"key":"E1"},{"key":"E3"},{"key":"D1"},{"key":"D3"},{"key":"E4"},{"key":"C3"},{"key":"D4"},{"key":"C4"}]}]},{"say":"Add B4, the only unseen neighbor of C4, to the back of the queue.","ops":[{"v":"C4","state":"done"},{"v":"B4","state":"waiting"},{"e":["C4","B4"],"state":"tree"},{"panel":"queue","list":[{"key":"B4"}]}]},{"say":"Take B4 from the front of the queue.","ops":[{"v":"B4","state":"current"},{"panel":"queue","list":[]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"},{"key":"B1"},{"key":"C1"},{"key":"C2"},{"key":"D2"},{"key":"E2"},{"key":"E1"},{"key":"E3"},{"key":"D1"},{"key":"D3"},{"key":"E4"},{"key":"C3"},{"key":"D4"},{"key":"C4"},{"key":"B4"}]}]},{"say":"Add A4, the only unseen neighbor of B4, to the back of the queue.","ops":[{"v":"B4","state":"done"},{"v":"A4","state":"waiting"},{"e":["B4","A4"],"state":"tree"},{"panel":"queue","list":[{"key":"A4"}]}]},{"say":"Take A4 from the front of the queue.","ops":[{"v":"A4","state":"current"},{"panel":"queue","list":[]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"},{"key":"B1"},{"key":"C1"},{"key":"C2"},{"key":"D2"},{"key":"E2"},{"key":"E1"},{"key":"E3"},{"key":"D1"},{"key":"D3"},{"key":"E4"},{"key":"C3"},{"key":"D4"},{"key":"C4"},{"key":"B4"},{"key":"A4"}]}]},{"say":"Add A5, the only unseen neighbor of A4, to the back of the queue.","ops":[{"v":"A4","state":"done"},{"v":"A5","state":"waiting"},{"e":["A4","A5"],"state":"tree"},{"panel":"queue","list":[{"key":"A5"}]}]},{"say":"Take A5 from the front of the queue.","ops":[{"v":"A5","state":"current"},{"panel":"queue","list":[]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"},{"key":"B1"},{"key":"C1"},{"key":"C2"},{"key":"D2"},{"key":"E2"},{"key":"E1"},{"key":"E3"},{"key":"D1"},{"key":"D3"},{"key":"E4"},{"key":"C3"},{"key":"D4"},{"key":"C4"},{"key":"B4"},{"key":"A4"},{"key":"A5"}]}]},{"say":"Add A6, the only unseen neighbor of A5, to the back of the queue.","ops":[{"v":"A5","state":"done"},{"v":"A6","state":"waiting"},{"e":["A5","A6"],"state":"tree"},{"panel":"queue","list":[{"key":"A6"}]}]},{"say":"Take A6 from the front of the queue.","ops":[{"v":"A6","state":"current"},{"panel":"queue","list":[]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"},{"key":"B1"},{"key":"C1"},{"key":"C2"},{"key":"D2"},{"key":"E2"},{"key":"E1"},{"key":"E3"},{"key":"D1"},{"key":"D3"},{"key":"E4"},{"key":"C3"},{"key":"D4"},{"key":"C4"},{"key":"B4"},{"key":"A4"},{"key":"A5"},{"key":"A6"}]}]},{"say":"Add B6, the only unseen neighbor of A6, to the back of the queue.","ops":[{"v":"A6","state":"done"},{"v":"B6","state":"waiting"},{"e":["A6","B6"],"state":"tree"},{"panel":"queue","list":[{"key":"B6"}]}]},{"say":"Take B6 from the front of the queue.","ops":[{"v":"B6","state":"current"},{"panel":"queue","list":[]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"},{"key":"B1"},{"key":"C1"},{"key":"C2"},{"key":"D2"},{"key":"E2"},{"key":"E1"},{"key":"E3"},{"key":"D1"},{"key":"D3"},{"key":"E4"},{"key":"C3"},{"key":"D4"},{"key":"C4"},{"key":"B4"},{"key":"A4"},{"key":"A5"},{"key":"A6"},{"key":"B6"}]}]},{"say":"Add B5 and C6, the unseen neighbors of B6, to the back of the queue.","ops":[{"v":"B6","state":"done"},{"v":"B5","state":"waiting"},{"e":["B6","B5"],"state":"tree"},{"v":"C6","state":"waiting"},{"e":["B6","C6"],"state":"tree"},{"panel":"queue","list":[{"key":"B5"},{"key":"C6"}]}]},{"say":"Take B5 from the front of the queue.","ops":[{"v":"B5","state":"current"},{"panel":"queue","list":[{"key":"C6"}]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"},{"key":"B1"},{"key":"C1"},{"key":"C2"},{"key":"D2"},{"key":"E2"},{"key":"E1"},{"key":"E3"},{"key":"D1"},{"key":"D3"},{"key":"E4"},{"key":"C3"},{"key":"D4"},{"key":"C4"},{"key":"B4"},{"key":"A4"},{"key":"A5"},{"key":"A6"},{"key":"B6"},{"key":"B5"}]}]},{"say":"Add C5, the only unseen neighbor of B5, to the back of the queue.","ops":[{"v":"B5","state":"done"},{"v":"C5","state":"waiting"},{"e":["B5","C5"],"state":"tree"},{"panel":"queue","list":[{"key":"C6"},{"key":"C5"}]}]},{"say":"Take C6 from the front of the queue.","ops":[{"v":"C6","state":"current"},{"panel":"queue","list":[{"key":"C5"}]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"},{"key":"B1"},{"key":"C1"},{"key":"C2"},{"key":"D2"},{"key":"E2"},{"key":"E1"},{"key":"E3"},{"key":"D1"},{"key":"D3"},{"key":"E4"},{"key":"C3"},{"key":"D4"},{"key":"C4"},{"key":"B4"},{"key":"A4"},{"key":"A5"},{"key":"A6"},{"key":"B6"},{"key":"B5"},{"key":"C6"}]}]},{"say":"C6 has no unseen neighbors.","ops":[{"v":"C6","state":"done"}]},{"say":"Take C5 from the front of the queue.","ops":[{"v":"C5","state":"current"},{"panel":"queue","list":[]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"},{"key":"B1"},{"key":"C1"},{"key":"C2"},{"key":"D2"},{"key":"E2"},{"key":"E1"},{"key":"E3"},{"key":"D1"},{"key":"D3"},{"key":"E4"},{"key":"C3"},{"key":"D4"},{"key":"C4"},{"key":"B4"},{"key":"A4"},{"key":"A5"},{"key":"A6"},{"key":"B6"},{"key":"B5"},{"key":"C6"},{"key":"C5"}]}]},{"say":"Add D5, the only unseen neighbor of C5, to the back of the queue.","ops":[{"v":"C5","state":"done"},{"v":"D5","state":"waiting"},{"e":["C5","D5"],"state":"tree"},{"panel":"queue","list":[{"key":"D5"}]}]},{"say":"Take D5 from the front of the queue.","ops":[{"v":"D5","state":"current"},{"panel":"queue","list":[]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"},{"key":"B1"},{"key":"C1"},{"key":"C2"},{"key":"D2"},{"key":"E2"},{"key":"E1"},{"key":"E3"},{"key":"D1"},{"key":"D3"},{"key":"E4"},{"key":"C3"},{"key":"D4"},{"key":"C4"},{"key":"B4"},{"key":"A4"},{"key":"A5"},{"key":"A6"},{"key":"B6"},{"key":"B5"},{"key":"C6"},{"key":"C5"},{"key":"D5"}]}]},{"say":"Add D6, the only unseen neighbor of D5, to the back of the queue.","ops":[{"v":"D5","state":"done"},{"v":"D6","state":"waiting"},{"e":["D5","D6"],"state":"tree"},{"panel":"queue","list":[{"key":"D6"}]}]},{"say":"Take D6 from the front of the queue.","ops":[{"v":"D6","state":"current"},{"panel":"queue","list":[]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"},{"key":"B1"},{"key":"C1"},{"key":"C2"},{"key":"D2"},{"key":"E2"},{"key":"E1"},{"key":"E3"},{"key":"D1"},{"key":"D3"},{"key":"E4"},{"key":"C3"},{"key":"D4"},{"key":"C4"},{"key":"B4"},{"key":"A4"},{"key":"A5"},{"key":"A6"},{"key":"B6"},{"key":"B5"},{"key":"C6"},{"key":"C5"},{"key":"D5"},{"key":"D6"}]}]},{"say":"Add E6, the only unseen neighbor of D6, to the back of the queue.","ops":[{"v":"D6","state":"done"},{"v":"E6","state":"waiting"},{"e":["D6","E6"],"state":"tree"},{"panel":"queue","list":[{"key":"E6"}]}]},{"say":"Take E6 from the front of the queue.","ops":[{"v":"E6","state":"current"},{"panel":"queue","list":[]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"},{"key":"B1"},{"key":"C1"},{"key":"C2"},{"key":"D2"},{"key":"E2"},{"key":"E1"},{"key":"E3"},{"key":"D1"},{"key":"D3"},{"key":"E4"},{"key":"C3"},{"key":"D4"},{"key":"C4"},{"key":"B4"},{"key":"A4"},{"key":"A5"},{"key":"A6"},{"key":"B6"},{"key":"B5"},{"key":"C6"},{"key":"C5"},{"key":"D5"},{"key":"D6"},{"key":"E6"}]}]},{"say":"Add E5, the only unseen neighbor of E6, to the back of the queue.","ops":[{"v":"E6","state":"done"},{"v":"E5","state":"waiting"},{"e":["E6","E5"],"state":"tree"},{"panel":"queue","list":[{"key":"E5"}]}]},{"say":"Take E5 from the front of the queue.","ops":[{"v":"E5","state":"current"},{"panel":"queue","list":[]},{"panel":"order","list":[{"key":"A1"},{"key":"A2"},{"key":"A3"},{"key":"B3"},{"key":"B2"},{"key":"B1"},{"key":"C1"},{"key":"C2"},{"key":"D2"},{"key":"E2"},{"key":"E1"},{"key":"E3"},{"key":"D1"},{"key":"D3"},{"key":"E4"},{"key":"C3"},{"key":"D4"},{"key":"C4"},{"key":"B4"},{"key":"A4"},{"key":"A5"},{"key":"A6"},{"key":"B6"},{"key":"B5"},{"key":"C6"},{"key":"C5"},{"key":"D5"},{"key":"D6"},{"key":"E6"},{"key":"E5"}]}]},{"say":"E5 has no unseen neighbors.","ops":[{"v":"E5","state":"done"}]},{"say":"Done. Breadth-first reached 30 vertices from A1."}],"traceNote":"","verification":"The steps come from a step-by-step copy of the algorithm. Its order is checked against traverse.BFS, and the route it draws to each vertex against PathTo of path.BFSPaths, on every start.","snippet":"for v, depth := range traverse.BFSWithDepth(g, \"A1\") {\n\tfmt.Println(v.Label(), depth)\n}\n\npaths, err := path.BFSPaths(g, \"A1\")\nif err != nil {\n\treturn err\n}\nroute, _ := paths.PathTo(\"E5\")\nfor _, v := range route {\n\tfmt.Println(v.Label())\n}"}
