nauty-parser-1.0.0.0: Parse/encode graph6, digraph6 and sparse6 formats (nauty).
Copyright(c) Marcelo Garlet Milani 2026
LicenseMIT
Maintainermgmilani@pm.me
Stabilityunstable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Nauty.Sparse6.Internal

Description

This module contains internal functions used by the Nauty.Sparse6 module. Except for test cases, you should not import this module.

Synopsis

Documentation

data AdjacencyList Source #

A graph represented as an adjacency list.

Constructors

AdjacencyList 

Fields

Instances

Instances details
Show AdjacencyList Source # 
Instance details

Defined in Nauty.Sparse6.Internal

Eq AdjacencyList Source # 
Instance details

Defined in Nauty.Sparse6.Internal

parse :: Text -> [Either Text AdjacencyList] Source #

Parse a file of graphs in sparse6 format.

graph :: Text -> Either Text AdjacencyList Source #

Decode a single graph in sparse6 format.

symmetricDifference Source #

Arguments

:: AdjacencyList

Reference graph

-> Text

symmetric difference between reference graph and the resulting graph, in incremental sparse6 format

-> 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.

data EncodeState Source #

State for encoding a graph.

Instances

Instances details
Show EncodeState Source # 
Instance details

Defined in Nauty.Sparse6.Internal

Eq EncodeState Source # 
Instance details

Defined in Nauty.Sparse6.Internal

encode :: AdjacencyList -> Text Source #

Encode a graph in sparse6 format.

encodeSymmetricDifference :: Word64 -> [(Word64, Word64)] -> Text Source #

Encode a graph using the incremental sparse6 format. The list of edges given is the symmetric difference between the current graph and the previous one in the list.

encodeEdgeList :: Word64 -> [(Word64, Word64)] -> Text Source #

Encode a list of edges.

encodeVertex' :: Word64 -> Int -> [Word8] -> Word8 -> Int -> ([Word8], Word8, Int) Source #

Encode a single vertex.

oneBit :: forall (m :: Type -> Type). Monad m => StateT EncodeState m () Source #

Set next bit to one.

zeroBit :: forall (m :: Type -> Type). Monad m => StateT EncodeState m () Source #

Set next bit to zero.

encodeStartState :: EncodeState Source #

Starting state when encoding a graph.

data EdgeListState Source #

State when parsing a list of edges.

Constructors

EdgeListState 

Fields

Instances

Instances details
Show EdgeListState Source # 
Instance details

Defined in Nauty.Sparse6.Internal

Eq EdgeListState Source # 
Instance details

Defined in Nauty.Sparse6.Internal

consumeByte :: Word64 -> Word64 -> EdgeListState -> Word8 -> Int -> EdgeListState Source #

Read a single byte.

edgeList :: Word64 -> Word64 -> EdgeListState -> Word8 -> EdgeListState Source #

Bytes of the list of edges.

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.

areAdjacent :: AdjacencyList -> Word64 -> Word64 -> Bool Source #

Whether two vertices are adjacent.