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

Description

This module functions for encoding and decoding graphs in any of the supported formats. In particular, encodeMany is capable of using the incremental sparse6 format as well.

If you want instead to work with a specific format, use Nauty.Graph6, Nauty.Sparse6 or Nauty.Digraph6 instead.

Synopsis

Graph structure

data Graph Source #

A directed or undirected graph. See nauty documentation for an explanation of the format used by the adjacency matrix.

Constructors

Graph 

Fields

Instances

Instances details
Show Graph Source # 
Instance details

Defined in Nauty.Internal

Methods

showsPrec :: Int -> Graph -> ShowS #

show :: Graph -> String #

showList :: [Graph] -> ShowS #

Eq Graph Source # 
Instance details

Defined in Nauty.Internal

Methods

(==) :: Graph -> Graph -> Bool #

(/=) :: Graph -> Graph -> Bool #

data GraphType Source #

Whether the graph has undirected or directed edges.

Constructors

Undirected 
Directed 

Instances

Instances details
Show GraphType Source # 
Instance details

Defined in Nauty.Internal

Eq GraphType Source # 
Instance details

Defined in Nauty.Internal

edgeExists Source #

Arguments

:: Graph 
-> Word64

From vertex in directed graphs.

-> Word64

To vertex in directed graphs.

-> Bool 

Whether the graph contains and edge between two vertices. In digraph6 format, the edge is a directed edge from the first to the second vertex.

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

The number of vertices and the list of (potentially directed) edges of a graph.

Parsing

data Format Source #

Format in used for encoding and decoding.

Instances

Instances details
Show Format Source # 
Instance details

Defined in Nauty.Internal

Eq Format Source # 
Instance details

Defined in Nauty.Internal

Methods

(==) :: Format -> Format -> Bool #

(/=) :: Format -> Format -> Bool #

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

Parse a list of graphs encoded in graph6, sparse6 or digraph6 format. Each line encodes one graph. Optionally, the first line might be a header of the form >>graph6<<, >>sparse6<< or >>digraph6<<.

parse' Source #

Arguments

:: Maybe Graph

Used in case the first graph of the list uses incremental sparse6 format.

-> [Text] 
-> [Either Text Graph] 

Parse a list of graphs in graph6, digraph6, sparse6 or incremental sparse6 format.

Encoding

encode :: Graph -> Text Source #

Encode a graph using the format given by the format field. Graphs with the Incremental format are encoded using sparse6.

encodeMany :: [Graph] -> Text Source #

Encode a sequence of graphs using the given formats. Graphs may be encoded with the incremental format, but only if the previous graph is encoded with sparse6.

encodeMany' Source #

Arguments

:: Maybe Graph

Used as a predecessor in case the first graph of the list is to be encoded in incremental sparse6 format.

-> [Graph] 
-> [Text] 

Encode a sequence of graphs using the given formats. Graphs may be encoded with the incremental format, but only if the previous graph is encoded with sparse6.