Cuthill–McKee algorithm: Difference between revisions

Content deleted Content added
It's important to say that level sets are sorted by predecessor. The code in the cited blogspot explores the next level one vertex at a time from a queue, so it's not made explicit there. But this code takes R_i all at once and sorts it, so predecessor must be used to compare. The slides I cite make this clearer.
Line 10:
are exhausted. The set <math> R_{i+1} </math> is created from set <math> R_i</math>
by listing all vertices adjacent to all nodes in <math> R_i </math>. These
nodes are listedordered inaccording increasingto predecessors and degree. This last detail is the only difference
with the breadth-first search algorithm.
 
==Algorithm==
Line 25 ⟶ 24:
*Construct the adjacency set <math>A_i</math> of <math>R_i</math> (with <math>R_i</math> the ''i''-th component of <math>R</math>) and exclude the vertices we already have in <math>R</math>
:<math>A_i := \operatorname{Adj}(R_i) \setminus R</math>
*Sort <math>A_i</math> with ascending vertexby orderminimum predecessor (the already-visited neighbor with the earliest position in R), and as a tiebreak ascending by [[Degree (graph theory)|vertex degree]]).<ref>The Reverse Cuthill-McKee Algorithm in Distributed-Memory [https://archive.siam.org/meetings/csc16/slides/ariful_azad_CSC16.pdf], slide 8, 2016</ref>
*Append <math>A_i</math> to the Result set <math>R</math>.
 
In other words, number the vertices according to a particular [[breadth-firstlevel search|structure]] (computed by [[breadth-first traversalsearch]]) where neighboringthe vertices in each level are visited in order of their predecessor's numbering from lowest to highest. vertexWhere orderthe predecessors are the same, vertices are distinguished by degree (again ordered from lowest to highest).
 
==See also==