{"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":"karate-club","name":"Karate club","description":"The 34 members of a university karate club, numbered 1 to 34 as in the study. Each edge joins two members who also spent time together outside the club's classes and meetings. A dispute between the instructor (1) and an officer (34) split the club in two, and most members sit near the side they joined.","family":"undirected","directed":false,"weighted":false,"acyclic":false,"vertices":[{"id":"1","x":590,"y":680},{"id":"2","x":640,"y":560},{"id":"3","x":420,"y":520},{"id":"4","x":470,"y":760},{"id":"5","x":680,"y":850},{"id":"6","x":750,"y":860},{"id":"7","x":820,"y":760},{"id":"8","x":390,"y":660},{"id":"9","x":520,"y":430},{"id":"10","x":590,"y":230},{"id":"11","x":590,"y":930},{"id":"12","x":400,"y":900},{"id":"13","x":490,"y":890},{"id":"14","x":590,"y":480},{"id":"15","x":460,"y":80},{"id":"16","x":380,"y":70},{"id":"17","x":950,"y":940},{"id":"18","x":830,"y":560},{"id":"19","x":540,"y":110},{"id":"20","x":770,"y":450},{"id":"21","x":90,"y":220},{"id":"22","x":820,"y":640},{"id":"23","x":290,"y":70},{"id":"24","x":120,"y":300},{"id":"25","x":120,"y":690},{"id":"26","x":50,"y":570},{"id":"27","x":220,"y":60},{"id":"28","x":210,"y":490},{"id":"29","x":390,"y":440},{"id":"30","x":170,"y":190},{"id":"31","x":640,"y":300},{"id":"32","x":280,"y":570},{"id":"33","x":250,"y":340},{"id":"34","x":440,"y":260}],"edges":[{"from":"1","to":"2"},{"from":"1","to":"3"},{"from":"1","to":"4"},{"from":"1","to":"5"},{"from":"1","to":"6"},{"from":"1","to":"7"},{"from":"1","to":"8"},{"from":"1","to":"9"},{"from":"1","to":"11"},{"from":"1","to":"12"},{"from":"1","to":"13"},{"from":"1","to":"14"},{"from":"1","to":"18"},{"from":"1","to":"20"},{"from":"1","to":"22"},{"from":"1","to":"32"},{"from":"2","to":"3"},{"from":"2","to":"4"},{"from":"2","to":"8"},{"from":"2","to":"14"},{"from":"2","to":"18"},{"from":"2","to":"20"},{"from":"2","to":"22"},{"from":"2","to":"31"},{"from":"3","to":"4"},{"from":"3","to":"8"},{"from":"3","to":"9"},{"from":"3","to":"10"},{"from":"3","to":"14"},{"from":"3","to":"28"},{"from":"3","to":"29"},{"from":"3","to":"33"},{"from":"4","to":"8"},{"from":"4","to":"13"},{"from":"4","to":"14"},{"from":"5","to":"7"},{"from":"5","to":"11"},{"from":"6","to":"7"},{"from":"6","to":"11"},{"from":"6","to":"17"},{"from":"7","to":"17"},{"from":"9","to":"31"},{"from":"9","to":"33"},{"from":"9","to":"34"},{"from":"10","to":"34"},{"from":"14","to":"34"},{"from":"15","to":"33"},{"from":"15","to":"34"},{"from":"16","to":"33"},{"from":"16","to":"34"},{"from":"19","to":"33"},{"from":"19","to":"34"},{"from":"20","to":"34"},{"from":"21","to":"33"},{"from":"21","to":"34"},{"from":"23","to":"33"},{"from":"23","to":"34"},{"from":"24","to":"26"},{"from":"24","to":"28"},{"from":"24","to":"30"},{"from":"24","to":"33"},{"from":"24","to":"34"},{"from":"25","to":"26"},{"from":"25","to":"28"},{"from":"25","to":"32"},{"from":"26","to":"32"},{"from":"27","to":"30"},{"from":"27","to":"34"},{"from":"28","to":"34"},{"from":"29","to":"32"},{"from":"29","to":"34"},{"from":"30","to":"33"},{"from":"30","to":"34"},{"from":"31","to":"33"},{"from":"31","to":"34"},{"from":"32","to":"33"},{"from":"32","to":"34"},{"from":"33","to":"34"}],"source":"W. W. Zachary, \"An information flow model for conflict and fission in small groups\", Journal of Anthropological Research 33 (1977).","details":{"vertices":34,"edges":78,"directed":false,"weighted":false,"acyclic":false,"negativeWeights":false,"density":0.13903743315508021,"degree":{"min":1,"avg":4.588235294117647,"max":17},"selfLoops":0,"components":1}},"problem":"News starts with the instructor, member 1, and each member passes it to everyone they spend time with. In what order do the members hear it?","params":{"start":"1"},"result":{"kind":"order","vertices":["1","2","3","4","5","6","7","8","9","11","12","13","14","18","20","22","32","31","10","28","29","33","17","34","25","26","24","15","16","19","21","23","30","27"]},"answer":"From 1, breadth-first visits 34 vertices: 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, and so on to 27.","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 1. Put it in the queue.","ops":[{"v":"1","state":"waiting"},{"panel":"queue","list":[{"key":"1"}]}]},{"say":"Take 1 from the front of the queue.","ops":[{"v":"1","state":"current"},{"panel":"queue","list":[]},{"panel":"order","list":[{"key":"1"}]}]},{"say":"Add 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 18, 20, 22 and 32, the unseen neighbors of 1, to the back of the queue.","ops":[{"v":"1","state":"done"},{"v":"2","state":"waiting"},{"e":["1","2"],"state":"tree"},{"v":"3","state":"waiting"},{"e":["1","3"],"state":"tree"},{"v":"4","state":"waiting"},{"e":["1","4"],"state":"tree"},{"v":"5","state":"waiting"},{"e":["1","5"],"state":"tree"},{"v":"6","state":"waiting"},{"e":["1","6"],"state":"tree"},{"v":"7","state":"waiting"},{"e":["1","7"],"state":"tree"},{"v":"8","state":"waiting"},{"e":["1","8"],"state":"tree"},{"v":"9","state":"waiting"},{"e":["1","9"],"state":"tree"},{"v":"11","state":"waiting"},{"e":["1","11"],"state":"tree"},{"v":"12","state":"waiting"},{"e":["1","12"],"state":"tree"},{"v":"13","state":"waiting"},{"e":["1","13"],"state":"tree"},{"v":"14","state":"waiting"},{"e":["1","14"],"state":"tree"},{"v":"18","state":"waiting"},{"e":["1","18"],"state":"tree"},{"v":"20","state":"waiting"},{"e":["1","20"],"state":"tree"},{"v":"22","state":"waiting"},{"e":["1","22"],"state":"tree"},{"v":"32","state":"waiting"},{"e":["1","32"],"state":"tree"},{"panel":"queue","list":[{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"}]}]},{"say":"Take 2 from the front of the queue.","ops":[{"v":"2","state":"current"},{"panel":"queue","list":[{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"}]}]},{"say":"Add 31, the only unseen neighbor of 2, to the back of the queue.","ops":[{"v":"2","state":"done"},{"v":"31","state":"waiting"},{"e":["2","31"],"state":"tree"},{"panel":"queue","list":[{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"}]}]},{"say":"Take 3 from the front of the queue.","ops":[{"v":"3","state":"current"},{"panel":"queue","list":[{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"}]}]},{"say":"Add 10, 28, 29 and 33, the unseen neighbors of 3, to the back of the queue.","ops":[{"v":"3","state":"done"},{"v":"10","state":"waiting"},{"e":["3","10"],"state":"tree"},{"v":"28","state":"waiting"},{"e":["3","28"],"state":"tree"},{"v":"29","state":"waiting"},{"e":["3","29"],"state":"tree"},{"v":"33","state":"waiting"},{"e":["3","33"],"state":"tree"},{"panel":"queue","list":[{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"}]}]},{"say":"Take 4 from the front of the queue.","ops":[{"v":"4","state":"current"},{"panel":"queue","list":[{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"}]}]},{"say":"4 has no unseen neighbors.","ops":[{"v":"4","state":"done"}]},{"say":"Take 5 from the front of the queue.","ops":[{"v":"5","state":"current"},{"panel":"queue","list":[{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"}]}]},{"say":"5 has no unseen neighbors.","ops":[{"v":"5","state":"done"}]},{"say":"Take 6 from the front of the queue.","ops":[{"v":"6","state":"current"},{"panel":"queue","list":[{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"}]}]},{"say":"Add 17, the only unseen neighbor of 6, to the back of the queue.","ops":[{"v":"6","state":"done"},{"v":"17","state":"waiting"},{"e":["6","17"],"state":"tree"},{"panel":"queue","list":[{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"}]}]},{"say":"Take 7 from the front of the queue.","ops":[{"v":"7","state":"current"},{"panel":"queue","list":[{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"}]}]},{"say":"7 has no unseen neighbors.","ops":[{"v":"7","state":"done"}]},{"say":"Take 8 from the front of the queue.","ops":[{"v":"8","state":"current"},{"panel":"queue","list":[{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"}]}]},{"say":"8 has no unseen neighbors.","ops":[{"v":"8","state":"done"}]},{"say":"Take 9 from the front of the queue.","ops":[{"v":"9","state":"current"},{"panel":"queue","list":[{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"}]}]},{"say":"Add 34, the only unseen neighbor of 9, to the back of the queue.","ops":[{"v":"9","state":"done"},{"v":"34","state":"waiting"},{"e":["9","34"],"state":"tree"},{"panel":"queue","list":[{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"},{"key":"34"}]}]},{"say":"Take 11 from the front of the queue.","ops":[{"v":"11","state":"current"},{"panel":"queue","list":[{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"},{"key":"34"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"}]}]},{"say":"11 has no unseen neighbors.","ops":[{"v":"11","state":"done"}]},{"say":"Take 12 from the front of the queue.","ops":[{"v":"12","state":"current"},{"panel":"queue","list":[{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"},{"key":"34"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"}]}]},{"say":"12 has no unseen neighbors.","ops":[{"v":"12","state":"done"}]},{"say":"Take 13 from the front of the queue.","ops":[{"v":"13","state":"current"},{"panel":"queue","list":[{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"},{"key":"34"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"}]}]},{"say":"13 has no unseen neighbors.","ops":[{"v":"13","state":"done"}]},{"say":"Take 14 from the front of the queue.","ops":[{"v":"14","state":"current"},{"panel":"queue","list":[{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"},{"key":"34"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"}]}]},{"say":"14 has no unseen neighbors.","ops":[{"v":"14","state":"done"}]},{"say":"Take 18 from the front of the queue.","ops":[{"v":"18","state":"current"},{"panel":"queue","list":[{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"},{"key":"34"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"}]}]},{"say":"18 has no unseen neighbors.","ops":[{"v":"18","state":"done"}]},{"say":"Take 20 from the front of the queue.","ops":[{"v":"20","state":"current"},{"panel":"queue","list":[{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"},{"key":"34"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"}]}]},{"say":"20 has no unseen neighbors.","ops":[{"v":"20","state":"done"}]},{"say":"Take 22 from the front of the queue.","ops":[{"v":"22","state":"current"},{"panel":"queue","list":[{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"},{"key":"34"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"}]}]},{"say":"22 has no unseen neighbors.","ops":[{"v":"22","state":"done"}]},{"say":"Take 32 from the front of the queue.","ops":[{"v":"32","state":"current"},{"panel":"queue","list":[{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"},{"key":"34"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"}]}]},{"say":"Add 25 and 26, the unseen neighbors of 32, to the back of the queue.","ops":[{"v":"32","state":"done"},{"v":"25","state":"waiting"},{"e":["32","25"],"state":"tree"},{"v":"26","state":"waiting"},{"e":["32","26"],"state":"tree"},{"panel":"queue","list":[{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"},{"key":"34"},{"key":"25"},{"key":"26"}]}]},{"say":"Take 31 from the front of the queue.","ops":[{"v":"31","state":"current"},{"panel":"queue","list":[{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"},{"key":"34"},{"key":"25"},{"key":"26"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"}]}]},{"say":"31 has no unseen neighbors.","ops":[{"v":"31","state":"done"}]},{"say":"Take 10 from the front of the queue.","ops":[{"v":"10","state":"current"},{"panel":"queue","list":[{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"},{"key":"34"},{"key":"25"},{"key":"26"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"}]}]},{"say":"10 has no unseen neighbors.","ops":[{"v":"10","state":"done"}]},{"say":"Take 28 from the front of the queue.","ops":[{"v":"28","state":"current"},{"panel":"queue","list":[{"key":"29"},{"key":"33"},{"key":"17"},{"key":"34"},{"key":"25"},{"key":"26"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"}]}]},{"say":"Add 24, the only unseen neighbor of 28, to the back of the queue.","ops":[{"v":"28","state":"done"},{"v":"24","state":"waiting"},{"e":["28","24"],"state":"tree"},{"panel":"queue","list":[{"key":"29"},{"key":"33"},{"key":"17"},{"key":"34"},{"key":"25"},{"key":"26"},{"key":"24"}]}]},{"say":"Take 29 from the front of the queue.","ops":[{"v":"29","state":"current"},{"panel":"queue","list":[{"key":"33"},{"key":"17"},{"key":"34"},{"key":"25"},{"key":"26"},{"key":"24"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"}]}]},{"say":"29 has no unseen neighbors.","ops":[{"v":"29","state":"done"}]},{"say":"Take 33 from the front of the queue.","ops":[{"v":"33","state":"current"},{"panel":"queue","list":[{"key":"17"},{"key":"34"},{"key":"25"},{"key":"26"},{"key":"24"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"}]}]},{"say":"Add 15, 16, 19, 21, 23 and 30, the unseen neighbors of 33, to the back of the queue.","ops":[{"v":"33","state":"done"},{"v":"15","state":"waiting"},{"e":["33","15"],"state":"tree"},{"v":"16","state":"waiting"},{"e":["33","16"],"state":"tree"},{"v":"19","state":"waiting"},{"e":["33","19"],"state":"tree"},{"v":"21","state":"waiting"},{"e":["33","21"],"state":"tree"},{"v":"23","state":"waiting"},{"e":["33","23"],"state":"tree"},{"v":"30","state":"waiting"},{"e":["33","30"],"state":"tree"},{"panel":"queue","list":[{"key":"17"},{"key":"34"},{"key":"25"},{"key":"26"},{"key":"24"},{"key":"15"},{"key":"16"},{"key":"19"},{"key":"21"},{"key":"23"},{"key":"30"}]}]},{"say":"Take 17 from the front of the queue.","ops":[{"v":"17","state":"current"},{"panel":"queue","list":[{"key":"34"},{"key":"25"},{"key":"26"},{"key":"24"},{"key":"15"},{"key":"16"},{"key":"19"},{"key":"21"},{"key":"23"},{"key":"30"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"}]}]},{"say":"17 has no unseen neighbors.","ops":[{"v":"17","state":"done"}]},{"say":"Take 34 from the front of the queue.","ops":[{"v":"34","state":"current"},{"panel":"queue","list":[{"key":"25"},{"key":"26"},{"key":"24"},{"key":"15"},{"key":"16"},{"key":"19"},{"key":"21"},{"key":"23"},{"key":"30"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"},{"key":"34"}]}]},{"say":"Add 27, the only unseen neighbor of 34, to the back of the queue.","ops":[{"v":"34","state":"done"},{"v":"27","state":"waiting"},{"e":["34","27"],"state":"tree"},{"panel":"queue","list":[{"key":"25"},{"key":"26"},{"key":"24"},{"key":"15"},{"key":"16"},{"key":"19"},{"key":"21"},{"key":"23"},{"key":"30"},{"key":"27"}]}]},{"say":"Take 25 from the front of the queue.","ops":[{"v":"25","state":"current"},{"panel":"queue","list":[{"key":"26"},{"key":"24"},{"key":"15"},{"key":"16"},{"key":"19"},{"key":"21"},{"key":"23"},{"key":"30"},{"key":"27"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"},{"key":"34"},{"key":"25"}]}]},{"say":"25 has no unseen neighbors.","ops":[{"v":"25","state":"done"}]},{"say":"Take 26 from the front of the queue.","ops":[{"v":"26","state":"current"},{"panel":"queue","list":[{"key":"24"},{"key":"15"},{"key":"16"},{"key":"19"},{"key":"21"},{"key":"23"},{"key":"30"},{"key":"27"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"},{"key":"34"},{"key":"25"},{"key":"26"}]}]},{"say":"26 has no unseen neighbors.","ops":[{"v":"26","state":"done"}]},{"say":"Take 24 from the front of the queue.","ops":[{"v":"24","state":"current"},{"panel":"queue","list":[{"key":"15"},{"key":"16"},{"key":"19"},{"key":"21"},{"key":"23"},{"key":"30"},{"key":"27"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"},{"key":"34"},{"key":"25"},{"key":"26"},{"key":"24"}]}]},{"say":"24 has no unseen neighbors.","ops":[{"v":"24","state":"done"}]},{"say":"Take 15 from the front of the queue.","ops":[{"v":"15","state":"current"},{"panel":"queue","list":[{"key":"16"},{"key":"19"},{"key":"21"},{"key":"23"},{"key":"30"},{"key":"27"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"},{"key":"34"},{"key":"25"},{"key":"26"},{"key":"24"},{"key":"15"}]}]},{"say":"15 has no unseen neighbors.","ops":[{"v":"15","state":"done"}]},{"say":"Take 16 from the front of the queue.","ops":[{"v":"16","state":"current"},{"panel":"queue","list":[{"key":"19"},{"key":"21"},{"key":"23"},{"key":"30"},{"key":"27"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"},{"key":"34"},{"key":"25"},{"key":"26"},{"key":"24"},{"key":"15"},{"key":"16"}]}]},{"say":"16 has no unseen neighbors.","ops":[{"v":"16","state":"done"}]},{"say":"Take 19 from the front of the queue.","ops":[{"v":"19","state":"current"},{"panel":"queue","list":[{"key":"21"},{"key":"23"},{"key":"30"},{"key":"27"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"},{"key":"34"},{"key":"25"},{"key":"26"},{"key":"24"},{"key":"15"},{"key":"16"},{"key":"19"}]}]},{"say":"19 has no unseen neighbors.","ops":[{"v":"19","state":"done"}]},{"say":"Take 21 from the front of the queue.","ops":[{"v":"21","state":"current"},{"panel":"queue","list":[{"key":"23"},{"key":"30"},{"key":"27"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"},{"key":"34"},{"key":"25"},{"key":"26"},{"key":"24"},{"key":"15"},{"key":"16"},{"key":"19"},{"key":"21"}]}]},{"say":"21 has no unseen neighbors.","ops":[{"v":"21","state":"done"}]},{"say":"Take 23 from the front of the queue.","ops":[{"v":"23","state":"current"},{"panel":"queue","list":[{"key":"30"},{"key":"27"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"},{"key":"34"},{"key":"25"},{"key":"26"},{"key":"24"},{"key":"15"},{"key":"16"},{"key":"19"},{"key":"21"},{"key":"23"}]}]},{"say":"23 has no unseen neighbors.","ops":[{"v":"23","state":"done"}]},{"say":"Take 30 from the front of the queue.","ops":[{"v":"30","state":"current"},{"panel":"queue","list":[{"key":"27"}]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"},{"key":"34"},{"key":"25"},{"key":"26"},{"key":"24"},{"key":"15"},{"key":"16"},{"key":"19"},{"key":"21"},{"key":"23"},{"key":"30"}]}]},{"say":"30 has no unseen neighbors.","ops":[{"v":"30","state":"done"}]},{"say":"Take 27 from the front of the queue.","ops":[{"v":"27","state":"current"},{"panel":"queue","list":[]},{"panel":"order","list":[{"key":"1"},{"key":"2"},{"key":"3"},{"key":"4"},{"key":"5"},{"key":"6"},{"key":"7"},{"key":"8"},{"key":"9"},{"key":"11"},{"key":"12"},{"key":"13"},{"key":"14"},{"key":"18"},{"key":"20"},{"key":"22"},{"key":"32"},{"key":"31"},{"key":"10"},{"key":"28"},{"key":"29"},{"key":"33"},{"key":"17"},{"key":"34"},{"key":"25"},{"key":"26"},{"key":"24"},{"key":"15"},{"key":"16"},{"key":"19"},{"key":"21"},{"key":"23"},{"key":"30"},{"key":"27"}]}]},{"say":"27 has no unseen neighbors.","ops":[{"v":"27","state":"done"}]},{"say":"Done. Breadth-first reached 34 vertices from 1."}],"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, \"1\") {\n\tfmt.Println(v.Label(), depth)\n}\n\npaths, err := path.BFSPaths(g, \"1\")\nif err != nil {\n\treturn err\n}\nroute, _ := paths.PathTo(\"15\")\nfor _, v := range route {\n\tfmt.Println(v.Label())\n}"}
