Jump to content

Recursive largest first algorithm: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Cleaning up accepted Articles for creation submission (AFCH 0.9.1)
m Small amount of tidying, and correction of one typo.
Line 1: Line 1:
{{Short description|Algorithm for graph coloring}}
{{Short description|Algorithm for graph coloring}}


The Recursive Largest First (RLF) algorithm is a [[heuristic]] for the NP-hard [[graph coloring problem]]. It was originally proposed by Frank Leighton in 1979.<ref name=":0">{{Cite journal|last=Leighton|first=F.|date=1979|title=A graph coloring algorithm for large scheduling problems|journal=Journal of Research of the National Bureau of Standards|volume=84|pages=489–503}}</ref>
The Recursive Largest First (RLF) algorithm is a [[heuristic]] for the [[NP-hard]] [[graph coloring problem]]. It was originally proposed by Frank Leighton in 1979.<ref name=":0">{{Cite journal|last=Leighton|first=F.|date=1979|title=A graph coloring algorithm for large scheduling problems|journal=Journal of Research of the National Bureau of Standards|volume=84|pages=489–503}}</ref>


The RLF algorithm assigns colors to a graph’s vertices by constructing each color class one at a time. It does this by identifying an [[Independent_set_(graph_theory)|independent set]] of vertices in the graph, assigning these to the same color, and then removing these vertices from the graph. These actions are repeated on the remaining subgraph until no vertices remain.
The RLF algorithm assigns colors to a graph’s vertices by constructing each color class one at a time. It does this by identifying a [[maximal independent set]] of vertices in the graph, assigning these to the same color, and then removing these vertices from the graph. These actions are repeated on the remaining subgraph until no vertices remain.


To try and form high-quality solutions (solutions using as few colors as possible), the RLF algorithm uses specialized heuristics to identify "good quality" independent sets. These heuristics make the RLF algorithm exact for [[bipartite graph|bipartite]], [[cycle graph|cycle]], and [[wheel graph|wheel graphs]].<ref name=":1">{{Cite book|last=Lewis|first=R.|date=2021|title=A Guide to Graph Colouring: Algorithms and Applications|publisher=Springer|doi=
To form high-quality solutions (solutions using few colors), the RLF algorithm uses specialized heuristic rules to try to identify "good quality" independent sets. These heuristics make the RLF algorithm exact for [[bipartite graph|bipartite]], [[cycle graph|cycle]], and [[wheel graph|wheel graphs]].<ref name=":1">{{Cite book|last=Lewis|first=R.|date=2021|title=A Guide to Graph Colouring: Algorithms and Applications|publisher=Springer|doi=
10.1007/978-3-030-81054-2|isbn=978-3-030-81053-5}}</ref> In general, however, the algorithm is approximate, and may well return solutions using more colors than the graph’s [[chromatic number]].
10.1007/978-3-030-81054-2|isbn=978-3-030-81053-5}}</ref> In general, however, the algorithm is approximate and may well return solutions that use more colors than the graph’s [[chromatic number]].


==Description==
==Description==
The algorithm can be described by the following three steps. At the end of this process, <math>\mathcal{S}</math> gives a partition of the vertices representing a feasible <math>|\mathcal{S}|</math>-colouring of the graph <math>G</math>.
The algorithm can be described by the following three steps. At the end of this process, <math>\mathcal{S}</math> gives a partition of the vertices representing a feasible <math>|\mathcal{S}|</math>-colouring of the graph <math>G</math>.


# Let <math>\mathcal{S}=\emptyset</math> be an empty solution, and let <math>G=(V,E)</math> be the graph we wish to color, comprising a vertex set <math>V</math> and an edge set <math>E</math>.
# Let <math>\mathcal{S}=\emptyset</math> be an empty solution. Also, let <math>G=(V,E)</math> be the graph we wish to color, comprising a vertex set <math>V</math> and an edge set <math>E</math>.
# Identify a [[maximal independent set]] <math>S\subseteq V</math>. To do this:
# Identify a [[maximal independent set]] <math>S\subseteq V</math>. To do this:
## The first vertex added to <math>S</math> should be the vertex in <math>G</math> that has the largest number of neighbors.
## The first vertex added to <math>S</math> should be the vertex in <math>G</math> that has the largest number of neighbors.
## Subsequent vertices added to <math>S</math> should be chosen as those that are (a) not currently adjacent to any vertex in <math>S</math>, and (b) have a maximal number of neighbors that are adjacent to vertices in <math>S</math>. Ties in condition (b) can be broken by selecting the vertex with the minimum number of neighbors not in <math>S</math>. Vertices are added to <math>S</math> in this way until it is impossible to add further vertices.
## Subsequent vertices added to <math>S</math> should be chosen as those that (a) are not currently adjacent to any vertex in <math>S</math>, and (b) have a maximal number of neighbors that are adjacent to vertices in <math>S</math>. Ties in condition (b) can be broken by selecting the vertex with the minimum number of neighbors not in <math>S</math>. Vertices are added to <math>S</math> in this way until it is impossible to add further vertices.
# Now set <math>\mathcal{S}=\mathcal{S}\cup \{S\}</math> and remove the vertices of <math>S</math> from <math>G</math>. If <math>G</math> still contains vertices, then return to Step 2; otherwise end.
# Now set <math>\mathcal{S}=\mathcal{S}\cup \{S\}</math> and remove the vertices of <math>S</math> from <math>G</math>. If <math>G</math> still contains vertices, then return to Step 2; otherwise end.


Line 28: Line 28:


==Performance==
==Performance==
Let <math>n</math> be the number of vertices in the graph and <math>m</math> be the number of colors. Using [[big O notation]], in his original publication Leighton states the complexity of RLF to be <math>\mathcal{O}(n^3)</math>; however, this can be improved upon. Much of the expense of this algorithm is due to Step 2, where vertex selection is made according to the heuristic rules stated above. Indeed, each time a vertex is selected for addition to the independent set <math>S</math>, information regarding the neighbors needs to be recalculated for each uncolored vertex. These calculations can be performed in <math>\mathcal{O}(m)</math> time, meaning that the overall complexity of RLF is <math>\mathcal{O}(mn)</math>.<ref name=":1"></ref>
Let <math>n</math> be the number of vertices in the graph and let <math>m</math> be the number of edges. Using [[big O notation]], in his original publication Leighton states the complexity of RLF to be <math>\mathcal{O}(n^3)</math>; however, this can be improved upon. Much of the expense of this algorithm is due to Step 2, where vertex selection is made according to the heuristic rules stated above. Indeed, each time a vertex is selected for addition to the independent set <math>S</math>, information regarding the neighbors needs to be recalculated for each uncolored vertex. These calculations can be performed in <math>\mathcal{O}(m)</math> time, meaning that the overall complexity of RLF is <math>\mathcal{O}(mn)</math>.<ref name=":1"></ref>


If the heuristics of Step 2 are replaced with random selection, then the complexity is reduced to <math>\mathcal{O}(n+m)</math>; however, this will usually return lower quality solutions compared to those of RLF.<ref name=":1"></ref>
If the heuristics of Step 2 are replaced with random selection, then the complexity of this algorithm reduces to <math>\mathcal{O}(n+m)</math>; however, the resultant algorithm will usually return lower quality solutions compared to those of RLF.<ref name=":1"></ref> It will also now be inexact for [[bipartite graph|bipartite]], [[cycle graph|cycle]], and [[wheel graph|wheel graphs]].


In an empirical comparison by Lewis in 2021, RLF was shown to produce significantly better vertex colorings than alternative heuristics such as the <math>\mathcal{O}(n+m)</math> [[Greedy coloring|greedy algorithm]] and the <math>\mathcal{O}((n + m) \lg n)</math> [[DSatur]] algorithm on [[random graph|random graphs]]. However, runtimes with RLF were also seen to be higher due to its higher overall complexity.<ref name=":1"></ref>
In an empirical comparison by Lewis in 2021, RLF was shown to produce significantly better vertex colorings than alternative heuristics such as the <math>\mathcal{O}(n+m)</math> [[Greedy coloring|greedy algorithm]] and the <math>\mathcal{O}((n + m) \lg n)</math> [[DSatur]] algorithm on [[random graph|random graphs]]. However, runtimes with RLF were also seen to be higher than these alternatives due to its higher overall complexity.<ref name=":1"></ref>


==External links==
==External links==

Revision as of 13:35, 6 January 2022

The Recursive Largest First (RLF) algorithm is a heuristic for the NP-hard graph coloring problem. It was originally proposed by Frank Leighton in 1979.[1]

The RLF algorithm assigns colors to a graph’s vertices by constructing each color class one at a time. It does this by identifying a maximal independent set of vertices in the graph, assigning these to the same color, and then removing these vertices from the graph. These actions are repeated on the remaining subgraph until no vertices remain.

To form high-quality solutions (solutions using few colors), the RLF algorithm uses specialized heuristic rules to try to identify "good quality" independent sets. These heuristics make the RLF algorithm exact for bipartite, cycle, and wheel graphs.[2] In general, however, the algorithm is approximate and may well return solutions that use more colors than the graph’s chromatic number.

Description

The algorithm can be described by the following three steps. At the end of this process, gives a partition of the vertices representing a feasible -colouring of the graph .

  1. Let be an empty solution. Also, let be the graph we wish to color, comprising a vertex set and an edge set .
  2. Identify a maximal independent set . To do this:
    1. The first vertex added to should be the vertex in that has the largest number of neighbors.
    2. Subsequent vertices added to should be chosen as those that (a) are not currently adjacent to any vertex in , and (b) have a maximal number of neighbors that are adjacent to vertices in . Ties in condition (b) can be broken by selecting the vertex with the minimum number of neighbors not in . Vertices are added to in this way until it is impossible to add further vertices.
  3. Now set and remove the vertices of from . If still contains vertices, then return to Step 2; otherwise end.

Example

A wheel graph with seven vertices

Consider the graph shown on the right. This is a wheel graph and will therefore be optimally colored by RLF. Executing the algorithm results in the vertices being selected and colored in the following order:

  1. Vertex (color 1)
  2. Vertex , , and then (color 2)
  3. Vertex , , and then (color 3)

This gives the final three-colored solution .

Performance

Let be the number of vertices in the graph and let be the number of edges. Using big O notation, in his original publication Leighton states the complexity of RLF to be ; however, this can be improved upon. Much of the expense of this algorithm is due to Step 2, where vertex selection is made according to the heuristic rules stated above. Indeed, each time a vertex is selected for addition to the independent set , information regarding the neighbors needs to be recalculated for each uncolored vertex. These calculations can be performed in time, meaning that the overall complexity of RLF is .[2]

If the heuristics of Step 2 are replaced with random selection, then the complexity of this algorithm reduces to ; however, the resultant algorithm will usually return lower quality solutions compared to those of RLF.[2] It will also now be inexact for bipartite, cycle, and wheel graphs.

In an empirical comparison by Lewis in 2021, RLF was shown to produce significantly better vertex colorings than alternative heuristics such as the greedy algorithm and the DSatur algorithm on random graphs. However, runtimes with RLF were also seen to be higher than these alternatives due to its higher overall complexity.[2]

References

  1. ^ Leighton, F. (1979). "A graph coloring algorithm for large scheduling problems". Journal of Research of the National Bureau of Standards. 84: 489–503.
  2. ^ a b c d e Lewis, R. (2021). A Guide to Graph Colouring: Algorithms and Applications. Springer. doi:10.1007/978-3-030-81054-2. ISBN 978-3-030-81053-5.