This is my first post on CS Stack Exchange. For some time, I have been studying basic graph algorithms, mainly BFS, DFS, minimum spanning trees and their basic algorithms (Kruskal and Prim). One thing I have noticed, as I have used both Skiena's Algorithm Design Manual and CLRS is that, at least in the pseuducode in CLRS, several of them have a similar structure: do something with all the vertices of the graph, do something special to the root or the first vertex (for example, set its cost to 0, as in Prim), then create a queue or a priority queue, insert all the vertices and in a loop extract one by one, check some condition and do something to their adjacency list. Why do they follow such a structure? Some of the algorithms in CLRS are similar:
PS: as I mentioned, this is my first post, not only in CS, but in all the Stackoverflow network. Any suggestion or improvement on question posting is greatly appreciated.