Copyright | (c) Sebastian Tee 2022 |
---|---|
License | MIT |
Maintainer | github.com/SebTee |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Library for handling bi-coloured graphs
Synopsis
- data BCG = BCG [BCE] IntSet Int
- data BCE = BCE {}
- type IVC = Set (Int, Int)
- type PM = BCG
- empty :: BCG
- dist :: BCG -> Double
- enumeratePM :: BCG -> [BCG]
- getIncidentEdges :: BCG -> Int -> [BCE]
- isIncident :: Int -> BCE -> Bool
- removeEdgeAndIncidentVertices :: BCG -> BCE -> BCG
- removeVertex :: BCG -> Int -> BCG
- removeVertices :: BCG -> [Int] -> BCG
- isMonochromatic :: PM -> Bool
- coloringWeight :: [PM] -> Complex Double
- pmsIvc :: PM -> IVC
- groupByIvc :: [PM] -> [[PM]]
- isAdjacent :: BCG -> Int -> Int -> Bool
- getAdjacent :: BCG -> Int -> IntSet
- getConnected :: BCG -> Int -> IntSet
- isConnectedGraph :: BCG -> Bool
- numberDifferentColors :: BCG -> Int
Data Types
Bi-Colored Graph
Bi-Coloured Edge
Constructors
Functions
dist :: BCG -> Double Source #
Return a value between 0 and 1 representing a BCG
's distance to the monochromatic
\[dist(G) = \begin{cases}
0 & G \text{ has no perfect matchings} \\
\frac{\left|\displaystyle\sum_{c_i \in G,\ c_i\ \text{is monochromatic}} w(c_i)\right|^2}{d\cdot\left(\displaystyle\sum_{c_i \in G} |w(c_i)|^2\right)} & \text{Otherwise}
\end{cases}\]
Where \(c_i\) is an IVC
on \(G\), \(d\) is the number of different colors on \(G\) and \(w(c_i)\) is the colouring weight of \(c_i\).
enumeratePM :: BCG -> [BCG] Source #
isMonochromatic :: PM -> Bool Source #
Checks if all edges on a PM
are monochromatic and have the same color