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

Description

This module functions for encoding and decoding graphs in graph6 format.

If you want to work with a more general interface instead, use Nauty.

Synopsis

Graph structure

data AdjacencyMatrix Source #

A graph represented as an adjacency matrix.

Constructors

AdjacencyMatrix 

Fields

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

Whether two vertices are adjacent.

fromEdgeList Source #

Arguments

:: Word64

Number of vertices

-> [(Word64, Word64)]

List of edges

-> AdjacencyMatrix 

Create an adjacency matrix from a list of edges. Vertices need to be in the range from 0 to n - 1.

toEdgeList :: AdjacencyMatrix -> (Word64, [(Word64, Word64)]) Source #

The list of edges of a graph together with the number of vertices.

Parsing

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

Parse all graphs in the input text. Graphs are stored one per line.

graph :: Text -> Either Text AdjacencyMatrix Source #

Parse a single graph in graph6 format.

Encoding

encode :: AdjacencyMatrix -> Text Source #

Encode a graph into graph6 format.