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

Nauty.Sparse6

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

Graph structure

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

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

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.

Encoding

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.