|
|
|
Description |
Graph Coloring.
This is a generic graph coloring library, abstracted over the type of
the node keys, nodes and colors.
|
|
Synopsis |
|
module GraphBase | | module GraphOps | | module GraphPpr | | colorGraph :: (Uniquable k, Uniquable cls, Uniquable color, Eq color, Eq cls, Ord k, Outputable k, Outputable cls, Outputable color) => Bool -> Int -> UniqFM (UniqSet color) -> Triv k cls color -> (Graph k cls color -> k) -> Graph k cls color -> (Graph k cls color, UniqSet k, UniqFM k) |
|
|
Documentation |
|
module GraphBase |
|
module GraphOps |
|
module GraphPpr |
|
|
:: (Uniquable k, Uniquable cls, Uniquable color, Eq color, Eq cls, Ord k, Outputable k, Outputable cls, Outputable color) | | => Bool | how many times we've tried to color this graph so far.
| -> Int | map of (node class -> set of colors available for this class).
| -> UniqFM (UniqSet color) | fn to decide whether a node is trivially colorable.
| -> Triv k cls color | fn to choose a node to potentially leave uncolored if nothing is trivially colorable.
| -> Graph k cls color -> k | the graph to color.
| -> Graph k cls color | | -> (Graph k cls color, UniqSet k, UniqFM k) | | Try to color a graph with this set of colors.
Uses Chaitin's algorithm to color the graph.
The graph is scanned for nodes which are deamed 'trivially colorable'. These nodes
are pushed onto a stack and removed from the graph.
Once this process is complete the graph can be colored by removing nodes from
the stack (ie in reverse order) and assigning them colors different to their neighbors.
|
|
|
Produced by Haddock version 2.6.0 |