Skip to content

Commit

Permalink
Minor changes requested by publishers
Browse files Browse the repository at this point in the history
  • Loading branch information
snowleopard committed Jul 25, 2017
1 parent 197ae18 commit 2f4a0ce
Show file tree
Hide file tree
Showing 9 changed files with 587 additions and 307 deletions.
716 changes: 494 additions & 222 deletions acmart.cls

Large diffs are not rendered by default.

33 changes: 17 additions & 16 deletions alga.tex
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
\documentclass[sigplan,authorversion]{acmart}

\documentclass[sigplan,screen,9pt]{acmart}
\usepackage{booktabs}
\usepackage{subcaption}

Expand All @@ -15,29 +14,31 @@

\makeatletter

%%% The following is specific to Haskell'17 and the paper
%%% 'Algebraic Graphs with Class (Functional Pearl)'
%%% by Andrey Mokhov.
%%%
\setcopyright{acmlicensed}
\acmPrice{15.00}
\acmDOI{10.1145/3122955.3122956}
\acmISBN{978-1-4503-5182-9/17/09}
\acmConference[Haskell'17]{10th ACM SIGPLAN International Haskell Symposium}{September 7-8, 2017}{Oxford, UK}
\acmYear{2017}
\copyrightyear{2017}
\acmPrice{15.00}
\acmISBN{978-1-4503-5182-9/17/09}
\acmConference[Haskell'17]{10th ACM SIGPLAN International Haskell Symposium}{September 7-8, 2017}{Oxford, UK}

\bibliographystyle{ACM-Reference-Format}
\citestyle{acmauthoryear}

\begin{document}
\settopmatter{printacmref=false}
\title{Algebraic Graphs with Class\vspace{-1.5mm}}
\subtitle{Functional Pearl}
\title{Algebraic Graphs with Class (Functional Pearl)}

\author{Andrey Mokhov}
\affiliation{
\institution{Newcastle University, United Kingdom\vspace{-1mm}}
\institution{Newcastle University, United Kingdom}
}

\begin{abstract}
% \vspace{-1mm}
\vspace{-0.5mm}
The paper presents a minimalistic and elegant approach to working
with graphs in Haskell. It is built on a rigorous
mathematical foundation --- an algebra of graphs --- that allows us to apply
Expand All @@ -51,23 +52,23 @@
and transitive graphs, as well as hypergraphs, by appropriately choosing
the set of underlying axioms. The flexibility of the approach is
demonstrated by developing a library for constructing
and transforming polymorphic graphs.
and transforming polymorphic graphs.\vspace{-1mm}
\end{abstract}

%% 2012 ACM Computing Classification System (CSS) concepts
%% Generate at 'http://dl.acm.org/ccs/ccs.cfm'.
\begin{CCSXML}
<ccs2012>
<concept>
<concept_id>10002950.10003624.10003633</concept_id>
<concept_desc>Mathematics of computing~Graph theory</concept_desc>
<concept_id>10002950</concept_id>
<concept_desc>Mathematics of computing</concept_desc>
<concept_significance>500</concept_significance>
</concept>
</ccs2012>
\end{CCSXML}

\ccsdesc[500]{Mathematics of computing~Graph theory}
%\keywords{\vspace{-2mm}Haskell, algebra, graph theory}
\keywords{Haskell, algebra, graph theory}
\ccsdesc[500]{Mathematics of computing}
\keywords{\vspace{-2mm}Haskell, algebra, graph theory}

\maketitle

Expand Down
9 changes: 5 additions & 4 deletions algebra.tex
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
\caption{Decomposition: $1 \rightarrow 2 \rightarrow 3 = 1 \rightarrow 2 +
1 \rightarrow 3 + 2 \rightarrow 3$}
\end{subfigure}
\vspace{-1mm}
\caption{Two axioms of the algebra of graphs.\label{fig-axioms}}
\end{figure*}

\section{Algebraic structure}\label{sec-algebra}
\section{Algebraic Structure}\label{sec-algebra}

The functions \hs{edge}, \hs{vertices} and \hs{clique} defined in the previous
section \S\ref{sec-core} satisfy a few properties that we can intuitively write down
Expand All @@ -38,7 +39,7 @@ \section{Algebraic structure}\label{sec-algebra}
generally useful for formal verification, as well as automated testing of graph library
APIs.

\subsection{Axiomatic characterisation}\label{sub-laws}
\subsection{Axiomatic Characterisation}\label{sub-laws}

The definitions of \hs{vertices} and \hs{clique} in \S\ref{sub-class}
use $\varepsilon$ as the identity for both overlay $+$ and connect $\rightarrow$
Expand Down Expand Up @@ -161,7 +162,7 @@ \subsection{Axiomatic characterisation}\label{sub-laws}
\caption{Equational reasoning with algebraic graphs.\label{fig-proof}}
\end{figure*}

\subsection{Partial order on graphs}\label{sub-partial-order}
\subsection{Partial Order on Graphs}\label{sub-partial-order}

It is fairly standard to define $x \preceq y$ as $x + y = y$ for an
idempotent operation~$+$, since it gives a partial order on the elements
Expand Down Expand Up @@ -206,7 +207,7 @@ \subsection{Partial order on graphs}\label{sub-partial-order}

\end{itemize}

\subsection{Equational reasoning}\label{sub-reasoning}
\subsection{Equational Reasoning}\label{sub-reasoning}

In this subsection we show how to use equational reasoning and the laws
of the algebra to prove properties of functions on graphs.
Expand Down
45 changes: 7 additions & 38 deletions core.tex
Original file line number Diff line number Diff line change
@@ -1,36 +1,6 @@
%!TEX root = alga.tex
\begin{figure*}
\begin{subfigure}[b]{0.2\linewidth}
\centerline{\includegraphics[scale=0.27]{fig/ex-a.pdf}}
\vspace{-2.4mm}
\caption{$1 + 2$}
\centerline{\includegraphics[scale=0.27]{fig/ex-b.pdf}}
\vspace{-2.4mm}
\caption{$1 \rightarrow 2$}
\end{subfigure}
\hspace{11mm}
\begin{subfigure}[b]{0.17\linewidth}
\centerline{\includegraphics[scale=0.27]{fig/ex-c.pdf}}
\vspace{-1mm}
\caption{$1 \rightarrow (2 + 3)$}
\end{subfigure}
\hspace{12mm}
\begin{subfigure}[b]{0.15\linewidth}
\centerline{\includegraphics[scale=0.27]{fig/ex-d.pdf}}
\vspace{2.4mm}
\caption{$1 \rightarrow 1$}
\end{subfigure}
\hspace{12mm}
\begin{subfigure}[b]{0.2\linewidth}
\centerline{\includegraphics[scale=0.27]{fig/ex-e-new.pdf}}
\vspace{-1mm}
\caption{$1 \rightarrow 2 + 2 \rightarrow 3$}
\end{subfigure}
\caption{Examples of graph construction. The overlay and connect operations are denoted
by $+$ and $\rightarrow$, respectively.\label{fig-construction}}
\end{figure*}

\section{The core}\label{sec-core}
\vspace{-0.5mm}
\section{The Core}\label{sec-core}
In this section we define the \emph{core} of algebraic graphs comprising
four graph construction primitives. We describe the semantics of the primitives
using the common representation of graphs by sets of vertices and edges, and
Expand All @@ -48,7 +18,7 @@ \section{The core}\label{sec-core}
solution is to define an abstract interface that encapsulates the data structure and
provides a set of safe construction primitives. This is exactly the approach we take.

\subsection{Constructing graphs}\label{sub-constructing}
\subsection{Constructing Graphs}\label{sub-constructing}

The simplest possible graph is the \emph{empty} graph. We denote it by
$\varepsilon$, therefore $\varepsilon = (\varnothing, \varnothing)$ and
Expand Down Expand Up @@ -84,11 +54,10 @@ \subsection{Constructing graphs}\label{sub-constructing}
\begin{itemize}
\item $1 + 2$ is the graph with two isolated vertices 1 and 2.
\item $1 \rightarrow 2$ is the graph with an edge between vertices 1 and 2.
\item $1 \rightarrow (2 + 3)$ is the graph with three vertices $\{1, 2, 3\}$
and two edges $(1, 2)$ and $(1, 3)$.
\item $1 \rightarrow (2 + 3)$ comprises vertices $\{1, 2, 3\}$
and edges $\{(1, 2), (1, 3)\}$.
\item $1 \rightarrow 1$ is the graph with vertex 1 and the \emph{self-loop}.
\item $1 \rightarrow 2 + 2 \rightarrow 3$ is the graph with three vertices $\{1, 2, 3\}$
and two edges $(1, 2)$ and $(2, 3)$.
\item $1 \rightarrow 2 + 2 \rightarrow 3$ is the \emph{path graph} on vertices $\{1, 2, 3\}$.
\end{itemize}

As shown in~\S\ref{sec-intro}, the core can be represented by a simple
Expand All @@ -97,7 +66,7 @@ \subsection{Constructing graphs}\label{sub-constructing}
has the usual inhabitants, such as the pair $(V,E)$, data types from
\textsf{containers} and \textsf{fgl}, as well as other, stranger forms of life.

\subsection{Type class}\label{sub-class}
\subsection{Type Class}\label{sub-class}

We abstract the graph construction primitives defined in \S\ref{sub-constructing}
as the type class \hs{Graph}\footnote{The name collision (\hs{data Graph}
Expand Down
3 changes: 1 addition & 2 deletions discussion.tex
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
%!TEX root = alga.tex
\vspace{-1mm}
\section{Discussion and future research opportunities}\label{sec-discussion}
\section{\hspace{-1mm}Discussion~and~Future~Research~Opportunities}\label{sec-discussion}

The paper presented a new algebraic foundation for working with graphs.
It is particularly well-suited for functional programming languages
Expand Down
18 changes: 9 additions & 9 deletions graphs.tex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
%!TEX root = alga.tex
\section{Graphs \`{a} la carte}\label{sec-a-la-carte}
\section{Graphs \`{a} la Carte}\label{sec-a-la-carte}

In this section we define several useful \hs{Graph} instances, and
show that the algebra presented in the previous section~\S\ref{sec-algebra} is
Expand Down Expand Up @@ -28,14 +28,14 @@ \section{Graphs \`{a} la carte}\label{sec-a-la-carte}
connect x y = R (domain x `union` domain y) (relation x `union` relation y `union`
fromAscList [ (a, b) | a <- elems (domain x), b <- elems (domain y) ])
\end{minted}
\vspace{-2mm}
\vspace{-2.5mm}
\caption{Implementing the \hs{Graph} type class by a binary relation
and the core graph construction primitives
defined in~\S\ref{sub-constructing}.\label{fig-relation}}
\vspace{-2mm}
\vspace{-2.5mm}
\end{figure*}

\subsection{Binary relation}\label{sub-relation}
\subsection{Binary Relation}\label{sub-relation}

We start by a direct encoding of the graph construction primitives defined
in~\S\ref{sub-constructing} into the abstract data type \hs{Relation} isomorphic
Expand Down Expand Up @@ -103,7 +103,7 @@ \subsection{Binary relation}\label{sub-relation}
The last example highlights the fact that the \hs{Relation@\,\,\blk{a}@} instance allows vertices
of any type \hs{@\blk{a}@} that satisfies the~\hs{Ord@\,\,\blk{a}@} constraint.

\subsection{Deep embedding}\label{sub-embedding}
\subsection{Deep Embedding}\label{sub-embedding}

We can embed the core graph construction primitives into a simple data type
(excuse and ignore the name clash with the type class):
Expand Down Expand Up @@ -273,7 +273,7 @@ \subsection{Deep embedding}\label{sub-embedding}
% which motivates us to study polymorphic graph transformations that can be reused by
% all law-abiding citizens of the \hs{Graph} world -- see \S\ref{sec-transformations}.

\subsection{Undirected graphs}\label{sub-undirected}
\subsection{Undirected Graphs}\label{sub-undirected}

As hinted at in \S\ref{sub-laws}, to switch from directed to undirected graphs it
is sufficient to add the axiom of commutativity for the connect operation. For
Expand Down Expand Up @@ -354,7 +354,7 @@ \subsection{Undirected graphs}\label{sub-undirected}
\label{fig-3-decomposition}}
\end{figure*}

\subsection{Reflexive graphs}\label{sub-reflexive}
\subsection{Reflexive Graphs}\label{sub-reflexive}

A graph is \emph{reflexive} if every vertex of the graph is connected to itself,
i.e. has a self-loop. An example of a reflexive graph is the graph corresponding
Expand Down Expand Up @@ -382,7 +382,7 @@ \subsection{Reflexive graphs}\label{sub-reflexive}
\hs{class Graph@\,\,\blk{g}@ => ReflexiveGraph@\,\,\blk{g}@}
to increase the type safety of functions that rely on the self-loop axiom.

\subsection{Transitive graphs}\label{sub-transitive}
\subsection{Transitive Graphs}\label{sub-transitive}

In many applications graphs satisfy the \emph{transitivity} property: if a vertex $x$ is
connected to $y$, and $y$ is connected to $z$, then the edge between $x$ and $z$ can be
Expand Down Expand Up @@ -418,7 +418,7 @@ \subsection{Transitive graphs}\label{sub-transitive}
A subclass \hs{class Graph@\,\,\blk{g}@ => TransitiveGraph@\,\,\blk{g}@} can be
defined to distinguish algebraic graphs with the closure axiom from others.

\subsection{Preorders and equivalence relations}\label{sub-preorder}
\subsection{Preorders and Equivalence Relations}\label{sub-preorder}

By combining reflexive and transitive graphs, one can obtain \emph{preorders}.
For example, $(1 + 2 + 3) \rightarrow (2 + 3 + 4)$
Expand Down
52 changes: 44 additions & 8 deletions intro.tex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%!TEX root = alga.tex
%\vspace{-2mm}
\vspace{-2mm}
\section{Introduction}\label{sec-intro}
%\vspace{-0.5mm}
\vspace{-0.5mm}

Graphs are ubiquitous in computing, yet working with graphs often requires
painfully low-level fiddling with sets of vertices and edges. Building high-level
Expand Down Expand Up @@ -47,12 +47,14 @@ \section{Introduction}\label{sec-intro}
Algebraic graphs have a safe and minimalistic core of four graph construction primitives,
as captured by the following data type:

\vspace{-0.59mm}
\begin{minted}{haskell}
data Graph a = Empty
| Vertex a
| Overlay (Graph a) (Graph a)
| Connect (Graph a) (Graph a)
\end{minted}
\vspace{-0.59mm}

\noindent
Here \hs{Empty} and \hs{Vertex} construct the \emph{empty} and \emph{single-vertex} graphs,
Expand Down Expand Up @@ -84,22 +86,56 @@ \section{Introduction}\label{sec-intro}
i.e. malformed graphs cannot be constructed.

\item Under the basic set of axioms, algebraic graphs correspond to directed
graphs with no edge labels. As we show in~\S\ref{sec-a-la-carte}, by extending
the algebra with additional axioms, it is possible to also represent undirected,
reflexive and transitive graphs, their combinations, as well as hypergraphs.
graphs. As we show in~\S\ref{sec-a-la-carte}, by extending
the algebra with additional axioms, we can represent undirected,
reflexive, transitive graphs, their combinations, and hypergraphs.
Importantly, the core remains unchanged, which allows us to define highly
reusable polymorphic functions on graphs.

\item We develop a library\footnote{The library is on Hackage:
\url{http://hackage.haskell.org/package/algebraic-graphs}.}
for constructing and transforming algebraic graphs and demonstrate its
flexibility in \S\ref{sec-transformations}.
for constructing and transforming algebraic graphs
and demonstrate its flexibility in \S\ref{sec-transformations}.

% Although the development of efficient algorithms for algebraic
% graphs is outside the scope of this paper, we show that the library can cope
% with graphs comprising billions of edges in the matter of
% seconds, which is sufficiently fast for many applications.
\end{itemize}
\vspace{-0.25mm}
\vspace{-2mm}

\begin{figure*}
\begin{subfigure}[b]{0.2\linewidth}
\centerline{\includegraphics[scale=0.27]{fig/ex-a.pdf}}
\vspace{-2.4mm}
\caption{$1 + 2$}
\centerline{\includegraphics[scale=0.27]{fig/ex-b.pdf}}
\vspace{-2.4mm}
\caption{$1 \rightarrow 2$}
\end{subfigure}
\hspace{11mm}
\begin{subfigure}[b]{0.17\linewidth}
\centerline{\includegraphics[scale=0.27]{fig/ex-c.pdf}}
\vspace{-1mm}
\caption{$1 \rightarrow (2 + 3)$}
\end{subfigure}
\hspace{12mm}
\begin{subfigure}[b]{0.15\linewidth}
\centerline{\includegraphics[scale=0.27]{fig/ex-d.pdf}}
\vspace{2.4mm}
\caption{$1 \rightarrow 1$}
\end{subfigure}
\hspace{12mm}
\begin{subfigure}[b]{0.2\linewidth}
\centerline{\includegraphics[scale=0.27]{fig/ex-e-new.pdf}}
\vspace{-1mm}
\caption{$1 \rightarrow 2 + 2 \rightarrow 3$}
\end{subfigure}
\vspace{-1.5mm}
\caption{Examples of graph construction. The overlay and connect operations are denoted
by $+$ and $\rightarrow$, respectively.\label{fig-construction}}
\vspace{-3mm}
\end{figure*}

Graphs and functional programming have a long history. We review related
work in \S\ref{sec-related}. Limitations of the presented approach and future
Expand Down
Loading

0 comments on commit 2f4a0ce

Please sign in to comment.