{"algorithm":"kosaraju","about":["Kosaraju's algorithm finds the strongly connected components with two depth-first searches. The first runs over the whole graph and notes each vertex as it finishes, after everything it leads to. The second runs on a copy of the graph with every edge reversed, and takes its start vertices from the last one to finish to the first.","The vertex that finishes last is in a component that no other component can reach. With the edges reversed, a search from it can't leave that component, so it collects exactly that component. Each later search does the same with what is left, so a component comes out before any component it can reach.","Both searches cost O(V+E), and the reversed copy takes O(V+E) more memory than Tarjan or Gabow need. In exchange, each search is a plain depth-first search with nothing more to track."],"template":{"id":"linked-pages","name":"Linked web pages","description":"Forty pages of a product website, P1 to P40, where P stands for page: the main site (P1 to P13), the blog (P14 to P19), landing pages (P20 to P24), the help center (P25 to P28), the docs (P29 to P38) and the status pages (P39 and P40). Each edge counts the links from one page to another. Only ads and emails lead to the landing pages, and the help center, docs and status pages never link back to the main site.","family":"cyclic","directed":true,"weighted":true,"acyclic":false,"vertices":[{"id":"P1","x":225,"y":687},{"id":"P2","x":134,"y":683},{"id":"P3","x":239,"y":604},{"id":"P4","x":206,"y":763},{"id":"P5","x":112,"y":601},{"id":"P6","x":312,"y":664},{"id":"P7","x":103,"y":760},{"id":"P8","x":200,"y":532},{"id":"P9","x":288,"y":782},{"id":"P10","x":40,"y":650},{"id":"P11","x":327,"y":576},{"id":"P12","x":157,"y":836},{"id":"P13","x":105,"y":516},{"id":"P14","x":324,"y":298},{"id":"P15","x":258,"y":341},{"id":"P16","x":189,"y":305},{"id":"P17","x":185,"y":228},{"id":"P18","x":250,"y":185},{"id":"P19","x":320,"y":221},{"id":"P20","x":483,"y":182},{"id":"P21","x":503,"y":107},{"id":"P22","x":580,"y":102},{"id":"P23","x":609,"y":174},{"id":"P24","x":549,"y":224},{"id":"P25","x":822,"y":255},{"id":"P26","x":840,"y":330},{"id":"P27","x":765,"y":349},{"id":"P28","x":746,"y":274},{"id":"P29","x":855,"y":670},{"id":"P30","x":777,"y":716},{"id":"P31","x":823,"y":592},{"id":"P32","x":881,"y":744},{"id":"P33","x":714,"y":658},{"id":"P34","x":916,"y":604},{"id":"P35","x":793,"y":797},{"id":"P36","x":751,"y":553},{"id":"P37","x":960,"y":715},{"id":"P38","x":680,"y":738},{"id":"P39","x":531,"y":898},{"id":"P40","x":506,"y":824}],"edges":[{"from":"P1","to":"P2","weight":2},{"from":"P1","to":"P3","weight":2},{"from":"P1","to":"P4","weight":1},{"from":"P1","to":"P6","weight":1},{"from":"P1","to":"P14","weight":1},{"from":"P1","to":"P29","weight":1},{"from":"P1","to":"P9","weight":3},{"from":"P1","to":"P10","weight":1},{"from":"P1","to":"P25","weight":1},{"from":"P1","to":"P39","weight":1},{"from":"P2","to":"P1","weight":1},{"from":"P2","to":"P3","weight":2},{"from":"P2","to":"P5","weight":1},{"from":"P2","to":"P9","weight":2},{"from":"P2","to":"P29","weight":1},{"from":"P3","to":"P1","weight":1},{"from":"P3","to":"P9","weight":3},{"from":"P3","to":"P8","weight":1},{"from":"P3","to":"P26","weight":1},{"from":"P3","to":"P11","weight":1},{"from":"P4","to":"P1","weight":1},{"from":"P4","to":"P17","weight":2},{"from":"P4","to":"P9","weight":1},{"from":"P5","to":"P2","weight":1},{"from":"P5","to":"P33","weight":2},{"from":"P6","to":"P1","weight":1},{"from":"P6","to":"P7","weight":2},{"from":"P6","to":"P8","weight":1},{"from":"P6","to":"P14","weight":1},{"from":"P7","to":"P6","weight":1},{"from":"P7","to":"P18","weight":1},{"from":"P8","to":"P1","weight":1},{"from":"P8","to":"P25","weight":1},{"from":"P9","to":"P1","weight":1},{"from":"P9","to":"P10","weight":1},{"from":"P9","to":"P13","weight":1},{"from":"P9","to":"P12","weight":1},{"from":"P10","to":"P9","weight":1},{"from":"P10","to":"P28","weight":1},{"from":"P11","to":"P1","weight":1},{"from":"P11","to":"P12","weight":1},{"from":"P11","to":"P39","weight":1},{"from":"P12","to":"P1","weight":1},{"from":"P12","to":"P13","weight":1},{"from":"P13","to":"P1","weight":1},{"from":"P13","to":"P12","weight":1},{"from":"P14","to":"P1","weight":1},{"from":"P14","to":"P15","weight":1},{"from":"P14","to":"P16","weight":1},{"from":"P14","to":"P17","weight":1},{"from":"P14","to":"P18","weight":1},{"from":"P15","to":"P14","weight":1},{"from":"P15","to":"P16","weight":1},{"from":"P15","to":"P9","weight":1},{"from":"P16","to":"P14","weight":1},{"from":"P16","to":"P15","weight":1},{"from":"P16","to":"P38","weight":2},{"from":"P16","to":"P2","weight":1},{"from":"P17","to":"P14","weight":1},{"from":"P17","to":"P4","weight":1},{"from":"P17","to":"P3","weight":1},{"from":"P18","to":"P14","weight":1},{"from":"P18","to":"P7","weight":3},{"from":"P19","to":"P14","weight":1},{"from":"P19","to":"P16","weight":1},{"from":"P20","to":"P3","weight":2},{"from":"P20","to":"P9","weight":3},{"from":"P21","to":"P9","weight":1},{"from":"P21","to":"P16","weight":1},{"from":"P22","to":"P3","weight":1},{"from":"P22","to":"P9","weight":2},{"from":"P22","to":"P4","weight":1},{"from":"P23","to":"P9","weight":2},{"from":"P23","to":"P31","weight":1},{"from":"P24","to":"P1","weight":1},{"from":"P24","to":"P12","weight":1},{"from":"P25","to":"P26","weight":1},{"from":"P25","to":"P27","weight":1},{"from":"P25","to":"P28","weight":1},{"from":"P25","to":"P37","weight":1},{"from":"P26","to":"P25","weight":1},{"from":"P26","to":"P27","weight":1},{"from":"P27","to":"P25","weight":1},{"from":"P27","to":"P28","weight":2},{"from":"P28","to":"P25","weight":1},{"from":"P28","to":"P27","weight":1},{"from":"P29","to":"P30","weight":2},{"from":"P29","to":"P31","weight":1},{"from":"P29","to":"P33","weight":1},{"from":"P29","to":"P36","weight":1},{"from":"P29","to":"P37","weight":1},{"from":"P30","to":"P29","weight":1},{"from":"P30","to":"P31","weight":2},{"from":"P30","to":"P38","weight":1},{"from":"P31","to":"P29","weight":1},{"from":"P31","to":"P32","weight":2},{"from":"P31","to":"P36","weight":1},{"from":"P32","to":"P31","weight":1},{"from":"P32","to":"P33","weight":1},{"from":"P33","to":"P29","weight":1},{"from":"P33","to":"P34","weight":2},{"from":"P33","to":"P35","weight":2},{"from":"P34","to":"P33","weight":1},{"from":"P34","to":"P35","weight":1},{"from":"P35","to":"P33","weight":1},{"from":"P35","to":"P37","weight":1},{"from":"P36","to":"P29","weight":1},{"from":"P36","to":"P32","weight":1},{"from":"P37","to":"P29","weight":1},{"from":"P37","to":"P30","weight":1},{"from":"P38","to":"P30","weight":1},{"from":"P38","to":"P32","weight":1},{"from":"P39","to":"P40","weight":2},{"from":"P40","to":"P39","weight":1}],"details":{"vertices":40,"edges":114,"directed":true,"weighted":true,"acyclic":false,"weightMin":1,"weightMax":3,"negativeWeights":false,"density":0.07307692307692308,"inDegree":{"min":0,"avg":2.85,"max":11},"outDegree":{"min":1,"avg":2.85,"max":10},"selfLoops":0,"components":1}},"problem":"Which groups of pages can a visitor move around freely, getting from any page of a group to any other by following links?","params":{},"result":{"kind":"groups","groups":[["P24"],["P23"],["P22"],["P21"],["P20"],["P19"],["P1","P2","P3","P4","P5","P6","P7","P8","P9","P10","P11","P12","P13","P14","P15","P16","P17","P18"],["P39","P40"],["P25","P26","P27","P28"],["P29","P30","P31","P32","P33","P34","P35","P36","P37","P38"]]},"answer":"The graph has 10 strongly connected components. The ones with more than one vertex are P1, P2, P3, P4, P5, P6, P7, P8, P9, P10 and 8 more; P39 and P40; P25, P26, P27 and P28; P29, P30, P31, P32, P33, P34, P35, P36, P37 and P38. The other 6 components have one vertex each: P24, P23, P22, P21, P20 and P19.","legend":{"vertex":[{"id":"idle","label":"Not reached","color":"#64748B","shape":"hollow"},{"id":"current","label":"On the search path","color":"#56B4E9","shape":"ring"},{"id":"waiting","label":"Finished, waits for the second pass","color":"#E69F00","shape":"dashed-square"},{"id":"done","label":"In a component","color":"#009E73","shape":"filled"},{"id":"component-7","label":"Component 7, 18 vertices","color":"#56B4E9","shape":"filled"},{"id":"component-8","label":"Component 8, 2 vertices","color":"#CC79A7","shape":"dashed-square"},{"id":"component-9","label":"Component 9, 4 vertices","color":"#E69F00","shape":"filled"},{"id":"component-10","label":"Component 10, 10 vertices","color":"#F0E442","shape":"dashed-square"},{"id":"single","label":"A component of one vertex","color":"#CBD5E1","shape":"hollow"}],"edge":[{"id":"idle","label":"Edge","color":"#475569","shape":"line"},{"id":"tree","label":"Used to reach a vertex in the first pass","color":"#009E73","shape":"thick"},{"id":"reversed","label":"Followed backwards in the second pass","color":"#CC79A7","shape":"dashed"}],"panels":[{"id":"finished","title":"Finish stack, last finished on top","kind":"list"},{"id":"components","title":"Components found","kind":"groups"}]},"steps":[{"say":"Kosaraju makes two passes. The first searches depth-first from each vertex no earlier search has reached, in the graph's vertex order, and pushes each vertex on a stack when it finishes, once every vertex it has an edge to has been reached. The second pass reverses every edge and searches again, taking its starts from the top of that stack. Each search in the second pass reaches exactly one strongly connected component."},{"say":"Start the first pass at P1, the first vertex.","ops":[{"v":"P1","state":"current"}]},{"say":"Follow P1 to P2.","ops":[{"v":"P2","state":"current"},{"e":["P1","P2"],"state":"tree"}]},{"say":"Follow P2 to P3.","ops":[{"v":"P3","state":"current"},{"e":["P2","P3"],"state":"tree"}]},{"say":"Follow P3 to P9.","ops":[{"v":"P9","state":"current"},{"e":["P3","P9"],"state":"tree"}]},{"say":"Follow P9 to P10.","ops":[{"v":"P10","state":"current"},{"e":["P9","P10"],"state":"tree"}]},{"say":"Follow P10 to P28.","ops":[{"v":"P28","state":"current"},{"e":["P10","P28"],"state":"tree"}]},{"say":"Follow P28 to P25.","ops":[{"v":"P25","state":"current"},{"e":["P28","P25"],"state":"tree"}]},{"say":"Follow P25 to P26.","ops":[{"v":"P26","state":"current"},{"e":["P25","P26"],"state":"tree"}]},{"say":"Follow P26 to P27.","ops":[{"v":"P27","state":"current"},{"e":["P26","P27"],"state":"tree"}]},{"say":"P27 has no unreached neighbors left, so it finishes, number 1. Push it on the finish stack. Back to P26.","ops":[{"v":"P27","state":"waiting"},{"panel":"finished","list":[{"key":"P27","note":"1"}]}]},{"say":"P26 has no unreached neighbors left, so it finishes, number 2. Push it on the finish stack. Back to P25.","ops":[{"v":"P26","state":"waiting"},{"panel":"finished","list":[{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"Follow P25 to P37.","ops":[{"v":"P37","state":"current"},{"e":["P25","P37"],"state":"tree"}]},{"say":"Follow P37 to P29.","ops":[{"v":"P29","state":"current"},{"e":["P37","P29"],"state":"tree"}]},{"say":"Follow P29 to P30.","ops":[{"v":"P30","state":"current"},{"e":["P29","P30"],"state":"tree"}]},{"say":"Follow P30 to P31.","ops":[{"v":"P31","state":"current"},{"e":["P30","P31"],"state":"tree"}]},{"say":"Follow P31 to P32.","ops":[{"v":"P32","state":"current"},{"e":["P31","P32"],"state":"tree"}]},{"say":"Follow P32 to P33.","ops":[{"v":"P33","state":"current"},{"e":["P32","P33"],"state":"tree"}]},{"say":"Follow P33 to P34.","ops":[{"v":"P34","state":"current"},{"e":["P33","P34"],"state":"tree"}]},{"say":"Follow P34 to P35.","ops":[{"v":"P35","state":"current"},{"e":["P34","P35"],"state":"tree"}]},{"say":"P35 has no unreached neighbors left, so it finishes, number 3. Push it on the finish stack. Back to P34.","ops":[{"v":"P35","state":"waiting"},{"panel":"finished","list":[{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P34 has no unreached neighbors left, so it finishes, number 4. Push it on the finish stack. Back to P33.","ops":[{"v":"P34","state":"waiting"},{"panel":"finished","list":[{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P33 has no unreached neighbors left, so it finishes, number 5. Push it on the finish stack. Back to P32.","ops":[{"v":"P33","state":"waiting"},{"panel":"finished","list":[{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P32 has no unreached neighbors left, so it finishes, number 6. Push it on the finish stack. Back to P31.","ops":[{"v":"P32","state":"waiting"},{"panel":"finished","list":[{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"Follow P31 to P36.","ops":[{"v":"P36","state":"current"},{"e":["P31","P36"],"state":"tree"}]},{"say":"P36 has no unreached neighbors left, so it finishes, number 7. Push it on the finish stack. Back to P31.","ops":[{"v":"P36","state":"waiting"},{"panel":"finished","list":[{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P31 has no unreached neighbors left, so it finishes, number 8. Push it on the finish stack. Back to P30.","ops":[{"v":"P31","state":"waiting"},{"panel":"finished","list":[{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"Follow P30 to P38.","ops":[{"v":"P38","state":"current"},{"e":["P30","P38"],"state":"tree"}]},{"say":"P38 has no unreached neighbors left, so it finishes, number 9. Push it on the finish stack. Back to P30.","ops":[{"v":"P38","state":"waiting"},{"panel":"finished","list":[{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P30 has no unreached neighbors left, so it finishes, number 10. Push it on the finish stack. Back to P29.","ops":[{"v":"P30","state":"waiting"},{"panel":"finished","list":[{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P29 has no unreached neighbors left, so it finishes, number 11. Push it on the finish stack. Back to P37.","ops":[{"v":"P29","state":"waiting"},{"panel":"finished","list":[{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P37 has no unreached neighbors left, so it finishes, number 12. Push it on the finish stack. Back to P25.","ops":[{"v":"P37","state":"waiting"},{"panel":"finished","list":[{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P25 has no unreached neighbors left, so it finishes, number 13. Push it on the finish stack. Back to P28.","ops":[{"v":"P25","state":"waiting"},{"panel":"finished","list":[{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P28 has no unreached neighbors left, so it finishes, number 14. Push it on the finish stack. Back to P10.","ops":[{"v":"P28","state":"waiting"},{"panel":"finished","list":[{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P10 has no unreached neighbors left, so it finishes, number 15. Push it on the finish stack. Back to P9.","ops":[{"v":"P10","state":"waiting"},{"panel":"finished","list":[{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"Follow P9 to P13.","ops":[{"v":"P13","state":"current"},{"e":["P9","P13"],"state":"tree"}]},{"say":"Follow P13 to P12.","ops":[{"v":"P12","state":"current"},{"e":["P13","P12"],"state":"tree"}]},{"say":"P12 has no unreached neighbors left, so it finishes, number 16. Push it on the finish stack. Back to P13.","ops":[{"v":"P12","state":"waiting"},{"panel":"finished","list":[{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P13 has no unreached neighbors left, so it finishes, number 17. Push it on the finish stack. Back to P9.","ops":[{"v":"P13","state":"waiting"},{"panel":"finished","list":[{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P9 has no unreached neighbors left, so it finishes, number 18. Push it on the finish stack. Back to P3.","ops":[{"v":"P9","state":"waiting"},{"panel":"finished","list":[{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"Follow P3 to P8.","ops":[{"v":"P8","state":"current"},{"e":["P3","P8"],"state":"tree"}]},{"say":"P8 has no unreached neighbors left, so it finishes, number 19. Push it on the finish stack. Back to P3.","ops":[{"v":"P8","state":"waiting"},{"panel":"finished","list":[{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"Follow P3 to P11.","ops":[{"v":"P11","state":"current"},{"e":["P3","P11"],"state":"tree"}]},{"say":"Follow P11 to P39.","ops":[{"v":"P39","state":"current"},{"e":["P11","P39"],"state":"tree"}]},{"say":"Follow P39 to P40.","ops":[{"v":"P40","state":"current"},{"e":["P39","P40"],"state":"tree"}]},{"say":"P40 has no unreached neighbors left, so it finishes, number 20. Push it on the finish stack. Back to P39.","ops":[{"v":"P40","state":"waiting"},{"panel":"finished","list":[{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P39 has no unreached neighbors left, so it finishes, number 21. Push it on the finish stack. Back to P11.","ops":[{"v":"P39","state":"waiting"},{"panel":"finished","list":[{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P11 has no unreached neighbors left, so it finishes, number 22. Push it on the finish stack. Back to P3.","ops":[{"v":"P11","state":"waiting"},{"panel":"finished","list":[{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P3 has no unreached neighbors left, so it finishes, number 23. Push it on the finish stack. Back to P2.","ops":[{"v":"P3","state":"waiting"},{"panel":"finished","list":[{"key":"P3","note":"23"},{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"Follow P2 to P5.","ops":[{"v":"P5","state":"current"},{"e":["P2","P5"],"state":"tree"}]},{"say":"P5 has no unreached neighbors left, so it finishes, number 24. Push it on the finish stack. Back to P2.","ops":[{"v":"P5","state":"waiting"},{"panel":"finished","list":[{"key":"P5","note":"24"},{"key":"P3","note":"23"},{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P2 has no unreached neighbors left, so it finishes, number 25. Push it on the finish stack. Back to P1.","ops":[{"v":"P2","state":"waiting"},{"panel":"finished","list":[{"key":"P2","note":"25"},{"key":"P5","note":"24"},{"key":"P3","note":"23"},{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"Follow P1 to P4.","ops":[{"v":"P4","state":"current"},{"e":["P1","P4"],"state":"tree"}]},{"say":"Follow P4 to P17.","ops":[{"v":"P17","state":"current"},{"e":["P4","P17"],"state":"tree"}]},{"say":"Follow P17 to P14.","ops":[{"v":"P14","state":"current"},{"e":["P17","P14"],"state":"tree"}]},{"say":"Follow P14 to P15.","ops":[{"v":"P15","state":"current"},{"e":["P14","P15"],"state":"tree"}]},{"say":"Follow P15 to P16.","ops":[{"v":"P16","state":"current"},{"e":["P15","P16"],"state":"tree"}]},{"say":"P16 has no unreached neighbors left, so it finishes, number 26. Push it on the finish stack. Back to P15.","ops":[{"v":"P16","state":"waiting"},{"panel":"finished","list":[{"key":"P16","note":"26"},{"key":"P2","note":"25"},{"key":"P5","note":"24"},{"key":"P3","note":"23"},{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P15 has no unreached neighbors left, so it finishes, number 27. Push it on the finish stack. Back to P14.","ops":[{"v":"P15","state":"waiting"},{"panel":"finished","list":[{"key":"P15","note":"27"},{"key":"P16","note":"26"},{"key":"P2","note":"25"},{"key":"P5","note":"24"},{"key":"P3","note":"23"},{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"Follow P14 to P18.","ops":[{"v":"P18","state":"current"},{"e":["P14","P18"],"state":"tree"}]},{"say":"Follow P18 to P7.","ops":[{"v":"P7","state":"current"},{"e":["P18","P7"],"state":"tree"}]},{"say":"Follow P7 to P6.","ops":[{"v":"P6","state":"current"},{"e":["P7","P6"],"state":"tree"}]},{"say":"P6 has no unreached neighbors left, so it finishes, number 28. Push it on the finish stack. Back to P7.","ops":[{"v":"P6","state":"waiting"},{"panel":"finished","list":[{"key":"P6","note":"28"},{"key":"P15","note":"27"},{"key":"P16","note":"26"},{"key":"P2","note":"25"},{"key":"P5","note":"24"},{"key":"P3","note":"23"},{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P7 has no unreached neighbors left, so it finishes, number 29. Push it on the finish stack. Back to P18.","ops":[{"v":"P7","state":"waiting"},{"panel":"finished","list":[{"key":"P7","note":"29"},{"key":"P6","note":"28"},{"key":"P15","note":"27"},{"key":"P16","note":"26"},{"key":"P2","note":"25"},{"key":"P5","note":"24"},{"key":"P3","note":"23"},{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P18 has no unreached neighbors left, so it finishes, number 30. Push it on the finish stack. Back to P14.","ops":[{"v":"P18","state":"waiting"},{"panel":"finished","list":[{"key":"P18","note":"30"},{"key":"P7","note":"29"},{"key":"P6","note":"28"},{"key":"P15","note":"27"},{"key":"P16","note":"26"},{"key":"P2","note":"25"},{"key":"P5","note":"24"},{"key":"P3","note":"23"},{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P14 has no unreached neighbors left, so it finishes, number 31. Push it on the finish stack. Back to P17.","ops":[{"v":"P14","state":"waiting"},{"panel":"finished","list":[{"key":"P14","note":"31"},{"key":"P18","note":"30"},{"key":"P7","note":"29"},{"key":"P6","note":"28"},{"key":"P15","note":"27"},{"key":"P16","note":"26"},{"key":"P2","note":"25"},{"key":"P5","note":"24"},{"key":"P3","note":"23"},{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P17 has no unreached neighbors left, so it finishes, number 32. Push it on the finish stack. Back to P4.","ops":[{"v":"P17","state":"waiting"},{"panel":"finished","list":[{"key":"P17","note":"32"},{"key":"P14","note":"31"},{"key":"P18","note":"30"},{"key":"P7","note":"29"},{"key":"P6","note":"28"},{"key":"P15","note":"27"},{"key":"P16","note":"26"},{"key":"P2","note":"25"},{"key":"P5","note":"24"},{"key":"P3","note":"23"},{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P4 has no unreached neighbors left, so it finishes, number 33. Push it on the finish stack. Back to P1.","ops":[{"v":"P4","state":"waiting"},{"panel":"finished","list":[{"key":"P4","note":"33"},{"key":"P17","note":"32"},{"key":"P14","note":"31"},{"key":"P18","note":"30"},{"key":"P7","note":"29"},{"key":"P6","note":"28"},{"key":"P15","note":"27"},{"key":"P16","note":"26"},{"key":"P2","note":"25"},{"key":"P5","note":"24"},{"key":"P3","note":"23"},{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P1 has no unreached neighbors left, so it finishes, number 34. Push it on the finish stack.","ops":[{"v":"P1","state":"waiting"},{"panel":"finished","list":[{"key":"P1","note":"34"},{"key":"P4","note":"33"},{"key":"P17","note":"32"},{"key":"P14","note":"31"},{"key":"P18","note":"30"},{"key":"P7","note":"29"},{"key":"P6","note":"28"},{"key":"P15","note":"27"},{"key":"P16","note":"26"},{"key":"P2","note":"25"},{"key":"P5","note":"24"},{"key":"P3","note":"23"},{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"The search from P1 is done. Start a new search at P19, the next vertex no search has reached.","ops":[{"v":"P19","state":"current"}]},{"say":"P19 has no unreached neighbors left, so it finishes, number 35. Push it on the finish stack.","ops":[{"v":"P19","state":"waiting"},{"panel":"finished","list":[{"key":"P19","note":"35"},{"key":"P1","note":"34"},{"key":"P4","note":"33"},{"key":"P17","note":"32"},{"key":"P14","note":"31"},{"key":"P18","note":"30"},{"key":"P7","note":"29"},{"key":"P6","note":"28"},{"key":"P15","note":"27"},{"key":"P16","note":"26"},{"key":"P2","note":"25"},{"key":"P5","note":"24"},{"key":"P3","note":"23"},{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"The search from P19 is done. Start a new search at P20, the next vertex no search has reached.","ops":[{"v":"P20","state":"current"}]},{"say":"P20 has no unreached neighbors left, so it finishes, number 36. Push it on the finish stack.","ops":[{"v":"P20","state":"waiting"},{"panel":"finished","list":[{"key":"P20","note":"36"},{"key":"P19","note":"35"},{"key":"P1","note":"34"},{"key":"P4","note":"33"},{"key":"P17","note":"32"},{"key":"P14","note":"31"},{"key":"P18","note":"30"},{"key":"P7","note":"29"},{"key":"P6","note":"28"},{"key":"P15","note":"27"},{"key":"P16","note":"26"},{"key":"P2","note":"25"},{"key":"P5","note":"24"},{"key":"P3","note":"23"},{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"The search from P20 is done. Start a new search at P21, the next vertex no search has reached.","ops":[{"v":"P21","state":"current"}]},{"say":"P21 has no unreached neighbors left, so it finishes, number 37. Push it on the finish stack.","ops":[{"v":"P21","state":"waiting"},{"panel":"finished","list":[{"key":"P21","note":"37"},{"key":"P20","note":"36"},{"key":"P19","note":"35"},{"key":"P1","note":"34"},{"key":"P4","note":"33"},{"key":"P17","note":"32"},{"key":"P14","note":"31"},{"key":"P18","note":"30"},{"key":"P7","note":"29"},{"key":"P6","note":"28"},{"key":"P15","note":"27"},{"key":"P16","note":"26"},{"key":"P2","note":"25"},{"key":"P5","note":"24"},{"key":"P3","note":"23"},{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"The search from P21 is done. Start a new search at P22, the next vertex no search has reached.","ops":[{"v":"P22","state":"current"}]},{"say":"P22 has no unreached neighbors left, so it finishes, number 38. Push it on the finish stack.","ops":[{"v":"P22","state":"waiting"},{"panel":"finished","list":[{"key":"P22","note":"38"},{"key":"P21","note":"37"},{"key":"P20","note":"36"},{"key":"P19","note":"35"},{"key":"P1","note":"34"},{"key":"P4","note":"33"},{"key":"P17","note":"32"},{"key":"P14","note":"31"},{"key":"P18","note":"30"},{"key":"P7","note":"29"},{"key":"P6","note":"28"},{"key":"P15","note":"27"},{"key":"P16","note":"26"},{"key":"P2","note":"25"},{"key":"P5","note":"24"},{"key":"P3","note":"23"},{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"The search from P22 is done. Start a new search at P23, the next vertex no search has reached.","ops":[{"v":"P23","state":"current"}]},{"say":"P23 has no unreached neighbors left, so it finishes, number 39. Push it on the finish stack.","ops":[{"v":"P23","state":"waiting"},{"panel":"finished","list":[{"key":"P23","note":"39"},{"key":"P22","note":"38"},{"key":"P21","note":"37"},{"key":"P20","note":"36"},{"key":"P19","note":"35"},{"key":"P1","note":"34"},{"key":"P4","note":"33"},{"key":"P17","note":"32"},{"key":"P14","note":"31"},{"key":"P18","note":"30"},{"key":"P7","note":"29"},{"key":"P6","note":"28"},{"key":"P15","note":"27"},{"key":"P16","note":"26"},{"key":"P2","note":"25"},{"key":"P5","note":"24"},{"key":"P3","note":"23"},{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"The search from P23 is done. Start a new search at P24, the next vertex no search has reached.","ops":[{"v":"P24","state":"current"}]},{"say":"P24 has no unreached neighbors left, so it finishes, number 40. Push it on the finish stack.","ops":[{"v":"P24","state":"waiting"},{"panel":"finished","list":[{"key":"P24","note":"40"},{"key":"P23","note":"39"},{"key":"P22","note":"38"},{"key":"P21","note":"37"},{"key":"P20","note":"36"},{"key":"P19","note":"35"},{"key":"P1","note":"34"},{"key":"P4","note":"33"},{"key":"P17","note":"32"},{"key":"P14","note":"31"},{"key":"P18","note":"30"},{"key":"P7","note":"29"},{"key":"P6","note":"28"},{"key":"P15","note":"27"},{"key":"P16","note":"26"},{"key":"P2","note":"25"},{"key":"P5","note":"24"},{"key":"P3","note":"23"},{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"The first pass is done. P24 finished last, so no edge comes into its component from another component. The second pass follows every edge backwards, taking its starts from the top of the finish stack. A backwards search from P24 can't leave its component, and each later start is in a component whose other incoming edges come from components already found, so every search reaches exactly one component.","ops":[{"e":["P1","P2"],"state":"idle"},{"e":["P2","P3"],"state":"idle"},{"e":["P3","P9"],"state":"idle"},{"e":["P9","P10"],"state":"idle"},{"e":["P10","P28"],"state":"idle"},{"e":["P28","P25"],"state":"idle"},{"e":["P25","P26"],"state":"idle"},{"e":["P26","P27"],"state":"idle"},{"e":["P25","P37"],"state":"idle"},{"e":["P37","P29"],"state":"idle"},{"e":["P29","P30"],"state":"idle"},{"e":["P30","P31"],"state":"idle"},{"e":["P31","P32"],"state":"idle"},{"e":["P32","P33"],"state":"idle"},{"e":["P33","P34"],"state":"idle"},{"e":["P34","P35"],"state":"idle"},{"e":["P31","P36"],"state":"idle"},{"e":["P30","P38"],"state":"idle"},{"e":["P9","P13"],"state":"idle"},{"e":["P13","P12"],"state":"idle"},{"e":["P3","P8"],"state":"idle"},{"e":["P3","P11"],"state":"idle"},{"e":["P11","P39"],"state":"idle"},{"e":["P39","P40"],"state":"idle"},{"e":["P2","P5"],"state":"idle"},{"e":["P1","P4"],"state":"idle"},{"e":["P4","P17"],"state":"idle"},{"e":["P17","P14"],"state":"idle"},{"e":["P14","P15"],"state":"idle"},{"e":["P15","P16"],"state":"idle"},{"e":["P14","P18"],"state":"idle"},{"e":["P18","P7"],"state":"idle"},{"e":["P7","P6"],"state":"idle"}]},{"say":"Take P24 off the top of the finish stack. The second pass hasn't reached it, so search backwards from it. Every vertex this search reaches is in component 1.","ops":[{"v":"P24","state":"current"},{"panel":"finished","list":[{"key":"P23","note":"39"},{"key":"P22","note":"38"},{"key":"P21","note":"37"},{"key":"P20","note":"36"},{"key":"P19","note":"35"},{"key":"P1","note":"34"},{"key":"P4","note":"33"},{"key":"P17","note":"32"},{"key":"P14","note":"31"},{"key":"P18","note":"30"},{"key":"P7","note":"29"},{"key":"P6","note":"28"},{"key":"P15","note":"27"},{"key":"P16","note":"26"},{"key":"P2","note":"25"},{"key":"P5","note":"24"},{"key":"P3","note":"23"},{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"No edge comes into P24. The search from P24 is done. P24 is component 1 on its own.","ops":[{"v":"P24","state":"done"},{"panel":"components","groups":[["P24"]]}]},{"say":"Take P23 off the top of the finish stack. The second pass hasn't reached it, so search backwards from it. Every vertex this search reaches is in component 2.","ops":[{"v":"P23","state":"current"},{"panel":"finished","list":[{"key":"P22","note":"38"},{"key":"P21","note":"37"},{"key":"P20","note":"36"},{"key":"P19","note":"35"},{"key":"P1","note":"34"},{"key":"P4","note":"33"},{"key":"P17","note":"32"},{"key":"P14","note":"31"},{"key":"P18","note":"30"},{"key":"P7","note":"29"},{"key":"P6","note":"28"},{"key":"P15","note":"27"},{"key":"P16","note":"26"},{"key":"P2","note":"25"},{"key":"P5","note":"24"},{"key":"P3","note":"23"},{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"No edge comes into P23. The search from P23 is done. P23 is component 2 on its own.","ops":[{"v":"P23","state":"done"},{"panel":"components","groups":[["P24"],["P23"]]}]},{"say":"Take P22 off the top of the finish stack. The second pass hasn't reached it, so search backwards from it. Every vertex this search reaches is in component 3.","ops":[{"v":"P22","state":"current"},{"panel":"finished","list":[{"key":"P21","note":"37"},{"key":"P20","note":"36"},{"key":"P19","note":"35"},{"key":"P1","note":"34"},{"key":"P4","note":"33"},{"key":"P17","note":"32"},{"key":"P14","note":"31"},{"key":"P18","note":"30"},{"key":"P7","note":"29"},{"key":"P6","note":"28"},{"key":"P15","note":"27"},{"key":"P16","note":"26"},{"key":"P2","note":"25"},{"key":"P5","note":"24"},{"key":"P3","note":"23"},{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"No edge comes into P22. The search from P22 is done. P22 is component 3 on its own.","ops":[{"v":"P22","state":"done"},{"panel":"components","groups":[["P24"],["P23"],["P22"]]}]},{"say":"Take P21 off the top of the finish stack. The second pass hasn't reached it, so search backwards from it. Every vertex this search reaches is in component 4.","ops":[{"v":"P21","state":"current"},{"panel":"finished","list":[{"key":"P20","note":"36"},{"key":"P19","note":"35"},{"key":"P1","note":"34"},{"key":"P4","note":"33"},{"key":"P17","note":"32"},{"key":"P14","note":"31"},{"key":"P18","note":"30"},{"key":"P7","note":"29"},{"key":"P6","note":"28"},{"key":"P15","note":"27"},{"key":"P16","note":"26"},{"key":"P2","note":"25"},{"key":"P5","note":"24"},{"key":"P3","note":"23"},{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"No edge comes into P21. The search from P21 is done. P21 is component 4 on its own.","ops":[{"v":"P21","state":"done"},{"panel":"components","groups":[["P24"],["P23"],["P22"],["P21"]]}]},{"say":"Take P20 off the top of the finish stack. The second pass hasn't reached it, so search backwards from it. Every vertex this search reaches is in component 5.","ops":[{"v":"P20","state":"current"},{"panel":"finished","list":[{"key":"P19","note":"35"},{"key":"P1","note":"34"},{"key":"P4","note":"33"},{"key":"P17","note":"32"},{"key":"P14","note":"31"},{"key":"P18","note":"30"},{"key":"P7","note":"29"},{"key":"P6","note":"28"},{"key":"P15","note":"27"},{"key":"P16","note":"26"},{"key":"P2","note":"25"},{"key":"P5","note":"24"},{"key":"P3","note":"23"},{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"No edge comes into P20. The search from P20 is done. P20 is component 5 on its own.","ops":[{"v":"P20","state":"done"},{"panel":"components","groups":[["P24"],["P23"],["P22"],["P21"],["P20"]]}]},{"say":"Take P19 off the top of the finish stack. The second pass hasn't reached it, so search backwards from it. Every vertex this search reaches is in component 6.","ops":[{"v":"P19","state":"current"},{"panel":"finished","list":[{"key":"P1","note":"34"},{"key":"P4","note":"33"},{"key":"P17","note":"32"},{"key":"P14","note":"31"},{"key":"P18","note":"30"},{"key":"P7","note":"29"},{"key":"P6","note":"28"},{"key":"P15","note":"27"},{"key":"P16","note":"26"},{"key":"P2","note":"25"},{"key":"P5","note":"24"},{"key":"P3","note":"23"},{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"No edge comes into P19. The search from P19 is done. P19 is component 6 on its own.","ops":[{"v":"P19","state":"done"},{"panel":"components","groups":[["P24"],["P23"],["P22"],["P21"],["P20"],["P19"]]}]},{"say":"Take P1 off the top of the finish stack. The second pass hasn't reached it, so search backwards from it. Every vertex this search reaches is in component 7.","ops":[{"v":"P1","state":"current"},{"panel":"finished","list":[{"key":"P4","note":"33"},{"key":"P17","note":"32"},{"key":"P14","note":"31"},{"key":"P18","note":"30"},{"key":"P7","note":"29"},{"key":"P6","note":"28"},{"key":"P15","note":"27"},{"key":"P16","note":"26"},{"key":"P2","note":"25"},{"key":"P5","note":"24"},{"key":"P3","note":"23"},{"key":"P11","note":"22"},{"key":"P39","note":"21"},{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P2 has an edge into P1, so follow it backwards to P2, which joins component 7.","ops":[{"v":"P2","state":"current"},{"e":["P2","P1"],"state":"reversed"}]},{"say":"P5 has an edge into P2, so follow it backwards to P5, which joins component 7.","ops":[{"v":"P5","state":"current"},{"e":["P5","P2"],"state":"reversed"}]},{"say":"Every edge into P5 comes from a vertex the second pass has reached. Back to P2.","ops":[{"v":"P5","state":"done"}]},{"say":"P16 has an edge into P2, so follow it backwards to P16, which joins component 7.","ops":[{"v":"P16","state":"current"},{"e":["P16","P2"],"state":"reversed"}]},{"say":"P14 has an edge into P16, so follow it backwards to P14, which joins component 7.","ops":[{"v":"P14","state":"current"},{"e":["P14","P16"],"state":"reversed"}]},{"say":"P6 has an edge into P14, so follow it backwards to P6, which joins component 7.","ops":[{"v":"P6","state":"current"},{"e":["P6","P14"],"state":"reversed"}]},{"say":"P7 has an edge into P6, so follow it backwards to P7, which joins component 7.","ops":[{"v":"P7","state":"current"},{"e":["P7","P6"],"state":"reversed"}]},{"say":"P18 has an edge into P7, so follow it backwards to P18, which joins component 7.","ops":[{"v":"P18","state":"current"},{"e":["P18","P7"],"state":"reversed"}]},{"say":"Every edge into P18 comes from a vertex the second pass has reached. Back to P7.","ops":[{"v":"P18","state":"done"}]},{"say":"Every edge into P7 comes from a vertex the second pass has reached. Back to P6.","ops":[{"v":"P7","state":"done"}]},{"say":"Every edge into P6 comes from a vertex the second pass has reached. Back to P14.","ops":[{"v":"P6","state":"done"}]},{"say":"P15 has an edge into P14, so follow it backwards to P15, which joins component 7.","ops":[{"v":"P15","state":"current"},{"e":["P15","P14"],"state":"reversed"}]},{"say":"Every edge into P15 comes from a vertex the second pass has reached. Back to P14.","ops":[{"v":"P15","state":"done"}]},{"say":"P17 has an edge into P14, so follow it backwards to P17, which joins component 7.","ops":[{"v":"P17","state":"current"},{"e":["P17","P14"],"state":"reversed"}]},{"say":"P4 has an edge into P17, so follow it backwards to P4, which joins component 7.","ops":[{"v":"P4","state":"current"},{"e":["P4","P17"],"state":"reversed"}]},{"say":"Every edge into P4 comes from a vertex the second pass has reached. Back to P17.","ops":[{"v":"P4","state":"done"}]},{"say":"Every edge into P17 comes from a vertex the second pass has reached. Back to P14.","ops":[{"v":"P17","state":"done"}]},{"say":"Every edge into P14 comes from a vertex the second pass has reached. Back to P16.","ops":[{"v":"P14","state":"done"}]},{"say":"Every edge into P16 comes from a vertex the second pass has reached. Back to P2.","ops":[{"v":"P16","state":"done"}]},{"say":"Every edge into P2 comes from a vertex the second pass has reached. Back to P1.","ops":[{"v":"P2","state":"done"}]},{"say":"P3 has an edge into P1, so follow it backwards to P3, which joins component 7.","ops":[{"v":"P3","state":"current"},{"e":["P3","P1"],"state":"reversed"}]},{"say":"Every edge into P3 comes from a vertex the second pass has reached. Back to P1.","ops":[{"v":"P3","state":"done"}]},{"say":"P8 has an edge into P1, so follow it backwards to P8, which joins component 7.","ops":[{"v":"P8","state":"current"},{"e":["P8","P1"],"state":"reversed"}]},{"say":"Every edge into P8 comes from a vertex the second pass has reached. Back to P1.","ops":[{"v":"P8","state":"done"}]},{"say":"P9 has an edge into P1, so follow it backwards to P9, which joins component 7.","ops":[{"v":"P9","state":"current"},{"e":["P9","P1"],"state":"reversed"}]},{"say":"P10 has an edge into P9, so follow it backwards to P10, which joins component 7.","ops":[{"v":"P10","state":"current"},{"e":["P10","P9"],"state":"reversed"}]},{"say":"Every edge into P10 comes from a vertex the second pass has reached. Back to P9.","ops":[{"v":"P10","state":"done"}]},{"say":"Every edge into P9 comes from a vertex the second pass has reached. Back to P1.","ops":[{"v":"P9","state":"done"}]},{"say":"P11 has an edge into P1, so follow it backwards to P11, which joins component 7.","ops":[{"v":"P11","state":"current"},{"e":["P11","P1"],"state":"reversed"}]},{"say":"Every edge into P11 comes from a vertex the second pass has reached. Back to P1.","ops":[{"v":"P11","state":"done"}]},{"say":"P12 has an edge into P1, so follow it backwards to P12, which joins component 7.","ops":[{"v":"P12","state":"current"},{"e":["P12","P1"],"state":"reversed"}]},{"say":"P13 has an edge into P12, so follow it backwards to P13, which joins component 7.","ops":[{"v":"P13","state":"current"},{"e":["P13","P12"],"state":"reversed"}]},{"say":"Every edge into P13 comes from a vertex the second pass has reached. Back to P12.","ops":[{"v":"P13","state":"done"}]},{"say":"Every edge into P12 comes from a vertex the second pass has reached. Back to P1.","ops":[{"v":"P12","state":"done"}]},{"say":"Every edge into P1 comes from a vertex the second pass has reached. The search from P1 is done. P1, P2, P5, P16, P14, P6, P7, P18, P15, P17, P4, P3, P8, P9, P10, P11, P12 and P13 form component 7.","ops":[{"v":"P1","state":"done"},{"v":"P2","state":"done"},{"v":"P5","state":"done"},{"v":"P16","state":"done"},{"v":"P14","state":"done"},{"v":"P6","state":"done"},{"v":"P7","state":"done"},{"v":"P18","state":"done"},{"v":"P15","state":"done"},{"v":"P17","state":"done"},{"v":"P4","state":"done"},{"v":"P3","state":"done"},{"v":"P8","state":"done"},{"v":"P9","state":"done"},{"v":"P10","state":"done"},{"v":"P11","state":"done"},{"v":"P12","state":"done"},{"v":"P13","state":"done"},{"panel":"components","groups":[["P24"],["P23"],["P22"],["P21"],["P20"],["P19"],["P1","P2","P5","P16","P14","P6","P7","P18","P15","P17","P4","P3","P8","P9","P10","P11","P12","P13"]]}]},{"say":"Take the next 12 vertices off the top of the finish stack, P4 first and P11 last. They are already in components. Take P39 off the top of the finish stack. The second pass hasn't reached it, so search backwards from it. Every vertex this search reaches is in component 8.","ops":[{"v":"P39","state":"current"},{"panel":"finished","list":[{"key":"P40","note":"20"},{"key":"P8","note":"19"},{"key":"P9","note":"18"},{"key":"P13","note":"17"},{"key":"P12","note":"16"},{"key":"P10","note":"15"},{"key":"P28","note":"14"},{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P40 has an edge into P39, so follow it backwards to P40, which joins component 8.","ops":[{"v":"P40","state":"current"},{"e":["P40","P39"],"state":"reversed"}]},{"say":"Every edge into P40 comes from a vertex the second pass has reached. Back to P39.","ops":[{"v":"P40","state":"done"}]},{"say":"Every edge into P39 comes from a vertex the second pass has reached. The search from P39 is done. P39 and P40 form component 8.","ops":[{"v":"P39","state":"done"},{"v":"P40","state":"done"},{"panel":"components","groups":[["P24"],["P23"],["P22"],["P21"],["P20"],["P19"],["P1","P2","P5","P16","P14","P6","P7","P18","P15","P17","P4","P3","P8","P9","P10","P11","P12","P13"],["P39","P40"]]}]},{"say":"Take the next 6 vertices off the top of the finish stack, P40 first and P10 last. They are already in components. Take P28 off the top of the finish stack. The second pass hasn't reached it, so search backwards from it. Every vertex this search reaches is in component 9.","ops":[{"v":"P28","state":"current"},{"panel":"finished","list":[{"key":"P25","note":"13"},{"key":"P37","note":"12"},{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P25 has an edge into P28, so follow it backwards to P25, which joins component 9.","ops":[{"v":"P25","state":"current"},{"e":["P25","P28"],"state":"reversed"}]},{"say":"P26 has an edge into P25, so follow it backwards to P26, which joins component 9.","ops":[{"v":"P26","state":"current"},{"e":["P26","P25"],"state":"reversed"}]},{"say":"Every edge into P26 comes from a vertex the second pass has reached. Back to P25.","ops":[{"v":"P26","state":"done"}]},{"say":"P27 has an edge into P25, so follow it backwards to P27, which joins component 9.","ops":[{"v":"P27","state":"current"},{"e":["P27","P25"],"state":"reversed"}]},{"say":"Every edge into P27 comes from a vertex the second pass has reached. Back to P25.","ops":[{"v":"P27","state":"done"}]},{"say":"Every edge into P25 comes from a vertex the second pass has reached. Back to P28.","ops":[{"v":"P25","state":"done"}]},{"say":"Every edge into P28 comes from a vertex the second pass has reached. The search from P28 is done. P28, P25, P26 and P27 form component 9.","ops":[{"v":"P28","state":"done"},{"v":"P25","state":"done"},{"v":"P26","state":"done"},{"v":"P27","state":"done"},{"panel":"components","groups":[["P24"],["P23"],["P22"],["P21"],["P20"],["P19"],["P1","P2","P5","P16","P14","P6","P7","P18","P15","P17","P4","P3","P8","P9","P10","P11","P12","P13"],["P39","P40"],["P28","P25","P26","P27"]]}]},{"say":"Take P25 off the top of the finish stack. It is already in a component. Take P37 off the top of the finish stack. The second pass hasn't reached it, so search backwards from it. Every vertex this search reaches is in component 10.","ops":[{"v":"P37","state":"current"},{"panel":"finished","list":[{"key":"P29","note":"11"},{"key":"P30","note":"10"},{"key":"P38","note":"9"},{"key":"P31","note":"8"},{"key":"P36","note":"7"},{"key":"P32","note":"6"},{"key":"P33","note":"5"},{"key":"P34","note":"4"},{"key":"P35","note":"3"},{"key":"P26","note":"2"},{"key":"P27","note":"1"}]}]},{"say":"P29 has an edge into P37, so follow it backwards to P29, which joins component 10.","ops":[{"v":"P29","state":"current"},{"e":["P29","P37"],"state":"reversed"}]},{"say":"P30 has an edge into P29, so follow it backwards to P30, which joins component 10.","ops":[{"v":"P30","state":"current"},{"e":["P30","P29"],"state":"reversed"}]},{"say":"P38 has an edge into P30, so follow it backwards to P38, which joins component 10.","ops":[{"v":"P38","state":"current"},{"e":["P38","P30"],"state":"reversed"}]},{"say":"Every edge into P38 comes from a vertex the second pass has reached. Back to P30.","ops":[{"v":"P38","state":"done"}]},{"say":"Every edge into P30 comes from a vertex the second pass has reached. Back to P29.","ops":[{"v":"P30","state":"done"}]},{"say":"P31 has an edge into P29, so follow it backwards to P31, which joins component 10.","ops":[{"v":"P31","state":"current"},{"e":["P31","P29"],"state":"reversed"}]},{"say":"P32 has an edge into P31, so follow it backwards to P32, which joins component 10.","ops":[{"v":"P32","state":"current"},{"e":["P32","P31"],"state":"reversed"}]},{"say":"P36 has an edge into P32, so follow it backwards to P36, which joins component 10.","ops":[{"v":"P36","state":"current"},{"e":["P36","P32"],"state":"reversed"}]},{"say":"Every edge into P36 comes from a vertex the second pass has reached. Back to P32.","ops":[{"v":"P36","state":"done"}]},{"say":"Every edge into P32 comes from a vertex the second pass has reached. Back to P31.","ops":[{"v":"P32","state":"done"}]},{"say":"Every edge into P31 comes from a vertex the second pass has reached. Back to P29.","ops":[{"v":"P31","state":"done"}]},{"say":"P33 has an edge into P29, so follow it backwards to P33, which joins component 10.","ops":[{"v":"P33","state":"current"},{"e":["P33","P29"],"state":"reversed"}]},{"say":"P34 has an edge into P33, so follow it backwards to P34, which joins component 10.","ops":[{"v":"P34","state":"current"},{"e":["P34","P33"],"state":"reversed"}]},{"say":"Every edge into P34 comes from a vertex the second pass has reached. Back to P33.","ops":[{"v":"P34","state":"done"}]},{"say":"P35 has an edge into P33, so follow it backwards to P35, which joins component 10.","ops":[{"v":"P35","state":"current"},{"e":["P35","P33"],"state":"reversed"}]},{"say":"Every edge into P35 comes from a vertex the second pass has reached. Back to P33.","ops":[{"v":"P35","state":"done"}]},{"say":"Every edge into P33 comes from a vertex the second pass has reached. Back to P29.","ops":[{"v":"P33","state":"done"}]},{"say":"Every edge into P29 comes from a vertex the second pass has reached. Back to P37.","ops":[{"v":"P29","state":"done"}]},{"say":"Every edge into P37 comes from a vertex the second pass has reached. The search from P37 is done. P37, P29, P30, P38, P31, P32, P36, P33, P34 and P35 form component 10.","ops":[{"v":"P37","state":"done"},{"v":"P29","state":"done"},{"v":"P30","state":"done"},{"v":"P38","state":"done"},{"v":"P31","state":"done"},{"v":"P32","state":"done"},{"v":"P36","state":"done"},{"v":"P33","state":"done"},{"v":"P34","state":"done"},{"v":"P35","state":"done"},{"panel":"components","groups":[["P24"],["P23"],["P22"],["P21"],["P20"],["P19"],["P1","P2","P5","P16","P14","P6","P7","P18","P15","P17","P4","P3","P8","P9","P10","P11","P12","P13"],["P39","P40"],["P28","P25","P26","P27"],["P37","P29","P30","P38","P31","P32","P36","P33","P34","P35"]]}]},{"say":"Take the next 11 vertices off the top of the finish stack, P29 first and P27 last. They are already in components. Done. Kosaraju found 10 strongly connected components, 6 of them with one vertex. Each component is listed before every component it has an edge into. Every vertex now shows the component it belongs to.","ops":[{"v":"P24","state":"single"},{"v":"P23","state":"single"},{"v":"P22","state":"single"},{"v":"P21","state":"single"},{"v":"P20","state":"single"},{"v":"P19","state":"single"},{"v":"P1","state":"component-7"},{"v":"P2","state":"component-7"},{"v":"P5","state":"component-7"},{"v":"P16","state":"component-7"},{"v":"P14","state":"component-7"},{"v":"P6","state":"component-7"},{"v":"P7","state":"component-7"},{"v":"P18","state":"component-7"},{"v":"P15","state":"component-7"},{"v":"P17","state":"component-7"},{"v":"P4","state":"component-7"},{"v":"P3","state":"component-7"},{"v":"P8","state":"component-7"},{"v":"P9","state":"component-7"},{"v":"P10","state":"component-7"},{"v":"P11","state":"component-7"},{"v":"P12","state":"component-7"},{"v":"P13","state":"component-7"},{"v":"P39","state":"component-8"},{"v":"P40","state":"component-8"},{"v":"P28","state":"component-9"},{"v":"P25","state":"component-9"},{"v":"P26","state":"component-9"},{"v":"P27","state":"component-9"},{"v":"P37","state":"component-10"},{"v":"P29","state":"component-10"},{"v":"P30","state":"component-10"},{"v":"P38","state":"component-10"},{"v":"P31","state":"component-10"},{"v":"P32","state":"component-10"},{"v":"P36","state":"component-10"},{"v":"P33","state":"component-10"},{"v":"P34","state":"component-10"},{"v":"P35","state":"component-10"},{"panel":"finished","list":[]}]}],"traceNote":"","verification":"The steps come from a step-by-step copy of the algorithm. Its result is checked against gograph's on every start.","snippet":"for _, component := range connectivity.Kosaraju(g) {\n\tvar names []string\n\tfor _, v := range component {\n\t\tnames = append(names, v.Label())\n\t}\n\tfmt.Println(strings.Join(names, \", \"))\n}"}
