| Copyright | (c) Marcelo Garlet Milani 2026 |
|---|---|
| License | MIT |
| Maintainer | mgmilani@pm.me |
| Stability | stable |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Nauty.Sparse6
Contents
Description
This module functions for encoding and decoding graphs in sparse6 format.
If you want to work with a more general interface instead, use Nauty.
Synopsis
- data AdjacencyList = AdjacencyList {}
- areAdjacent :: AdjacencyList -> Word64 -> Word64 -> Bool
- fromEdgeList :: Word64 -> [(Word64, Word64)] -> AdjacencyList
- toEdgeList :: AdjacencyList -> (Word64, [(Word64, Word64)])
- parse :: Text -> [Either Text AdjacencyList]
- graph :: Text -> Either Text AdjacencyList
- symmetricDifference :: AdjacencyList -> Text -> Either Text AdjacencyList
- encode :: AdjacencyList -> Text
- encodeSymmetricDifference :: Word64 -> [(Word64, Word64)] -> Text
Graph structure
data AdjacencyList Source #
A graph represented as an adjacency list.
Constructors
| AdjacencyList | |
Instances
| Show AdjacencyList Source # | |
Defined in Nauty.Sparse6.Internal Methods showsPrec :: Int -> AdjacencyList -> ShowS # show :: AdjacencyList -> String # showList :: [AdjacencyList] -> ShowS # | |
| Eq AdjacencyList Source # | |
Defined in Nauty.Sparse6.Internal Methods (==) :: AdjacencyList -> AdjacencyList -> Bool # (/=) :: AdjacencyList -> AdjacencyList -> Bool # | |
areAdjacent :: AdjacencyList -> Word64 -> Word64 -> Bool Source #
Whether two vertices are adjacent.
fromEdgeList :: Word64 -> [(Word64, Word64)] -> AdjacencyList Source #
Create an adjacency matrix from a list of edges. Vertices need to be in the range from 0 to n-1.
toEdgeList :: AdjacencyList -> (Word64, [(Word64, Word64)]) Source #
The list of edges of a graph together with the number of vertices.
Parsing
Arguments
| :: AdjacencyList | Reference graph |
| -> Text | symmetric difference between reference graph and the resulting graph, in incremental |
| -> Either Text AdjacencyList |
Parse a graph in incremental sparse6 format.
The edges of the first graph are the symmetric difference between the edges of the second graph and the resulting graph.
Encoding
encode :: AdjacencyList -> Text Source #
Encode a graph in sparse6 format.