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

Description

This module contains functions for encoding and decoding graphs in digrap6 format.

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

Synopsis

Graph structure

data AdjacencyMatrix Source #

A digraph represented as an adjacency matrix.

Constructors

AdjacencyMatrix 

Fields

arcExists Source #

Arguments

:: AdjacencyMatrix 
-> Word64

Tail

-> Word64

Head

-> Bool 

Whether there is an arc from the first vertex to the second.

fromArcList Source #

Arguments

:: Word64

Number of vertices

-> [(Word64, Word64)]

List of arcs

-> AdjacencyMatrix 

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

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

The the number of vertices of a digraph together with a list of its arcs.

Parsing

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

Parse all digraphs in the input text. Digraphs are stored one per line.

digraph :: Text -> Either Text AdjacencyMatrix Source #

Parse a single digraph in digraph6 format.

Encoding

encode :: AdjacencyMatrix -> Text Source #

Encode a graph in digraph6 format.