In Haskell, I can easily think of a data structure of quasi-labeled simple graphs:
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE GADTs #-}
data Graph (n :: Nat) where
G1 :: Graph 1
(:-) :: Int -> Graph n -> Graph (n+1)
Where G1
is the one-point graph with the point labeled $0$, and x :- g
is g
with a new vertex labeled $n$ attached, where x
's binary expansion represents the newly added edges, where the indices correspond to the labels of the vertices. (on-bit indicates the vertex is connected by the edge)
But the implementations of graph structures I know in Haskell have fairly different data structures.
From Data.Graph
from containers
package:
type Graph = Array Vertex [Vertex]
From Data.Graph.Inductive.PatriciaTree
from fgl
package:
newtype Gr a b = Gr (GraphRep a b)
type GraphRep a b = IntMap (Context' a b)
type Context' a b = (IntMap [b], a, IntMap [b])
Where IntMap
is from Data.IntMap.Lazy
froim containers
package.
So what structrue does the Graph Isomorphism Problem (especially in the paper by Babai & Helfgott) assume?