Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Impressum main.tex

  Sprache: Latech
 

% generated by GAPDoc2LaTeX from XML source (Frank Luebeck)
\documentclass[a4paper,11pt]{report}

            \usepackage{a4wide}
            \newcommand{\bbZ}{\mathbb{Z}}
        
\usepackage[top=37mm,bottom=37mm,left=27mm,right=27mm]{geometry}
\sloppy
\pagestyle{myheadings}
\usepackage{amssymb}
\usepackage[utf8]{inputenc}
\usepackage{makeidx}
\makeindex
\usepackage{color}
\definecolor{FireBrick}{rgb}{0.5812,0.0074,0.0083}
\definecolor{RoyalBlue}{rgb}{0.0236,0.0894,0.6179}
\definecolor{RoyalGreen}{rgb}{0.0236,0.6179,0.0894}
\definecolor{RoyalRed}{rgb}{0.6179,0.0236,0.0894}
\definecolor{LightBlue}{rgb}{0.8544,0.9511,1.0000}
\definecolor{Black}{rgb}{0.0,0.0,0.0}

\definecolor{linkColor}{rgb}{0.0,0.0,0.554}
\definecolor{citeColor}{rgb}{0.0,0.0,0.554}
\definecolor{fileColor}{rgb}{0.0,0.0,0.554}
\definecolor{urlColor}{rgb}{0.0,0.0,0.554}
\definecolor{promptColor}{rgb}{0.0,0.0,0.589}
\definecolor{brkpromptColor}{rgb}{0.589,0.0,0.0}
\definecolor{gapinputColor}{rgb}{0.589,0.0,0.0}
\definecolor{gapoutputColor}{rgb}{0.0,0.0,0.0}

%%  for a long time these were red and blue by default,
%%  now black, but keep variables to overwrite
\definecolor{FuncColor}{rgb}{0.0,0.0,0.0}
%% strange name because of pdflatex bug:
\definecolor{Chapter }{rgb}{0.0,0.0,0.0}
\definecolor{DarkOlive}{rgb}{0.1047,0.2412,0.0064}


\usepackage{fancyvrb}

\usepackage{mathptmx,helvet}
\usepackage[T1]{fontenc}
\usepackage{textcomp}


\usepackage[
            pdftex=true,
            bookmarks=true,        
            a4paper=true,
            pdftitle={Written with GAPDoc},
            pdfcreator={LaTeX with hyperref package / GAPDoc},
            colorlinks=true,
            backref=page,
            breaklinks=true,
            linkcolor=linkColor,
            citecolor=citeColor,
            filecolor=fileColor,
            urlcolor=urlColor,
            pdfpagemode={UseNone}, 
           ]{hyperref}

\newcommand{\maintitlesize}{\fontsize{50}{55}\selectfont}

% write page numbers to a .pnr log file for online help
\newwrite\pagenrlog
\immediate\openout\pagenrlog =\jobname.pnr
\immediate\write\pagenrlog{PAGENRS := [}
\newcommand{\logpage}[1]{\protect\write\pagenrlog{#1, \thepage,}}
%% were never documented, give conflicts with some additional packages

\newcommand{\GAP}{\textsf{GAP}}

%% nicer description environments, allows long labels
\usepackage{enumitem}
\setdescription{style=nextline}

%% depth of toc
\setcounter{tocdepth}{1}





%% command for ColorPrompt style examples
\newcommand{\gapprompt}[1]{\color{promptColor}{\bfseries #1}}
\newcommand{\gapbrkprompt}[1]{\color{brkpromptColor}{\bfseries #1}}
\newcommand{\gapinput}[1]{\color{gapinputColor}{#1}}


\begin{document}

\logpage{[ 0, 0, 0 ]}
\begin{titlepage}
\mbox{}\vfill

\begin{center}{\maintitlesize \textbf{ Digraphs \mbox{}}}\\
\vfill

\hypersetup{pdftitle= Digraphs }
\markright{\scriptsize \mbox{}\hfill  Digraphs  \hfill\mbox{}}
{\Huge \textbf{ Graphs, digraphs, and multidigraphs in \textsf{GAP} \mbox{}}}\\
\vfill

{\Huge  1.13.1 \mbox{}}\\[1cm]
{ 27 September 2025 \mbox{}}\\[1cm]
\mbox{}\\[2cm]
{\Large \textbf{ Jan De Beule\\
    \mbox{}}}\\
{\Large \textbf{ Julius Jonusas\\
   \mbox{}}}\\
{\Large \textbf{ James Mitchell\\
    \mbox{}}}\\
{\Large \textbf{ Wilf A. Wilson\\
   \mbox{}}}\\
{\Large \textbf{ Michael Young\\
    \mbox{}}}\\
{\Large \textbf{ Marina Anagnostopoulou\texttt{\symbol{45}}Merkouri\\
   \mbox{}}}\\
{\Large \textbf{ Finn Buck\\
   \mbox{}}}\\
{\Large \textbf{ Stuart Burrell\\
   \mbox{}}}\\
{\Large \textbf{ Graham Campbell\\
 \mbox{}}}\\
{\Large \textbf{ Raiyan Chowdhury\\
 \mbox{}}}\\
{\Large \textbf{ Reinis Cirpons\\
   \mbox{}}}\\
{\Large \textbf{ Ashley Clayton\\
   \mbox{}}}\\
{\Large \textbf{ Tom Conti\texttt{\symbol{45}}Leslie\\
   \mbox{}}}\\
{\Large \textbf{ Joseph Edwards\\
    \mbox{}}}\\
{\Large \textbf{ Luna Elliott\\
   \mbox{}}}\\
{\Large \textbf{ Jan Engelhardt\\
   \mbox{}}}\\
{\Large \textbf{ Isuru Fernando\\
  \mbox{}}}\\
{\Large \textbf{ Ewan Gilligan\\
  \mbox{}}}\\
{\Large \textbf{ Gillis Frankie\\
  \mbox{}}}\\
{\Large \textbf{ Sebastian Gutsche\\
  \mbox{}}}\\
{\Large \textbf{ Samantha Harper\\
  \mbox{}}}\\
{\Large \textbf{ Max Horn\\
    \mbox{}}}\\
{\Large \textbf{ Harry Jack\\
  \mbox{}}}\\
{\Large \textbf{ Christopher Jefferson\\
    \mbox{}}}\\
{\Large \textbf{ Malachi Johns\\
  \mbox{}}}\\
{\Large \textbf{ Olexandr Konovalov\\
    \mbox{}}}\\
{\Large \textbf{ Hyeokjun Kwon\\
  \mbox{}}}\\
{\Large \textbf{ Aidan Lau\\
 \mbox{}}}\\
{\Large \textbf{ Andrea Lee\\
  \mbox{}}}\\
{\Large \textbf{ Saffron McIver\\
  \mbox{}}}\\
{\Large \textbf{ Seyyed Ali Mohammadiyeh\\
  \mbox{}}}\\
{\Large \textbf{ Michael Orlitzky\\
   \mbox{}}}\\
{\Large \textbf{ Matthew Pancer\\
  \mbox{}}}\\
{\Large \textbf{ Markus Pfeiffer\\
   \mbox{}}}\\
{\Large \textbf{ Daniel Pointon\\
  \mbox{}}}\\
{\Large \textbf{ Pramoth Ragavan\\
  \mbox{}}}\\
{\Large \textbf{ Lea Racine\\
   \mbox{}}}\\
{\Large \textbf{ Christopher Russell\\
 \mbox{}}}\\
{\Large \textbf{ Artur Schaefer\\
  \mbox{}}}\\
{\Large \textbf{ Isabella Scott\\
  \mbox{}}}\\
{\Large \textbf{ Kamran Sharma\\
   \mbox{}}}\\
{\Large \textbf{ Finn Smith\\
   \mbox{}}}\\
{\Large \textbf{ Ben Spiers\\
  \mbox{}}}\\
{\Large \textbf{ Maria Tsalakou\\
    \mbox{}}}\\
{\Large \textbf{ Agastyaa Vishvanath\\
  \mbox{}}}\\
{\Large \textbf{ Meike Weiss\\
    \mbox{}}}\\
{\Large \textbf{ Murray Whyte\\
   \mbox{}}}\\
{\Large \textbf{ Fabian Zickgraf\\
  \mbox{}}}\\
\hypersetup{pdfauthor= Jan De Beule\\
    ;  Julius Jonusas\\
   ;  James Mitchell\\
    ;  Wilf A. Wilson\\
   ;  Michael Young\\
    ;  Marina Anagnostopoulou\texttt{\symbol{45}}Merkouri\\
   ;  Finn Buck\\
   ;  Stuart Burrell\\
   ;  Graham Campbell\\
 ;  Raiyan Chowdhury\\
 ;  Reinis Cirpons\\
   ;  Ashley Clayton\\
   ;  Tom Conti\texttt{\symbol{45}}Leslie\\
   ;  Joseph Edwards\\
    ;  Luna Elliott\\
   ;  Jan Engelhardt\\
   ;  Isuru Fernando\\
  ;  Ewan Gilligan\\
  ;  Gillis Frankie\\
  ;  Sebastian Gutsche\\
  ;  Samantha Harper\\
  ;  Max Horn\\
    ;  Harry Jack\\
  ;  Christopher Jefferson\\
    ;  Malachi Johns\\
  ;  Olexandr Konovalov\\
    ;  Hyeokjun Kwon\\
  ;  Aidan Lau\\
 ;  Andrea Lee\\
  ;  Saffron McIver\\
  ;  Seyyed Ali Mohammadiyeh\\
  ;  Michael Orlitzky\\
   ;  Matthew Pancer\\
  ;  Markus Pfeiffer\\
   ;  Daniel Pointon\\
  ;  Pramoth Ragavan\\
  ;  Lea Racine\\
   ;  Christopher Russell\\
 ;  Artur Schaefer\\
  ;  Isabella Scott\\
  ;  Kamran Sharma\\
   ;  Finn Smith\\
   ;  Ben Spiers\\
  ;  Maria Tsalakou\\
    ;  Agastyaa Vishvanath\\
  ;  Meike Weiss\\
    ;  Murray Whyte\\
   ;  Fabian Zickgraf\\
  }
\end{center}\vfill

\mbox{}\\
{\mbox{}\\
\small \noindent \textbf{ Jan De Beule\\
    }  Email: \href{mailto://jdebeule@cage.ugent.be} {\texttt{jdebeule@cage.ugent.be}}\\
  Homepage: \href{https://researchportal.vub.be/en/persons/jan-de-beule} {\texttt{https://researchportal.vub.be/en/persons/jan\texttt{\symbol{45}}de\texttt{\symbol{45}}beule}}\\
  Address\begin{minipage}[t]{8cm}\noindent
 Vrije Universiteit Brussel, Vakgroep Wiskunde, Pleinlaan 2, B
\texttt{\symbol{45}} 1050 Brussels, Belgium\\
 \end{minipage}
}\\
{\mbox{}\\
\small \noindent \textbf{ Julius Jonusas\\
   }  Email: \href{mailto://j.jonusas@gmail.com} {\texttt{j.jonusas@gmail.com}}\\
  Homepage: \href{http://julius.jonusas.work} {\texttt{http://julius.jonusas.work}}}\\
{\mbox{}\\
\small \noindent \textbf{ James Mitchell\\
    }  Email: \href{mailto://jdm3@st-andrews.ac.uk} {\texttt{jdm3@st\texttt{\symbol{45}}andrews.ac.uk}}\\
  Homepage: \href{https://jdbm.me} {\texttt{https://jdbm.me}}\\
  Address\begin{minipage}[t]{8cm}\noindent
 Mathematical Institute, North Haugh, St Andrews, Fife, KY16 9SS, Scotland\\
 \end{minipage}
}\\
{\mbox{}\\
\small \noindent \textbf{ Wilf A. Wilson\\
   }  Email: \href{mailto://gap@wilf-wilson.net} {\texttt{gap@wilf\texttt{\symbol{45}}wilson.net}}\\
  Homepage: \href{https://wilf.me} {\texttt{https://wilf.me}}}\\
{\mbox{}\\
\small \noindent \textbf{ Michael Young\\
    }  Email: \href{mailto://mct25@st-andrews.ac.uk} {\texttt{mct25@st\texttt{\symbol{45}}andrews.ac.uk}}\\
  Homepage: \href{https://myoung.uk/work/} {\texttt{https://myoung.uk/work/}}\\
  Address\begin{minipage}[t]{8cm}\noindent
 Jack Cole Building, North Haugh, St Andrews, Fife, KY16 9SX, Scotland\\
 \end{minipage}
}\\
{\mbox{}\\
\small \noindent \textbf{ Marina Anagnostopoulou\texttt{\symbol{45}}Merkouri\\
   }  Email: \href{mailto://mam49@st-andrews.ac.uk} {\texttt{mam49@st\texttt{\symbol{45}}andrews.ac.uk}}\\
  Address\begin{minipage}[t]{8cm}\noindent
 Mathematical Institute, North Haugh, St Andrews, Fife, KY16 9SS, Scotland\\
 \end{minipage}
}\\
{\mbox{}\\
\small \noindent \textbf{ Finn Buck\\
   }  Email: \href{mailto://finneganlbuck@gmail.com} {\texttt{finneganlbuck@gmail.com}}\\
  Address\begin{minipage}[t]{8cm}\noindent
 Mathematical Institute, North Haugh, St Andrews, Fife, KY16 9SS, Scotland\\
 \end{minipage}
}\\
{\mbox{}\\
\small \noindent \textbf{ Stuart Burrell\\
   }  Email: \href{mailto://stuartburrell1994@gmail.com} {\texttt{stuartburrell1994@gmail.com}}\\
  Homepage: \href{https://stuartburrell.github.io} {\texttt{https://stuartburrell.github.io}}}\\
{\mbox{}\\
\small \noindent \textbf{ Reinis Cirpons\\
   }  Email: \href{mailto://rc234@st-andrews.ac.uk} {\texttt{rc234@st\texttt{\symbol{45}}andrews.ac.uk}}\\
  Address\begin{minipage}[t]{8cm}\noindent
 Mathematical Institute, North Haugh, St Andrews, Fife, KY16 9SS, Scotland\\
 \end{minipage}
}\\
{\mbox{}\\
\small \noindent \textbf{ Ashley Clayton\\
   }  Email: \href{mailto://ac323@st-andrews.ac.uk} {\texttt{ac323@st\texttt{\symbol{45}}andrews.ac.uk}}\\
  Address\begin{minipage}[t]{8cm}\noindent
 Mathematical Institute, North Haugh, St Andrews, Fife, KY16 9SS, Scotland\\
 \end{minipage}
}\\
{\mbox{}\\
\small \noindent \textbf{ Tom Conti\texttt{\symbol{45}}Leslie\\
   }  Email: \href{mailto://tom.contileslie@gmail.com} {\texttt{tom.contileslie@gmail.com}}\\
  Homepage: \href{https://tomcontileslie.com} {\texttt{https://tomcontileslie.com}}}\\
{\mbox{}\\
\small \noindent \textbf{ Joseph Edwards\\
    }  Email: \href{mailto://jde1@st-andrews.ac.uk} {\texttt{jde1@st\texttt{\symbol{45}}andrews.ac.uk}}\\
  Homepage: \href{https://github.com/Joseph-Edwards} {\texttt{https://github.com/Joseph\texttt{\symbol{45}}Edwards}}\\
  Address\begin{minipage}[t]{8cm}\noindent
 Mathematical Institute, North Haugh, St Andrews, Fife, KY16 9SS, Scotland\\
 \end{minipage}
}\\
{\mbox{}\\
\small \noindent \textbf{ Luna Elliott\\
   }  Email: \href{mailto://luna.elliott142857@gmail.com} {\texttt{luna.elliott142857@gmail.com}}\\
  Homepage: \href{https://research.manchester.ac.uk/en/persons/luna-elliott} {\texttt{https://research.manchester.ac.uk/en/persons/luna\texttt{\symbol{45}}elliott}}}\\
{\mbox{}\\
\small \noindent \textbf{ Jan Engelhardt\\
   }  Email: \href{mailto://jengelh@inai.de} {\texttt{jengelh@inai.de}}\\
  Homepage: \href{https://inai.de} {\texttt{https://inai.de}}}\\
{\mbox{}\\
\small \noindent \textbf{ Isuru Fernando\\
  }  Email: \href{mailto://isuruf@gmail.com} {\texttt{isuruf@gmail.com}}}\\
{\mbox{}\\
\small \noindent \textbf{ Ewan Gilligan\\
  }  Email: \href{mailto://eg207@st-andrews.ac.uk} {\texttt{eg207@st\texttt{\symbol{45}}andrews.ac.uk}}}\\
{\mbox{}\\
\small \noindent \textbf{ Gillis Frankie\\
  }  Email: \href{mailto://fotg1@st-andrews.ac.uk} {\texttt{fotg1@st\texttt{\symbol{45}}andrews.ac.uk}}}\\
{\mbox{}\\
\small \noindent \textbf{ Sebastian Gutsche\\
  }  Email: \href{mailto://gutsche@momo.math.rwth-aachen.de} {\texttt{gutsche@momo.math.rwth\texttt{\symbol{45}}aachen.de}}}\\
{\mbox{}\\
\small \noindent \textbf{ Samantha Harper\\
  }  Email: \href{mailto://seh25@st-andrews.ac.uk} {\texttt{seh25@st\texttt{\symbol{45}}andrews.ac.uk}}}\\
{\mbox{}\\
\small \noindent \textbf{ Max Horn\\
    }  Email: \href{mailto://mhorn@rptu.de} {\texttt{mhorn@rptu.de}}\\
  Homepage: \href{https://www.quendi.de/math} {\texttt{https://www.quendi.de/math}}\\
  Address\begin{minipage}[t]{8cm}\noindent
 Fachbereich Mathematik, RPTU Kaiserslautern\texttt{\symbol{45}}Landau,
Gottlieb\texttt{\symbol{45}}Daimler\texttt{\symbol{45}}Stra{\ss}e 48, 67663
Kaiserslautern, Germany\\
 \end{minipage}
}\\
{\mbox{}\\
\small \noindent \textbf{ Harry Jack\\
  }  Email: \href{mailto://hrj4@st-andrews.ac.uk} {\texttt{hrj4@st\texttt{\symbol{45}}andrews.ac.uk}}}\\
{\mbox{}\\
\small \noindent \textbf{ Christopher Jefferson\\
    }  Email: \href{mailto://caj21@st-andrews.ac.uk} {\texttt{caj21@st\texttt{\symbol{45}}andrews.ac.uk}}\\
  Homepage: \href{https://heather.cafe/} {\texttt{https://heather.cafe/}}\\
  Address\begin{minipage}[t]{8cm}\noindent
 Jack Cole Building, North Haugh, St Andrews, Fife, KY16 9SX, Scotland\\
 \end{minipage}
}\\
{\mbox{}\\
\small \noindent \textbf{ Malachi Johns\\
  }  Email: \href{mailto://zlj1@st-andrews.ac.uk} {\texttt{zlj1@st\texttt{\symbol{45}}andrews.ac.uk}}}\\
{\mbox{}\\
\small \noindent \textbf{ Olexandr Konovalov\\
    }  Email: \href{mailto://obk1@st-andrews.ac.uk} {\texttt{obk1@st\texttt{\symbol{45}}andrews.ac.uk}}\\
  Homepage: \href{https://olexandr-konovalov.github.io/} {\texttt{https://olexandr\texttt{\symbol{45}}konovalov.github.io/}}\\
  Address\begin{minipage}[t]{8cm}\noindent
 Jack Cole Building, North Haugh, St Andrews, Fife, KY16 9SX, Scotland\\
 \end{minipage}
}\\
{\mbox{}\\
\small \noindent \textbf{ Hyeokjun Kwon\\
  }  Email: \href{mailto://hk78@st-andrews.ac.uk} {\texttt{hk78@st\texttt{\symbol{45}}andrews.ac.uk}}}\\
{\mbox{}\\
\small \noindent \textbf{ Andrea Lee\\
  }  Email: \href{mailto://ahwl1@st-andrews.ac.uk} {\texttt{ahwl1@st\texttt{\symbol{45}}andrews.ac.uk}}}\\
{\mbox{}\\
\small \noindent \textbf{ Saffron McIver\\
  }  Email: \href{mailto://sm544@st-andrews.ac.uk} {\texttt{sm544@st\texttt{\symbol{45}}andrews.ac.uk}}}\\
{\mbox{}\\
\small \noindent \textbf{ Seyyed Ali Mohammadiyeh\\
  }  Email: \href{mailto://MaxBaseCode@Gmail.Com} {\texttt{MaxBaseCode@Gmail.Com}}}\\
{\mbox{}\\
\small \noindent \textbf{ Michael Orlitzky\\
   }  Email: \href{mailto://michael@orlitzky.com} {\texttt{michael@orlitzky.com}}\\
  Homepage: \href{https://michael.orlitzky.com/} {\texttt{https://michael.orlitzky.com/}}}\\
{\mbox{}\\
\small \noindent \textbf{ Matthew Pancer\\
  }  Email: \href{mailto://mp322@st-andrews.ac.uk} {\texttt{mp322@st\texttt{\symbol{45}}andrews.ac.uk}}}\\
{\mbox{}\\
\small \noindent \textbf{ Markus Pfeiffer\\
   }  Email: \href{mailto://markus.pfeiffer@morphism.de} {\texttt{markus.pfeiffer@morphism.de}}\\
  Homepage: \href{https://markusp.morphism.de/} {\texttt{https://markusp.morphism.de/}}}\\
{\mbox{}\\
\small \noindent \textbf{ Daniel Pointon\\
  }  Email: \href{mailto://dp211@st-andrews.ac.uk} {\texttt{dp211@st\texttt{\symbol{45}}andrews.ac.uk}}}\\
{\mbox{}\\
\small \noindent \textbf{ Pramoth Ragavan\\
  }  Email: \href{mailto://107881923+pramothragavan@users.noreply.github.com} {\texttt{107881923+pramothragavan@users.noreply.github.com}}}\\
{\mbox{}\\
\small \noindent \textbf{ Lea Racine\\
   }  Email: \href{mailto://lr217@st-andrews.ac.uk} {\texttt{lr217@st\texttt{\symbol{45}}andrews.ac.uk}}\\
  Address\begin{minipage}[t]{8cm}\noindent
 Jack Cole Building, North Haugh, St Andrews, Fife, KY16 9SX, Scotland\\
 \end{minipage}
}\\
{\mbox{}\\
\small \noindent \textbf{ Artur Schaefer\\
  }  Email: \href{mailto://as305@st-and.ac.uk} {\texttt{as305@st\texttt{\symbol{45}}and.ac.uk}}}\\
{\mbox{}\\
\small \noindent \textbf{ Isabella Scott\\
  }  Email: \href{mailto://iscott@uchicago.edu} {\texttt{iscott@uchicago.edu}}}\\
{\mbox{}\\
\small \noindent \textbf{ Kamran Sharma\\
   }  Email: \href{mailto://kks4@st-andrews.ac.uk} {\texttt{kks4@st\texttt{\symbol{45}}andrews.ac.uk}}\\
  Address\begin{minipage}[t]{8cm}\noindent
 Jack Cole Building, North Haugh, St Andrews, Fife, KY16 9SX, Scotland\\
 \end{minipage}
}\\
{\mbox{}\\
\small \noindent \textbf{ Finn Smith\\
   }  Email: \href{mailto://fls3@st-andrews.ac.uk} {\texttt{fls3@st\texttt{\symbol{45}}andrews.ac.uk}}\\
  Address\begin{minipage}[t]{8cm}\noindent
 Mathematical Institute, North Haugh, St Andrews, Fife, KY16 9SS, Scotland\\
 \end{minipage}
}\\
{\mbox{}\\
\small \noindent \textbf{ Ben Spiers\\
  }  Email: \href{mailto://bspiers972@outlook.com} {\texttt{bspiers972@outlook.com}}}\\
{\mbox{}\\
\small \noindent \textbf{ Maria Tsalakou\\
    }  Email: \href{mailto://mt200@st-andrews.ac.uk} {\texttt{mt200@st\texttt{\symbol{45}}andrews.ac.uk}}\\
  Homepage: \href{https://mariatsalakou.github.io/} {\texttt{https://mariatsalakou.github.io/}}\\
  Address\begin{minipage}[t]{8cm}\noindent
 Mathematical Institute, North Haugh, St Andrews, Fife, KY16 9SS, Scotland\\
 \end{minipage}
}\\
{\mbox{}\\
\small \noindent \textbf{ Agastyaa Vishvanath\\
  }  Email: \href{mailto://av215@st-andrews.ac.uk} {\texttt{av215@st\texttt{\symbol{45}}andrews.ac.uk}}}\\
{\mbox{}\\
\small \noindent \textbf{ Meike Weiss\\
    }  Email: \href{mailto://weiss@art.rwth-aachen.de} {\texttt{weiss@art.rwth\texttt{\symbol{45}}aachen.de}}\\
  Homepage: \href{https://bit.ly/4e6pUeP} {\texttt{https://bit.ly/4e6pUeP}}\\
  Address\begin{minipage}[t]{8cm}\noindent
 Chair of Algebra and Representation Theory, Pontdriesch
10\texttt{\symbol{45}}16, 52062 Aachen\\
 \end{minipage}
}\\
{\mbox{}\\
\small \noindent \textbf{ Murray Whyte\\
   }  Email: \href{mailto://mw231@st-andrews.ac.uk} {\texttt{mw231@st\texttt{\symbol{45}}andrews.ac.uk}}\\
  Address\begin{minipage}[t]{8cm}\noindent
 Mathematical Institute, North Haugh, St Andrews, Fife, KY16 9SS, Scotland\\
 \end{minipage}
}\\
{\mbox{}\\
\small \noindent \textbf{ Fabian Zickgraf\\
  }  Email: \href{mailto://f.zickgraf@dashdos.com} {\texttt{f.zickgraf@dashdos.com}}}\\
\end{titlepage}

\newpage\setcounter{page}{2}
{\small 
\section*{Abstract}
\logpage{[ 0, 0, 1 ]}
 The \textsf{Digraphs} package is a \textsf{GAP} package containing methods for graphs, digraphs, and multidigraphs. \mbox{}}\\[1cm]
{\small 
\section*{Copyright}
\logpage{[ 0, 0, 2 ]}
 Jan De Beule, Julius Jonu{\v s}as, James D. Mitchell, Wilf A. Wilson, Michael
Young et al.

 \textsf{Digraphs} is free software; you can redistribute it and/or modify it under the terms of
the \hrefhttps://www.fsf.org/licenses/gpl.html} {GNU General Public License} as published by the Free Software Foundation; either version 3 of the License,
or (at your option) any later version. \mbox{}}\\[1cm]
{\small 
\section*{Acknowledgements}
\logpage{[ 0, 0, 3 ]}
 We would like to thank Christopher Jefferson for his help in including \href{http://www.tcs.tkk.fi/Software/bliss/} {bliss}  in \textsf{Digraphs}. We also gratefully acknowledge the encouragement and assistance of Leonard
Soicher, and the inspiration of his \href{https://gap-packages.github.io/grape} {GRAPE}  package, at many points throughout the development of \textsf{Digraphs}. This package's methods for computing digraph homomorphisms are based on work
by Max Neunh{\"o}ffer, and independently Artur Sch{\"a}fer. \mbox{}}\\[1cm]
\newpage

\def\contentsname{Contents\logpage{[ 0, 0, 4 ]}}

\tableofcontents
\newpage

 
\chapter{\textcolor{Chapter }{ The \textsf{Digraphs} package }}\label{The Digraphs package}
\logpage{[ 1, 0, 0 ]}
\hyperdef{L}{X7F202ABA780E595D}{}
{
  \index{Digraphs@\textsf{Digraphs} package overview} 
\section{\textcolor{Chapter }{Introduction}}\logpage{[ 1, 1, 0 ]}
\hyperdef{L}{X7DFB63A97E67C0A1}{}
{
 This is the manual for version 1.13.1 of the \textsf{Digraphs} package. This package was developed at the University of St Andrews by: 
\begin{itemize}
\item Jan De Beule,
\item Julius Jonu{\v s}as,
\item James D. Mitchell,
\item Maria Tsalakou,
\item Wilf A. Wilson, and
\item Michael C. Young.
\end{itemize}
 Additional contributions were made by many people, for which the authors are
very grateful. A full list can be found on the title page. The \textsf{Digraphs} package contains a variety of methods for efficiently creating and storing
mutable and immutable digraphs and computing information about them. Full
explanations of all the functions contained in the package are provided below. 

 If the \href{https://gap-packages.github.io/grape} {GRAPE}  package is available, it will be loaded automatically. Digraphs created with
the \textsf{Digraphs} package can be converted to \href{https://gap-packages.github.io/grape} {GRAPE}  graphs with \texttt{Graph} (\ref{Graph}), and conversely \href{https://gap-packages.github.io/grape} {GRAPE}  graphs can be converted to \textsf{Digraphs} objects with \texttt{Digraph} (\ref{Digraph}). \href{https://gap-packages.github.io/grape} {GRAPE}  is not required for \textsf{Digraphs} to run. 

 The \href{http://www.tcs.tkk.fi/Software/bliss/} {bliss}  tool \cite{JK07} is included in this package. It is an open\texttt{\symbol{45}}source tool for
computing automorphism groups and canonical forms of graphs, written by Tommi
Junttila and Petteri Kaski. Several of the methods in the \textsf{Digraphs} package rely on \href{http://www.tcs.tkk.fi/Software/bliss/} {bliss} . If the \href{https://github.com/gap-packages/NautyTracesInterface} {NautyTracesInterface}  package for GAP is available then it is also possible to use \href{https://pallini.di.uniroma1.it} {nauty}  \cite{MP14} for computing automorphism groups and canonical forms in \textsf{Digraphs}. See Section \ref{Isomorphisms and canonical labellings} for more details. 

 The \href{https://github.com/graph-algorithms/edge-addition-planarity-suite} {edge-addition-planarity-suite}  is also included in \textsf{Digraphs}; see \cite{BM04}, \cite{B06}, \cite{BM06}, and \cite{B12} . The \href{https://github.com/graph-algorithms/edge-addition-planarity-suite} {edge-addition-planarity-suite}  is an open\texttt{\symbol{45}}source implementation of the edge addition
planar graph embedding algorithm and related algorithms by John M. Boyer. See
Section \ref{Planarity} for more details. 

 From version 1.0.0 of this package, digraphs can be either mutable or
immutable. Mutable digraphs can be changed in\texttt{\symbol{45}}place by many
of the methods in the package, which avoids unnecessary copying. Immutable
digraphs cannot be changed in\texttt{\symbol{45}}place, but their advantage is
that the value of an attribute of an immutable digraph is only ever computed
once. Mutable digraphs can be converted into immutable digraphs
in\texttt{\symbol{45}}place using \texttt{MakeImmutable} (\textbf{Reference: MakeImmutable}). One of the motivations for introducing mutable digraphs in version 1.0.0 was
that in practice the authors often wanted to create a digraph and immediately
modify it (removing certain edges, loops, and so on). Before version 1.0.0,
this involved copying the digraph several times, with each copy being
discarded almost immediately. From version 1.0.0, this unnecessary copying can
be eliminated by first creating a mutable digraph, then changing it
in\texttt{\symbol{45}}place, and finally converting the mutable digraph to an
immutable one in\texttt{\symbol{45}}place (if desirable). 
\subsection{\textcolor{Chapter }{Definitions}}\label{Definitions}
\logpage{[ 1, 1, 1 ]}
\hyperdef{L}{X84541F61810C741D}{}
{
 For the purposes of this package and its documentation, the following
definitions apply: 

 A \emph{digraph} $E=(E^0,E^1,r,s)$, also known as a \emph{directed graph}, consists of a set of vertices $E^0$ and a set of edges $E^1$ together with functions $s, r: E^1 \to E^0$, called the \emph{source} and \emph{range}, respectively. The source and range of an edge is respectively the values of $s, r$ at that edge. An edge is called a \emph{loop} if its source and range are the same. A digraph is called a \emph{multidigraph} if there exist two or more edges with the same source and the same range. 

 A \emph{directed walk} on a digraph is a sequence of alternating vertices and edges $(v_1, e_1, v_2, e_2, ..., e_{n-1}, v_n)$ such that each edge $e_i$ has source $v_i$ and range $v_{i+1}$. A \emph{directed path} is a directed walk where no vertex (and hence no edge) is repeated. A \emph{directed circuit} is a directed walk where $v_1 = v_n$, and a \emph{directed cycle} is a directed circuit where where no vertex is repeated, except for $v_1 = v_n$. 

 The \emph{length} of a directed walk $(v_1, e_1, v_2, e_2, ..., e_{n-1}, v_n)$ is equal to $n-1$, the number of edges it contains. A directed walk (or path) $(v_1, e_1, v_2, e_2, ..., e_{n-1}, v_n)$ is sometimes called a directed walk (or path) \emph{from vertex $v_1$ to vertex $v_n$}. A directed walk of zero length, i.e. a sequence $(v)$ for some vertex $v$, is called \emph{trivial}. A trivial directed walk is considered to be both a circuit and a cycle, as
is the empty directed walk $()$. A \emph{simple circuit} is another name for a non\texttt{\symbol{45}}trivial and
non\texttt{\symbol{45}}empty directed cycle.

 }

 }

 }

 
\chapter{\textcolor{Chapter }{Installing \textsf{Digraphs}}}\label{Installing Digraphs}
\logpage{[ 2, 0, 0 ]}
\hyperdef{L}{X817088B27F90D596}{}
{
  
\section{\textcolor{Chapter }{For those in a hurry}}\label{For those in a hurry}
\logpage{[ 2, 1, 0 ]}
\hyperdef{L}{X7DA3059C79842BF3}{}
{
  In this section we give a brief description of how to start using \textsf{Digraphs}.

 It is assumed that you have a working copy of \textsf{GAP} with version number 4.10.0 or higher. The most
up\texttt{\symbol{45}}to\texttt{\symbol{45}}date version of \textsf{GAP} and instructions on how to install it can be obtained from the main \textsf{GAP} webpage \href{https://www.gap-system.org} {\texttt{https://www.gap\texttt{\symbol{45}}system.org}}.

 The following is a summary of the steps that should lead to a successful
installation of \textsf{Digraphs}: 
\begin{itemize}
\item  ensure that the \href{https://gap-packages.github.io/io} {IO}  package version 4.5.1 or higher is available. \href{https://gap-packages.github.io/io} {IO}  must be compiled before \textsf{Digraphs} can be loaded. 
\item  ensure that the \textsf{orb} package version 4.8.2 or higher is available. \textsf{orb} has better performance when compiled, but although compilation is recommended,
it is not required to be compiled for \textsf{Digraphs} to be loaded. 
\item  ensure that the \textsf{datastructures} package version 0.2.5 or higher is available. 
\item  \textsc{This step is optional:} certain functions in \textsf{Digraphs} require the \href{https://gap-packages.github.io/grape} {GRAPE}  package to be available; see Section \ref{The Grape package} for full details. To use these functions make sure that the \href{https://gap-packages.github.io/grape} {GRAPE}  package version 4.8.1 or higher is available. If \href{https://gap-packages.github.io/grape} {GRAPE}  is not available, then \textsf{Digraphs} can be used as normal with the exception that the functions listed in
Subsection \ref{The Grape package} will not work. 
\item  \textsc{This step is optional:} certain functions in \textsf{Digraphs} require the \href{https://github.com/gap-packages/NautyTracesInterface} {NautyTracesInterface}  package to be available.  If you want to make use of these functions, please ensure that the \href{https://github.com/gap-packages/NautyTracesInterface} {NautyTracesInterface}  package version 0.2 or higher is available. If \href{https://github.com/gap-packages/NautyTracesInterface} {NautyTracesInterface}  is not available, then \textsf{Digraphs} can be used as normal with the exception that functions whose names contain ``Nauty'' will not work. 
\item  download the package archive \texttt{digraphs\texttt{\symbol{45}}1.13.1.tar.gz.tar.gz} from \href{https://digraphs.github.io/Digraphs/} {the Digraphs package webpage}
\item  unzip and untar the file, this should create a directory called \texttt{digraphs\texttt{\symbol{45}}1.13.1.tar.gz}. 
\item  locate the \texttt{pkg} directory of your \textsf{GAP} directory, which contains the directories \texttt{lib}, \texttt{doc} and so on. Move the directory \texttt{digraphs\texttt{\symbol{45}}1.13.1.tar.gz} into the \texttt{pkg} directory. 
\item  it is necessary to compile the \textsf{Digraphs} package. Inside the \texttt{pkg/digraphs\texttt{\symbol{45}}1.13.1.tar.gz} directory, type 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=]
  ./configure
  make
\end{Verbatim}
 Further information about this step can be found in Section \ref{Compiling the kernel module}
\item  start \textsf{GAP} in the usual way (i.e. type \texttt{gap} at the command line). 
\item  type \texttt{LoadPackage("digraphs");} 
\end{itemize}
 If you want to check that the package is working correctly, you should run
some of the tests described in Section \ref{Testing your installation}. 
\subsection{\textcolor{Chapter }{Configuration options}}\label{Configuration options}
\logpage{[ 2, 1, 1 ]}
\hyperdef{L}{X7C1F2E6D860DBDEC}{}
{
  In addition to the usual autoconf generated configuration flags, the following
flags are provided. \begin{center}
\begin{tabular}{|l|l|}\hline
Option&
Meaning\\
\hline
\hline
\texttt{\texttt{\symbol{45}}\texttt{\symbol{45}}enable\texttt{\symbol{45}}code\texttt{\symbol{45}}coverage}&
 enable code coverage support\\
\texttt{\texttt{\symbol{45}}\texttt{\symbol{45}}enable\texttt{\symbol{45}}compile\texttt{\symbol{45}}warnings}&
 enable compiler warnings\\
\texttt{\texttt{\symbol{45}}\texttt{\symbol{45}}enable\texttt{\symbol{45}}debug}&
 enable debug mode\\
\texttt{\texttt{\symbol{45}}\texttt{\symbol{45}}with\texttt{\symbol{45}}external\texttt{\symbol{45}}bliss}&
 use external \href{http://www.tcs.tkk.fi/Software/bliss/} {bliss} \\
\texttt{\texttt{\symbol{45}}\texttt{\symbol{45}}with\texttt{\symbol{45}}external\texttt{\symbol{45}}planarity}&
 use external \href{https://github.com/graph-algorithms/edge-addition-planarity-suite} {edge-addition-planarity-suite} \\
\texttt{\texttt{\symbol{45}}\texttt{\symbol{45}}with\texttt{\symbol{45}}gaproot}&
 specify root of GAP installation\\
\texttt{\texttt{\symbol{45}}\texttt{\symbol{45}}without\texttt{\symbol{45}}intrinsics}&
 do not use compiler intrinsics even if available\\
\hline
\end{tabular}\\[2mm]
\textbf{Table: }Configuration flags\end{center}

 }

 }

   
\section{\textcolor{Chapter }{Optional package dependencies}}\label{Optional package dependencies}
\logpage{[ 2, 2, 0 ]}
\hyperdef{L}{X780AA9D97EBCA95D}{}
{
   The \textsf{Digraphs} package is written in \textsf{GAP} and C code and requires the \href{https://gap-packages.github.io/io} {IO}  package. The \href{https://gap-packages.github.io/io} {IO}  package is used to read and write transformations, partial permutations, and
bipartitions to a file. 

  
\subsection{\textcolor{Chapter }{The Grape package}}\label{The Grape package}
\logpage{[ 2, 2, 1 ]}
\hyperdef{L}{X8493C7587FCF6D8B}{}
{
  The \href{https://gap-packages.github.io/grape} {GRAPE}  package must be available for the following operations to be available: 
\begin{itemize}
\item \texttt{Graph} (\ref{Graph}) with a digraph argument
\item \texttt{AsGraph} (\ref{AsGraph}) with a digraph argument
\item \texttt{Digraph} (\ref{Digraph}) with a \href{https://gap-packages.github.io/grape} {GRAPE}  graph argument
\end{itemize}
 If \href{https://gap-packages.github.io/grape} {GRAPE}  is not available, then \textsf{Digraphs} can be used as normal with the exception that the functions above will not
work. }

 }

   
\section{\textcolor{Chapter }{Compiling the kernel module}}\label{Compiling the kernel module}
\logpage{[ 2, 3, 0 ]}
\hyperdef{L}{X849F6196875A6DF5}{}
{
  The \textsf{Digraphs} package has a \textsf{GAP} kernel component in C which should be compiled. This component contains
certain low\texttt{\symbol{45}}level functions required by \textsf{Digraphs}. 

 It is not possible to use the \textsf{Digraphs} package without compiling it.

 To compile the kernel component inside the \texttt{pkg/digraphs\texttt{\symbol{45}}1.13.1.tar.gz} directory, type 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=]
  
  ./configure
  make
\end{Verbatim}
 

 If you installed the package in another 'pkg' directory than the standard
'pkg' directory in your \textsf{GAP} installation, then you have to do two things. Firstly during compilation you
have to use the option
'\texttt{\symbol{45}}\texttt{\symbol{45}}with\texttt{\symbol{45}}gaproot=PATH'
of the 'configure' script where 'PATH' is a path to the main GAP root
directory (if not given the default '../..' is assumed).

 If you installed \textsf{GAP} on several architectures, you must execute the configure/make step for each of
the architectures. You can either do this immediately after configuring and
compiling GAP itself on this architecture, or alternatively set the
environment variable 'CONFIGNAME' to the name of the configuration you used
when compiling GAP before running './configure'. Note however that your
compiler choice and flags (environment variables 'CC' and 'CFLAGS') need to be
chosen to match the setup of the original GAP compilation. For example you
have to specify 32\texttt{\symbol{45}}bit or 64\texttt{\symbol{45}}bit mode
correctly! }

   
\section{\textcolor{Chapter }{Rebuilding the documentation}}\label{Rebuilding the documentation}
\logpage{[ 2, 4, 0 ]}
\hyperdef{L}{X857CBE5484CF703A}{}
{
  The \textsf{Digraphs} package comes complete with pdf, html, and text versions of the documentation.
However, you might find it necessary, at some point, to rebuild the
documentation. To rebuild the documentation, please use the function \texttt{DigraphsMakeDoc} (\ref{DigraphsMakeDoc}). 

\subsection{\textcolor{Chapter }{DigraphsMakeDoc}}
\logpage{[ 2, 4, 1 ]}\nobreak
\hyperdef{L}{X870631C38610AC25}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphsMakeDoc({\mdseries\slshape })\index{DigraphsMakeDoc@\texttt{DigraphsMakeDoc}}
\label{DigraphsMakeDoc}
}\hfill{\scriptsize (function)}}\\
\textbf{\indent Returns:}
Nothing



 This function should be called with no argument to compile the \textsf{Digraphs} documentation. }

 }

   
\section{\textcolor{Chapter }{Testing your installation}}\label{Testing your installation}
\logpage{[ 2, 5, 0 ]}
\hyperdef{L}{X7862D3F37C5BBDEF}{}
{
  In this section we describe how to test that \textsf{Digraphs} is working as intended. To test that \textsf{Digraphs} is installed correctly use \texttt{DigraphsTestInstall} (\ref{DigraphsTestInstall}) or for more extensive tests use \texttt{DigraphsTestStandard} (\ref{DigraphsTestStandard}). 

 If something goes wrong, then please review the instructions in Section \ref{For those in a hurry} and ensure that \textsf{Digraphs} has been properly installed. If you continue having problems, please use the \href{https://github.com/digraphs/Digraphs/issues} {issue tracker} to report the issues you are having. 

\subsection{\textcolor{Chapter }{DigraphsTestInstall}}
\logpage{[ 2, 5, 1 ]}\nobreak
\hyperdef{L}{X86AF4DAE80B978DA}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphsTestInstall({\mdseries\slshape })\index{DigraphsTestInstall@\texttt{DigraphsTestInstall}}
\label{DigraphsTestInstall}
}\hfill{\scriptsize (function)}}\\
\textbf{\indent Returns:}
\texttt{true} or \texttt{false}.



 This function can be called without arguments to test your installation of \textsf{Digraphs} is working correctly. These tests should take no more than a few seconds to
complete. To test more comprehensively that \textsf{Digraphs} is working correctly, use \texttt{DigraphsTestStandard} (\ref{DigraphsTestStandard}). }

 

\subsection{\textcolor{Chapter }{DigraphsTestStandard}}
\logpage{[ 2, 5, 2 ]}\nobreak
\hyperdef{L}{X7A20088B7C406C4A}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphsTestStandard({\mdseries\slshape })\index{DigraphsTestStandard@\texttt{DigraphsTestStandard}}
\label{DigraphsTestStandard}
}\hfill{\scriptsize (function)}}\\
\textbf{\indent Returns:}
\texttt{true} or \texttt{false}.



 This function can be called without arguments to test all of the methods
included in \textsf{Digraphs}. These tests should take less than a minute to complete. 

 To quickly test that \textsf{Digraphs} is installed correctly use \texttt{DigraphsTestInstall} (\ref{DigraphsTestInstall}). For a more thorough test, use \texttt{DigraphsTestExtreme} (\ref{DigraphsTestExtreme}). }

 

\subsection{\textcolor{Chapter }{DigraphsTestExtreme}}
\logpage{[ 2, 5, 3 ]}\nobreak
\hyperdef{L}{X7885EF3E785D4298}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphsTestExtreme({\mdseries\slshape })\index{DigraphsTestExtreme@\texttt{DigraphsTestExtreme}}
\label{DigraphsTestExtreme}
}\hfill{\scriptsize (function)}}\\
\textbf{\indent Returns:}
\texttt{true} or \texttt{false}.



 This function should be called with no argument. It executes a series of very
demanding tests, which measure the performance of a variety of functions on
large examples. These tests take a long time to complete, at least several
minutes. 

 For these tests to complete, the digraphs library \texttt{digraphs\texttt{\symbol{45}}lib} must be downloaded and placed in the \texttt{digraphs} directory in a subfolder named \texttt{digraphs\texttt{\symbol{45}}lib}. This library can be found on the \textsf{Digraphs} website. }

 }

   }

 
\chapter{\textcolor{Chapter }{Creating digraphs}}\label{Creating digraphs}
\logpage{[ 3, 0, 0 ]}
\hyperdef{L}{X7D34861E863A5D93}{}
{
 In this chapter we describe how to create digraphs.

 
\section{\textcolor{Chapter }{Creating digraphs}}\logpage{[ 3, 1, 0 ]}
\hyperdef{L}{X7D34861E863A5D93}{}
{
 

\subsection{\textcolor{Chapter }{IsDigraph}}
\logpage{[ 3, 1, 1 ]}\nobreak
\hyperdef{L}{X7877ADC77F85E630}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{IsDigraph\index{IsDigraph@\texttt{IsDigraph}}
\label{IsDigraph}
}\hfill{\scriptsize (Category)}}\\


 Every digraph in \textsf{Digraphs} belongs to the category \texttt{IsDigraph}. Some basic attributes and operations for digraphs are \texttt{DigraphVertices} (\ref{DigraphVertices}), \texttt{DigraphEdges} (\ref{DigraphEdges}), and \texttt{OutNeighbours} (\ref{OutNeighbours}). }

 

\subsection{\textcolor{Chapter }{IsMutableDigraph}}
\logpage{[ 3, 1, 2 ]}\nobreak
\hyperdef{L}{X7D7EDF83820ED6F5}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{IsMutableDigraph\index{IsMutableDigraph@\texttt{IsMutableDigraph}}
\label{IsMutableDigraph}
}\hfill{\scriptsize (Category)}}\\


 \texttt{IsMutableDigraph} is a synonym for \texttt{IsDigraph} (\ref{IsDigraph}) and \texttt{IsMutable} (\textbf{Reference: IsMutable}). A mutable digraph may be changed in\texttt{\symbol{45}}place by methods in
the \textsf{Digraphs} package, and is not attribute\texttt{\symbol{45}}storing {\textendash} see \texttt{IsAttributeStoringRep} (\textbf{Reference: IsAttributeStoringRep}). 

 A mutable digraph may be converted into an immutable
attribute\texttt{\symbol{45}}storing digraph by calling \texttt{MakeImmutable} (\textbf{Reference: MakeImmutable}) on the digraph. }

 

\subsection{\textcolor{Chapter }{IsImmutableDigraph}}
\logpage{[ 3, 1, 3 ]}\nobreak
\hyperdef{L}{X7CAFAA89804F80BD}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{IsImmutableDigraph\index{IsImmutableDigraph@\texttt{IsImmutableDigraph}}
\label{IsImmutableDigraph}
}\hfill{\scriptsize (Category)}}\\


 \texttt{IsImmutableDigraph} is a subcategory of \texttt{IsDigraph} (\ref{IsDigraph}). Digraphs that lie in \texttt{IsImmutableDigraph} are immutable and attribute\texttt{\symbol{45}}storing. In particular, they
lie in \texttt{IsAttributeStoringRep} (\textbf{Reference: IsAttributeStoringRep}). 

 A mutable digraph may be converted to an immutable digraph that lies in the
category \texttt{IsImmutableDigraph} by calling \texttt{MakeImmutable} (\textbf{Reference: MakeImmutable}) on the digraph.

 The operation \texttt{DigraphMutableCopy} (\ref{DigraphMutableCopy}) can be used to construct a mutable copy of an immutable digraph. It is however
not possible to convert an immutable digraph into a mutable digraph
in\texttt{\symbol{45}}place. }

 

\subsection{\textcolor{Chapter }{IsCayleyDigraph}}
\logpage{[ 3, 1, 4 ]}\nobreak
\hyperdef{L}{X7E749324800B38A5}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{IsCayleyDigraph\index{IsCayleyDigraph@\texttt{IsCayleyDigraph}}
\label{IsCayleyDigraph}
}\hfill{\scriptsize (Category)}}\\


 \texttt{IsCayleyDigraph} is a subcategory of \texttt{IsDigraph}. Digraphs that are Cayley digraphs of a group and that are constructed by the
operation \texttt{CayleyDigraph} (\ref{CayleyDigraph}) are constructed in this category, and are always immutable. }

 

\subsection{\textcolor{Chapter }{IsDigraphWithAdjacencyFunction}}
\logpage{[ 3, 1, 5 ]}\nobreak
\hyperdef{L}{X80F1B6D28478D8B9}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{IsDigraphWithAdjacencyFunction\index{IsDigraphWithAdjacencyFunction@\texttt{IsDigraphWithAdjacencyFunction}}
\label{IsDigraphWithAdjacencyFunction}
}\hfill{\scriptsize (Category)}}\\


 \texttt{IsDigraphWithAdjacencyFunction} is a subcategory of \texttt{IsDigraph}. Digraphs that are \emph{created} using an adjacency function are constructed in this category. }

 

\subsection{\textcolor{Chapter }{DigraphByOutNeighboursType}}
\logpage{[ 3, 1, 6 ]}\nobreak
\hyperdef{L}{X86E798B779515678}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphByOutNeighboursType\index{DigraphByOutNeighboursType@\texttt{DigraphByOutNeighboursType}}
\label{DigraphByOutNeighboursType}
}\hfill{\scriptsize (global variable)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphFamily\index{DigraphFamily@\texttt{DigraphFamily}}
\label{DigraphFamily}
}\hfill{\scriptsize (family)}}\\


 The type of all digraphs is \texttt{DigraphByOutNeighboursType}. The family of all digraphs is \texttt{DigraphFamily}. }

 

\subsection{\textcolor{Chapter }{Digraph}}
\logpage{[ 3, 1, 7 ]}\nobreak
\hyperdef{L}{X834843057CE86655}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{Digraph({\mdseries\slshape [filt, ]obj[, source, range]})\index{Digraph@\texttt{Digraph}}
\label{Digraph}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{Digraph({\mdseries\slshape [filt, ]list, func})\index{Digraph@\texttt{Digraph}!for a list and function}
\label{Digraph:for a list and function}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{Digraph({\mdseries\slshape [filt, ]G, list, act, adj})\index{Digraph@\texttt{Digraph}!for a group, list, function, and function}
\label{Digraph:for a group, list, function, and function}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{description}
\item[{for a list (i.e. an adjacency list)}]  if \mbox{\texttt{\mdseries\slshape obj}} is a list of lists of positive integers in the range from \texttt{1} to \texttt{Length(\mbox{\texttt{\mdseries\slshape obj}})}, then this function returns the digraph with vertices $E ^ 0 = $\texttt{[1 .. Length(\mbox{\texttt{\mdseries\slshape obj}})]}, and edges corresponding to the entries of \mbox{\texttt{\mdseries\slshape obj}}. 

 More precisely, there is an edge from vertex \texttt{i} to \texttt{j} if and only if \texttt{j} is in \texttt{\mbox{\texttt{\mdseries\slshape obj}}[i]}; the source of this edge is \texttt{i} and the range is \texttt{j}. If \texttt{j} occurs in \texttt{\mbox{\texttt{\mdseries\slshape obj}}[i]} with multiplicity \texttt{k}, then there are \texttt{k} edges from \texttt{i} to \texttt{j}. 
\item[{for three lists}]  if \mbox{\texttt{\mdseries\slshape obj}} is a duplicate\texttt{\symbol{45}}free list, and \mbox{\texttt{\mdseries\slshape source}} and \mbox{\texttt{\mdseries\slshape range}} are lists of equal length consisting of positive integers in the list \texttt{[1 .. Length(\mbox{\texttt{\mdseries\slshape obj}})]}, then this function returns a digraph with vertices $E ^ 0 = $\texttt{[1 .. Length(\mbox{\texttt{\mdseries\slshape obj}})]}, and \texttt{Length(\mbox{\texttt{\mdseries\slshape source}})} edges. For each \texttt{i} in \texttt{[1 .. Length(\mbox{\texttt{\mdseries\slshape source}})]} there exists an edge with source vertex \texttt{source[i]} and range vertex \texttt{range[i]}. See \texttt{DigraphSource} (\ref{DigraphSource}) and \texttt{DigraphRange} (\ref{DigraphRange}). 

 The vertices of the digraph will be labelled by the elements of \mbox{\texttt{\mdseries\slshape obj}}. 
\item[{for an integer, and two lists}]  if \mbox{\texttt{\mdseries\slshape obj}} is an integer, and \mbox{\texttt{\mdseries\slshape source}} and \mbox{\texttt{\mdseries\slshape range}} are lists of equal length consisting of positive integers in the list \texttt{[1 .. \mbox{\texttt{\mdseries\slshape obj}}]}, then this function returns a digraph with vertices $E ^ 0 = $\texttt{[1 .. \mbox{\texttt{\mdseries\slshape obj}}]}, and \texttt{Length(\mbox{\texttt{\mdseries\slshape source}})} edges. For each \texttt{i} in \texttt{[1 .. Length(\mbox{\texttt{\mdseries\slshape source}})]} there exists an edge with source vertex \texttt{source[i]} and range vertex \texttt{range[i]}. See \texttt{DigraphSource} (\ref{DigraphSource}) and \texttt{DigraphRange} (\ref{DigraphRange}). 
\item[{for a list and a function}]  if \mbox{\texttt{\mdseries\slshape list}} is a list and \mbox{\texttt{\mdseries\slshape func}} is a function taking 2 arguments that are elements of \mbox{\texttt{\mdseries\slshape list}}, and \mbox{\texttt{\mdseries\slshape func}} returns \texttt{true} or \texttt{false}, then this operation creates a digraph with vertices \texttt{[1 .. Length(\mbox{\texttt{\mdseries\slshape list}})]} and an edge from vertex \texttt{i} to vertex \texttt{j} if and only if \texttt{\mbox{\texttt{\mdseries\slshape func}}(\mbox{\texttt{\mdseries\slshape list}}[i], \mbox{\texttt{\mdseries\slshape list}}[j])} returns \texttt{true}. 
\item[{for a group, a list, and two functions}]  The arguments will be \mbox{\texttt{\mdseries\slshape G, list, act, adj}}. 

 Let \mbox{\texttt{\mdseries\slshape G}} be a group acting on the objects in \mbox{\texttt{\mdseries\slshape list}} via the action \mbox{\texttt{\mdseries\slshape act}}, and let \mbox{\texttt{\mdseries\slshape adj}} be a function taking two objects from \mbox{\texttt{\mdseries\slshape list}} as arguments and returning \texttt{true} or \texttt{false}. The function \mbox{\texttt{\mdseries\slshape adj}} will describe the adjacency between objects from \mbox{\texttt{\mdseries\slshape list}}, which is invariant under the action of \mbox{\texttt{\mdseries\slshape G}}. This variant of the constructor returns a digraph with vertices the objects
of \mbox{\texttt{\mdseries\slshape list}} and directed edges \texttt{[x, y]} when \texttt{f(x, y)} is \texttt{true}. 

 The action of the group \mbox{\texttt{\mdseries\slshape G}} on the objects in \mbox{\texttt{\mdseries\slshape list}} is stored in the attribute \texttt{DigraphGroup} (\ref{DigraphGroup}), and is used to speed up operations like \texttt{DigraphDiameter} (\ref{DigraphDiameter}). 
\item[{for a Grape package graph}]  if \mbox{\texttt{\mdseries\slshape obj}} is a \href{https://gap-packages.github.io/grape} {GRAPE}  package graph (i.e. a record for which the function \texttt{IsGraph} returns \texttt{true}), then this function returns a digraph isomorphic to \mbox{\texttt{\mdseries\slshape obj}}. 
\item[{for a binary relation}]  if \mbox{\texttt{\mdseries\slshape obj}} is a binary relation on the points \texttt{[1 .. n]} for some positive integer $n$, then this function returns the digraph defined by \mbox{\texttt{\mdseries\slshape obj}}. Specifically, this function returns a digraph which has $n$ vertices, and which has an edge with source \texttt{i} and range \texttt{j} if and only if \texttt{[i,j]} is a pair in the binary relation \mbox{\texttt{\mdseries\slshape obj}}. 
\item[{for a string naming a digraph}]  if \mbox{\texttt{\mdseries\slshape obj}} is a non\texttt{\symbol{45}}empty string, then this function returns the
digraph that has name \mbox{\texttt{\mdseries\slshape obj}}. \textsf{Digraphs} comes with a database containing a few hundred common digraph names that can
be loaded in this way. Valid names include \texttt{"folkman"}, \texttt{"diamond"} and \texttt{"brinkmann"}. If the name is commonly followed by the word \texttt{"graph"}, then it is called without writing \texttt{"graph"} at the end. You can explore the available graph names using \texttt{ListNamedDigraphs} (\ref{ListNamedDigraphs}). Digraph names are case and whitespace insensitive. 

 Note that any undirected graphs in the database are stored as symmetric
digraphs, so the resulting digraph will have twice as many edges as its
undirected counterpart. 
\end{description}
 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gr := Digraph([|
  !gapprompt@>| !gapinput@[2, 5, 8, 10], [2, 3, 4, 2, 5, 6, 8, 9, 10], [1],|
  !gapprompt@>| !gapinput@[3, 5, 7, 8, 10], [2, 5, 7], [3, 6, 7, 9, 10], [1, 4],|
  !gapprompt@>| !gapinput@[1, 5, 9], [1, 2, 7, 8], [3, 5]]);|
  <immutable multidigraph with 10 vertices, 38 edges>
  !gapprompt@gap>| !gapinput@gr := Digraph(["a""b""c"], ["a"], ["b"]);|
  <immutable digraph with 3 vertices, 1 edge>
  !gapprompt@gap>| !gapinput@gr := Digraph(5, [1, 2, 2, 4, 1, 1], [2, 3, 5, 5, 1, 1]);|
  <immutable multidigraph with 5 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@Petersen := Graph(SymmetricGroup(5), [[1, 2]], OnSets,|
  !gapprompt@>| !gapinput@function(x, y) return Intersection(x, y) = []; end);;|
  !gapprompt@gap>| !gapinput@Digraph(Petersen);|
  <immutable digraph with 10 vertices, 30 edges>
  !gapprompt@gap>| !gapinput@gr := Digraph([1 .. 10], ReturnTrue);|
  <immutable digraph with 10 vertices, 100 edges>
  !gapprompt@gap>| !gapinput@Digraph("Diamond");|
  <immutable digraph with 4 vertices, 10 edges>
\end{Verbatim}
 The next example illustrates the uses of the fourth and fifth variants of this
constructor. The resulting digraph is a strongly regular graph, and it is
actually the point graph of the van Lint\texttt{\symbol{45}}Schrijver partial
geometry, \cite{vLS81}. The algebraic description is taken from the seminal paper of Calderbank and
Kantor \cite{CK86}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@f := GF(3 ^ 4);|
  GF(3^4)
  !gapprompt@gap>| !gapinput@gamma := First(f, x -> Order(x) = 5);|
  Z(3^4)^64
  !gapprompt@gap>| !gapinput@L := Union([Zero(f)], List(Group(gamma)));|
  [ 0*Z(3), Z(3)^0, Z(3^4)^16, Z(3^4)^32, Z(3^4)^48, Z(3^4)^64 ]
  !gapprompt@gap>| !gapinput@omega := Union(List(L, x -> List(Difference(L, [x]), y -> x - y)));|
  [ Z(3)^0, Z(3), Z(3^4)^5, Z(3^4)^7, Z(3^4)^8, Z(3^4)^13, Z(3^4)^15, 
    Z(3^4)^16, Z(3^4)^21, Z(3^4)^23, Z(3^4)^24, Z(3^4)^29, Z(3^4)^31, 
    Z(3^4)^32, Z(3^4)^37, Z(3^4)^39, Z(3^4)^45, Z(3^4)^47, Z(3^4)^48, 
    Z(3^4)^53, Z(3^4)^55, Z(3^4)^56, Z(3^4)^61, Z(3^4)^63, Z(3^4)^64, 
    Z(3^4)^69, Z(3^4)^71, Z(3^4)^72, Z(3^4)^77, Z(3^4)^79 ]
  !gapprompt@gap>| !gapinput@adj := function(x, y)|
  !gapprompt@>| !gapinput@  return x - y in omega;|
  !gapprompt@>| !gapinput@end;|
  function( x, y ) ... end
  !gapprompt@gap>| !gapinput@digraph := Digraph(AsList(f), adj);|
  <immutable digraph with 81 vertices, 2430 edges>
  !gapprompt@gap>| !gapinput@group := Group(Z(3));;|
  !gapprompt@gap>| !gapinput@act := \*;|
  <Operation "*">
  !gapprompt@gap>| !gapinput@digraph := Digraph(group, List(f), act, adj);|
  <immutable digraph with 81 vertices, 2430 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphByAdjacencyMatrix}}
\logpage{[ 3, 1, 8 ]}\nobreak
\hyperdef{L}{X8023FE387A3AB609}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphByAdjacencyMatrix({\mdseries\slshape [filt, ]list})\index{DigraphByAdjacencyMatrix@\texttt{DigraphByAdjacencyMatrix}}
\label{DigraphByAdjacencyMatrix}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 If \mbox{\texttt{\mdseries\slshape list}} is the adjacency matrix of a digraph in the sense o\texttt{AdjacencyMatrix} (\ref{AdjacencyMatrix}), then this operation returns the digraph which is defined by \mbox{\texttt{\mdseries\slshape list}}. 

 Alternatively, if \mbox{\texttt{\mdseries\slshape list}} is a square boolean matrix, then this operation returns the digraph with \texttt{Length(}\mbox{\texttt{\mdseries\slshape list}}\texttt{)} vertices which has the edge \texttt{[i,j]} if and only if \mbox{\texttt{\mdseries\slshape list}}\texttt{[i][j]} is \texttt{true}. 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@DigraphByAdjacencyMatrix([|
  !gapprompt@>| !gapinput@[0, 1, 0, 2, 0],|
  !gapprompt@>| !gapinput@[1, 1, 1, 0, 1],|
  !gapprompt@>| !gapinput@[0, 3, 2, 1, 1],|
  !gapprompt@>| !gapinput@[0, 0, 1, 0, 1],|
  !gapprompt@>| !gapinput@[2, 0, 0, 0, 0]]);|
  <immutable multidigraph with 5 vertices, 18 edges>
  !gapprompt@gap>| !gapinput@D := DigraphByAdjacencyMatrix([|
  !gapprompt@>| !gapinput@[true, false, true],|
  !gapprompt@>| !gapinput@[false, false, true],|
  !gapprompt@>| !gapinput@[false, true, false]]);|
  <immutable digraph with 3 vertices, 4 edges>
  !gapprompt@gap>| !gapinput@OutNeighbours(D);|
  [ [ 1, 3 ], [ 3 ], [ 2 ] ]
  !gapprompt@gap>| !gapinput@D := DigraphByAdjacencyMatrix(IsMutableDigraph, |
  !gapprompt@>| !gapinput@[[true, false, true],|
  !gapprompt@>| !gapinput@ [false, false, true],|
  !gapprompt@>| !gapinput@ [false, true, false]]);|
  <mutable digraph with 3 vertices, 4 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphByEdges}}
\logpage{[ 3, 1, 9 ]}\nobreak
\hyperdef{L}{X7F37B6768349E269}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphByEdges({\mdseries\slshape [filt, ]list[, n]})\index{DigraphByEdges@\texttt{DigraphByEdges}}
\label{DigraphByEdges}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 If \mbox{\texttt{\mdseries\slshape list}} is list of pairs of positive integers, then this function returns the digraph
with the minimum number of vertices \texttt{m} such that its list equal \mbox{\texttt{\mdseries\slshape list}}.

 If the optional second argument \mbox{\texttt{\mdseries\slshape n}} is a positive integer with \texttt{\mbox{\texttt{\mdseries\slshape n}} {\textgreater}= m} (with \texttt{m} defined as above), then this function returns the digraph with \mbox{\texttt{\mdseries\slshape n}} vertices and list \mbox{\texttt{\mdseries\slshape list}}. 

 See \texttt{DigraphEdges} (\ref{DigraphEdges}). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@DigraphByEdges(|
  !gapprompt@>| !gapinput@[[1, 3], [2, 1], [2, 3], [2, 5], [3, 6],|
  !gapprompt@>| !gapinput@ [4, 6], [5, 2], [5, 4], [5, 6], [6, 6]]);|
  <immutable digraph with 6 vertices, 10 edges>
  !gapprompt@gap>| !gapinput@DigraphByEdges(|
  !gapprompt@>| !gapinput@[[1, 3], [2, 1], [2, 3], [2, 5], [3, 6],|
  !gapprompt@>| !gapinput@ [4, 6], [5, 2], [5, 4], [5, 6], [6, 6]], 12);|
  <immutable digraph with 12 vertices, 10 edges>
  !gapprompt@gap>| !gapinput@DigraphByEdges(IsMutableDigraph, |
  !gapprompt@>| !gapinput@[[1, 3], [2, 1], [2, 3], [2, 5], [3, 6],|
  !gapprompt@>| !gapinput@ [4, 6], [5, 2], [5, 4], [5, 6], [6, 6]], 12);|
  <mutable digraph with 12 vertices, 10 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{EdgeOrbitsDigraph}}
\logpage{[ 3, 1, 10 ]}\nobreak
\hyperdef{L}{X7B75C1D680757D6F}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{EdgeOrbitsDigraph({\mdseries\slshape G, edges[, n]})\index{EdgeOrbitsDigraph@\texttt{EdgeOrbitsDigraph}}
\label{EdgeOrbitsDigraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
 An immutable digraph. 



 If \mbox{\texttt{\mdseries\slshape G}} is a permutation group, \mbox{\texttt{\mdseries\slshape edges}} is an edge or list of edges, and \mbox{\texttt{\mdseries\slshape n}} is a non\texttt{\symbol{45}}negative integer such that \mbox{\texttt{\mdseries\slshape G}} fixes \texttt{[1 .. \mbox{\texttt{\mdseries\slshape n}}]} setwise, then this operation returns an immutable digraph with \mbox{\texttt{\mdseries\slshape n}} vertices and the union of the orbits of the edges in \mbox{\texttt{\mdseries\slshape  edges }} under the action of the permutation group \mbox{\texttt{\mdseries\slshape G}}. An edge in this context is simply a pair of positive integers. 

 If the optional third argument \mbox{\texttt{\mdseries\slshape n}} is not present, then the largest moved point of the permutation group \mbox{\texttt{\mdseries\slshape G}} is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@digraph := EdgeOrbitsDigraph(Group((1, 3), (1, 2)(3, 4)),|
  !gapprompt@>| !gapinput@                                [[1, 2], [4, 5]], 5);|
  <immutable digraph with 5 vertices, 12 edges>
  !gapprompt@gap>| !gapinput@OutNeighbours(digraph);|
  [ [ 2, 4, 5 ], [ 1, 3, 5 ], [ 2, 4, 5 ], [ 1, 3, 5 ], [  ] ]
  !gapprompt@gap>| !gapinput@RepresentativeOutNeighbours(digraph);|
  [ [ 2, 4, 5 ], [  ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphByInNeighbours}}
\logpage{[ 3, 1, 11 ]}\nobreak
\hyperdef{L}{X81BC49B57EAADEFB}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphByInNeighbours({\mdseries\slshape [filt, ]list})\index{DigraphByInNeighbours@\texttt{DigraphByInNeighbours}}
\label{DigraphByInNeighbours}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphByInNeighbors({\mdseries\slshape [filt, ]list})\index{DigraphByInNeighbors@\texttt{DigraphByInNeighbors}}
\label{DigraphByInNeighbors}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 If \mbox{\texttt{\mdseries\slshape list}} is a list of lists of positive integers list the range \texttt{[1 .. Length(\mbox{\texttt{\mdseries\slshape list}})]}, then this function returns the digraph with vertices $E^0=$\texttt{[1 .. Length(\mbox{\texttt{\mdseries\slshape list}})]}, and edges corresponding to the entries of \mbox{\texttt{\mdseries\slshape list}}. More precisely, there is an edge with source vertex \texttt{i} and range vertex \texttt{j} if \texttt{i} is in the list \texttt{\mbox{\texttt{\mdseries\slshape list}}[j]}. 

 If \texttt{i} occurs in the list \texttt{\mbox{\texttt{\mdseries\slshape list}}[j]} with multiplicity \texttt{k}, then there are \texttt{k} multiple edges from \texttt{i} to \texttt{j}. 

 See \texttt{InNeighbours} (\ref{InNeighbours}). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := DigraphByInNeighbours([|
  !gapprompt@>| !gapinput@[2, 5, 8, 10], [2, 3, 4, 5, 6, 8, 9, 10],|
  !gapprompt@>| !gapinput@[1], [3, 5, 7, 8, 10], [2, 5, 7], [3, 6, 7, 9, 10], [1, 4],|
  !gapprompt@>| !gapinput@[1, 5, 9], [1, 2, 7, 8], [3, 5]]);|
  <immutable digraph with 10 vertices, 37 edges>
  !gapprompt@gap>| !gapinput@D := DigraphByInNeighbours([[2, 3, 2], [1], [1, 2, 3]]);|
  <immutable multidigraph with 3 vertices, 7 edges>
  !gapprompt@gap>| !gapinput@D := DigraphByInNeighbours(IsMutableDigraph, |
  !gapprompt@>| !gapinput@                              [[2, 3, 2], [1], [1, 2, 3]]);|
  <mutable multidigraph with 3 vertices, 7 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{CayleyDigraph}}
\logpage{[ 3, 1, 12 ]}\nobreak
\hyperdef{L}{X7FCADADC7EC28478}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{CayleyDigraph({\mdseries\slshape [filt, ]G[, gens]})\index{CayleyDigraph@\texttt{CayleyDigraph}}
\label{CayleyDigraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 Let \mbox{\texttt{\mdseries\slshape G}} be any group and let \mbox{\texttt{\mdseries\slshape gens}} be a list of elements of \mbox{\texttt{\mdseries\slshape G}}. This operation returns a digraph that corresponds to the Cayley graph of \mbox{\texttt{\mdseries\slshape G}} with respect to \mbox{\texttt{\mdseries\slshape gens}}. 

 The vertices of the digraph correspond to the elements of \mbox{\texttt{\mdseries\slshape G}}, in the order given by \texttt{Set(\mbox{\texttt{\mdseries\slshape G}})}. There exists an edge from vertex \texttt{u} to vertex \texttt{v} if and only if there exists a generator \texttt{g} in \mbox{\texttt{\mdseries\slshape gens}} such that \texttt{Set(\mbox{\texttt{\mdseries\slshape G}})[u] * g = Set(\mbox{\texttt{\mdseries\slshape G}})[v]}. 

 The labels of the vertices \texttt{u}, \texttt{v}, and the edge \texttt{[u, v]} are the corresponding elements \texttt{AsList(\mbox{\texttt{\mdseries\slshape G}})[u]}, \texttt{AsList(\mbox{\texttt{\mdseries\slshape G}})[v]}, and generator \texttt{g}, respectively; see \texttt{DigraphVertexLabel} (\ref{DigraphVertexLabel}) and \texttt{DigraphEdgeLabel} (\ref{DigraphEdgeLabel}). 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 If the optional third argument \mbox{\texttt{\mdseries\slshape gens}} is not present, then the generators of \mbox{\texttt{\mdseries\slshape G}} are used by default.

 The digraph created by this operation belongs to the category \texttt{IsCayleyDigraph} (\ref{IsCayleyDigraph}), the group \mbox{\texttt{\mdseries\slshape G}} can be recovered from the digraph using \texttt{GroupOfCayleyDigraph} (\ref{GroupOfCayleyDigraph}), and the generators \mbox{\texttt{\mdseries\slshape gens}} can be obtained using \texttt{GeneratorsOfCayleyDigraph} (\ref{GeneratorsOfCayleyDigraph}).

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G := DihedralGroup(8);|
  <pc group of size 8 with 3 generators>
  !gapprompt@gap>| !gapinput@CayleyDigraph(G);|
  <immutable digraph with 8 vertices, 24 edges>
  !gapprompt@gap>| !gapinput@G := DihedralGroup(IsPermGroup, 8);|
  Group([ (1,2,3,4), (2,4) ])
  !gapprompt@gap>| !gapinput@CayleyDigraph(G);|
  <immutable digraph with 8 vertices, 16 edges>
  !gapprompt@gap>| !gapinput@digraph := CayleyDigraph(G, [()]);|
  <immutable digraph with 8 vertices, 8 edges>
  !gapprompt@gap>| !gapinput@GroupOfCayleyDigraph(digraph) = G;|
  true
  !gapprompt@gap>| !gapinput@GeneratorsOfCayleyDigraph(digraph);|
  [ () ]
  !gapprompt@gap>| !gapinput@digraph := CayleyDigraph(IsMutable, G, [()]);|
  <mutable digraph with 8 vertices, 8 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{ListNamedDigraphs}}
\logpage{[ 3, 1, 13 ]}\nobreak
\hyperdef{L}{X7BB820C9813F035F}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{ListNamedDigraphs({\mdseries\slshape s[, level]})\index{ListNamedDigraphs@\texttt{ListNamedDigraphs}}
\label{ListNamedDigraphs}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A list of strings representing digraph names.



 This function searches through the list of names that are currently in the \textsf{Digraphs} database of named digraphs. The first argument \mbox{\texttt{\mdseries\slshape s}} should be a partially completed string; this function returns all completions \texttt{str} of the strin\mbox{\texttt{\mdseries\slshape s}} such that \texttt{Digraph(str)} will successfully return a digraph. 

 The optional second argument \mbox{\texttt{\mdseries\slshape level}} controls the flexibility of the search. If \texttt{\mbox{\texttt{\mdseries\slshape level}} = 1}, then only strings beginning exactly with \mbox{\texttt{\mdseries\slshape s}} are returned. If \texttt{\mbox{\texttt{\mdseries\slshape level}} = 2}, then all names containing \mbox{\texttt{\mdseries\slshape s}} as a substring are returned. If \texttt{\mbox{\texttt{\mdseries\slshape level}} = 3}, then once again a substring search is carried out, but characters that are
not alphanumeric are ignored in the search. 

 If \mbox{\texttt{\mdseries\slshape level}} is not specified, it is set by default to equal 2. 

 The search is always case and whitespace insensitive, and this is also the
case when applying \texttt{Digraph} (\ref{Digraph}) to a string. }

 }

 
\section{\textcolor{Chapter }{Changing representations}}\logpage{[ 3, 2, 0 ]}
\hyperdef{L}{X83608C407CC8836D}{}
{
 

\subsection{\textcolor{Chapter }{AsBinaryRelation}}
\logpage{[ 3, 2, 1 ]}\nobreak
\hyperdef{L}{X7FBC4BDB82FBEDD2}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{AsBinaryRelation({\mdseries\slshape digraph})\index{AsBinaryRelation@\texttt{AsBinaryRelation}}
\label{AsBinaryRelation}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A binary relation.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph with a positive number of vertices $n$, and no multiple edges, then this operation returns a binary relation on the
points \texttt{[1..n]}. The pair \texttt{[i,j]} is in the binary relation if and only if \texttt{[i,j]} is an edge in \mbox{\texttt{\mdseries\slshape digraph}}. 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[3, 2], [1, 2], [2], [3, 4]]);|
  <immutable digraph with 4 vertices, 7 edges>
  !gapprompt@gap>| !gapinput@AsBinaryRelation(D);|
  Binary Relation on 4 points
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{AsDigraph (for a binary relation)}}
\logpage{[ 3, 2, 2 ]}\nobreak
\hyperdef{L}{X86834E307EACC670}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{AsDigraph({\mdseries\slshape [filt, ]f[, n]})\index{AsDigraph@\texttt{AsDigraph}!for a binary relation}
\label{AsDigraph:for a binary relation}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph, or \texttt{fail}.



 If \mbox{\texttt{\mdseries\slshape f}} is a binary relation represented as one of the following in \textsf{GAP}: 
\begin{description}
\item[{ a transformation }]  satisfying \texttt{IsTransformation} (\textbf{Reference: IsTransformation}); 
\item[{ a permutation }]  satisfying \texttt{IsPerm} (\textbf{Reference: IsPerm}); 
\item[{ a partial perm }]  satisfying \texttt{IsPartialPerm} (\textbf{Reference: IsPartialPerm}); 
\item[{ a binary relation }]  satisfying \texttt{IsBinaryRelation} (\textbf{Reference: IsBinaryRelation}); 
\end{description}
 and \mbox{\texttt{\mdseries\slshape n}} is a non\texttt{\symbol{45}}negative integer, then \texttt{AsDigraph} attempts to construct a digraph with \mbox{\texttt{\mdseries\slshape n}} vertices whose edges are determined by \mbox{\texttt{\mdseries\slshape f}}.

 The digraph returned by \texttt{AsDigraph} has for each vertex \texttt{v} in \texttt{[1 .. \mbox{\texttt{\mdseries\slshape n}}]}, an edge with source \texttt{v} and range \texttt{v \texttt{\symbol{94}} \mbox{\texttt{\mdseries\slshape f}}}. If \texttt{v \texttt{\symbol{94}} \mbox{\texttt{\mdseries\slshape f}}} is greater than \mbox{\texttt{\mdseries\slshape n}} for any \texttt{v}, then \texttt{fail} is returned. 

 If the optional second argument \mbox{\texttt{\mdseries\slshape n}} is not supplied, then the degree of the transformation \mbox{\texttt{\mdseries\slshape f}}, the largest moved point of the permutation \mbox{\texttt{\mdseries\slshape f}}, the maximum of the degree and the codegree of the partial perm \mbox{\texttt{\mdseries\slshape f}}, or as applicable, is used by default. 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@f := Transformation([4, 3, 3, 1, 7, 9, 10, 4, 2, 3]);|
  Transformation( [ 4, 3, 3, 1, 7, 9, 10, 4, 2, 3 ] )
  !gapprompt@gap>| !gapinput@AsDigraph(f);|
  <immutable functional digraph with 10 vertices>
  !gapprompt@gap>| !gapinput@AsDigraph(f, 4);|
  <immutable functional digraph with 4 vertices>
  !gapprompt@gap>| !gapinput@AsDigraph(f, 5);|
  fail
  !gapprompt@gap>| !gapinput@AsDigraph((1, 2, 3, 4)) = CycleDigraph(4);|
  true
  !gapprompt@gap>| !gapinput@D := AsDigraph(IsMutableDigraph, (1, 3)(2, 4), 5);|
  <mutable digraph with 5 vertices, 5 edges>
  !gapprompt@gap>| !gapinput@DigraphEdges(D);|
  [ [ 1, 3 ], [ 2, 4 ], [ 3, 1 ], [ 4, 2 ], [ 5, 5 ] ]
  !gapprompt@gap>| !gapinput@b := BinaryRelationOnPoints(|
  !gapprompt@>| !gapinput@[[3], [1, 3, 5], [1], [1, 2, 4], [2, 3, 5]]);|
  Binary Relation on 5 points
  !gapprompt@gap>| !gapinput@D := AsDigraph(b);|
  <immutable digraph with 5 vertices, 11 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{Graph}}
\logpage{[ 3, 2, 3 ]}\nobreak
\hyperdef{L}{X7B335342839E5146}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{Graph({\mdseries\slshape digraph})\index{Graph@\texttt{Graph}}
\label{Graph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
\href{https://gap-packages.github.io/grape} {GRAPE}  package graph.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a mutable or immutable digraph without multiple edges, then this operation
returns a \href{https://gap-packages.github.io/grape} {GRAPE}  package graph that is isomorphic to \mbox{\texttt{\mdseries\slshape digraph}}. 

 If \mbox{\texttt{\mdseries\slshape digraph}} is a multidigraph, then since \href{https://gap-packages.github.io/grape} {GRAPE}  does not support multiple edges, the multiple edges will be reduced to a
single edge in the result. In order words, for a multidigraph this operation
will return the same as \texttt{Graph(DigraphRemoveAllMultipleEdges(}\mbox{\texttt{\mdseries\slshape digraph}}\texttt{))}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Petersen := Graph(SymmetricGroup(5), [[1, 2]], OnSets,|
  !gapprompt@>| !gapinput@function(x, y) return Intersection(x, y) = []; end);;|
  !gapprompt@gap>| !gapinput@Display(Petersen);|
  rec(
    adjacencies := [ [ 3, 5, 8 ] ],
    group := 
     Group( [ ( 1, 2, 3, 5, 7)( 4, 6, 8, 9,10), ( 2, 4)( 6, 9)( 7,10) 
       ] ),
    isGraph := true,
    names := [ [ 1, 2 ], [ 2, 3 ], [ 3, 4 ], [ 1, 3 ], [ 4, 5 ], 
        [ 2, 4 ], [ 1, 5 ], [ 3, 5 ], [ 1, 4 ], [ 2, 5 ] ],
    order := 10,
    representatives := [ 1 ],
    schreierVector := [ -1, 1, 1, 2, 1, 1, 1, 1, 2, 2 ] )
  !gapprompt@gap>| !gapinput@Digraph(Petersen);|
  <immutable digraph with 10 vertices, 30 edges>
  !gapprompt@gap>| !gapinput@Graph(last) = Petersen;|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{AsGraph}}
\logpage{[ 3, 2, 4 ]}\nobreak
\hyperdef{L}{X7C4F13E080EC16B0}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{AsGraph({\mdseries\slshape digraph})\index{AsGraph@\texttt{AsGraph}}
\label{AsGraph}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
\href{https://gap-packages.github.io/grape} {GRAPE}  package graph.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph, then this method returns the same as \texttt{Graph} (\ref{Graph}), except that if \mbox{\texttt{\mdseries\slshape digraph}} is immutable, then the result will be stored as a mutable attribute of \mbox{\texttt{\mdseries\slshape digraph}}. In this latter case, when \texttt{AsGraph(}\mbox{\texttt{\mdseries\slshape digraph}}\texttt{)} is called subsequently, the same \textsf{GAP} object will be returned as before. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[1, 2], [3], []]);|
  <immutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@G := AsGraph(D);|
  rec( adjacencies := [ [ 1, 2 ], [ 3 ], [  ] ], group := Group(()), 
    isGraph := true, names := [ 1 .. 3 ], order := 3, 
    representatives := [ 1, 2, 3 ], schreierVector := [ -1, -2, -3 ] )
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{AsTransformation}}
\logpage{[ 3, 2, 5 ]}\nobreak
\hyperdef{L}{X7C5360B2799943F3}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{AsTransformation({\mdseries\slshape digraph})\index{AsTransformation@\texttt{AsTransformation}}
\label{AsTransformation}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A transformation, or \texttt{fail}



 If \mbox{\texttt{\mdseries\slshape digraph}} is a functional digraph, then \texttt{AsTransformation} returns the transformation which is defined by \mbox{\texttt{\mdseries\slshape digraph}}. See \texttt{IsFunctionalDigraph} (\ref{IsFunctionalDigraph}). Otherwise, \texttt{AsTransformation(}\mbox{\texttt{\mdseries\slshape digraph}}\texttt{)} returns \texttt{fail}. 

 If \mbox{\texttt{\mdseries\slshape digraph}} is a functional digraph with $n$ vertices, then \texttt{AsTransformation(}\mbox{\texttt{\mdseries\slshape digraph}}\texttt{)} will return the transformation \texttt{f} of degree at most $n$ where for each $1 \leq i \leq n$, \texttt{i \texttt{\symbol{94}} f} is equal to the unique out\texttt{\symbol{45}}neighbour of vertex \texttt{i} in \mbox{\texttt{\mdseries\slshape digraph}}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[1], [3], [2]]);|
  <immutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@AsTransformation(D);|
  Transformation( [ 1, 3, 2 ] )
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@AsTransformation(D);|
  Transformation( [ 2, 3, 1 ] )
  !gapprompt@gap>| !gapinput@AsPermutation(last);|
  (1,2,3)
  !gapprompt@gap>| !gapinput@D := Digraph([[2, 3], [], []]);|
  <immutable digraph with 3 vertices, 2 edges>
  !gapprompt@gap>| !gapinput@AsTransformation(D);|
  fail
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{New digraphs from old}}\logpage{[ 3, 3, 0 ]}
\hyperdef{L}{X85126078848B420A}{}
{
 

\subsection{\textcolor{Chapter }{DigraphImmutableCopy}}
\logpage{[ 3, 3, 1 ]}\nobreak
\hyperdef{L}{X83D93A8A8251E6F9}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphImmutableCopy({\mdseries\slshape digraph})\index{DigraphImmutableCopy@\texttt{DigraphImmutableCopy}}
\label{DigraphImmutableCopy}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphMutableCopy({\mdseries\slshape digraph})\index{DigraphMutableCopy@\texttt{DigraphMutableCopy}}
\label{DigraphMutableCopy}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphCopySameMutability({\mdseries\slshape digraph})\index{DigraphCopySameMutability@\texttt{DigraphCopySameMutability}}
\label{DigraphCopySameMutability}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphCopy({\mdseries\slshape digraph})\index{DigraphCopy@\texttt{DigraphCopy}}
\label{DigraphCopy}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 Each of these operations returns a new copy of \mbox{\texttt{\mdseries\slshape digraph}}, of the appropriate mutability, retaining none of the attributes or
properties of \mbox{\texttt{\mdseries\slshape digraph}}. 

 \texttt{DigraphCopy} is a synonym for \texttt{DigraphCopySameMutability}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(10);|
  <immutable cycle digraph with 10 vertices>
  !gapprompt@gap>| !gapinput@DigraphCopy(D) = D;|
  true
  !gapprompt@gap>| !gapinput@IsIdenticalObj(DigraphCopy(D), D);|
  false
  !gapprompt@gap>| !gapinput@DigraphMutableCopy(D);|
  <mutable digraph with 10 vertices, 10 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphImmutableCopyIfImmutable}}
\logpage{[ 3, 3, 2 ]}\nobreak
\hyperdef{L}{X8399F7427B227228}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphImmutableCopyIfImmutable({\mdseries\slshape digraph})\index{DigraphImmutableCopyIfImmutable@\texttt{DigraphImmutableCopyIfImmutable}}
\label{DigraphImmutableCopyIfImmutable}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphImmutableCopyIfMutable({\mdseries\slshape digraph})\index{DigraphImmutableCopyIfMutable@\texttt{DigraphImmutableCopyIfMutable}}
\label{DigraphImmutableCopyIfMutable}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphMutableCopyIfMutable({\mdseries\slshape digraph})\index{DigraphMutableCopyIfMutable@\texttt{DigraphMutableCopyIfMutable}}
\label{DigraphMutableCopyIfMutable}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphMutableCopyIfImmutable({\mdseries\slshape digraph})\index{DigraphMutableCopyIfImmutable@\texttt{DigraphMutableCopyIfImmutable}}
\label{DigraphMutableCopyIfImmutable}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 Each of these operations returns either the original argument \mbox{\texttt{\mdseries\slshape digraph}}, or a new copy of \mbox{\texttt{\mdseries\slshape digraph}} of the appropriate mutability, according to the mutability of \mbox{\texttt{\mdseries\slshape digraph}}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@C := CycleDigraph(10);|
  <immutable cycle digraph with 10 vertices>
  !gapprompt@gap>| !gapinput@D := DigraphImmutableCopyIfImmutable(C);|
  <immutable digraph with 10 vertices, 10 edges>
  !gapprompt@gap>| !gapinput@IsIdenticalObj(C, D);|
  false
  !gapprompt@gap>| !gapinput@C = D;|
  true
  !gapprompt@gap>| !gapinput@D := DigraphImmutableCopyIfMutable(C);|
  <immutable cycle digraph with 10 vertices>
  !gapprompt@gap>| !gapinput@IsIdenticalObj(C, D);|
  true
  !gapprompt@gap>| !gapinput@C = D;|
  true
  !gapprompt@gap>| !gapinput@D := DigraphMutableCopyIfMutable(C);|
  <immutable cycle digraph with 10 vertices>
  !gapprompt@gap>| !gapinput@IsMutableDigraph(D);|
  false
  !gapprompt@gap>| !gapinput@D := DigraphMutableCopyIfImmutable(C);|
  <mutable digraph with 10 vertices, 10 edges>
  !gapprompt@gap>| !gapinput@IsMutableDigraph(D);|
  true
  !gapprompt@gap>| !gapinput@C := CycleDigraph(IsMutableDigraph, 10);|
  <mutable digraph with 10 vertices, 10 edges>
  !gapprompt@gap>| !gapinput@D := DigraphImmutableCopyIfImmutable(C);|
  <mutable digraph with 10 vertices, 10 edges>
  !gapprompt@gap>| !gapinput@IsIdenticalObj(C, D);|
  true
  !gapprompt@gap>| !gapinput@C = D;|
  true
  !gapprompt@gap>| !gapinput@D := DigraphImmutableCopyIfMutable(C);|
  <immutable digraph with 10 vertices, 10 edges>
  !gapprompt@gap>| !gapinput@IsIdenticalObj(C, D);|
  false
  !gapprompt@gap>| !gapinput@C = D;|
  true
  !gapprompt@gap>| !gapinput@D := DigraphMutableCopyIfMutable(C);|
  <mutable digraph with 10 vertices, 10 edges>
  !gapprompt@gap>| !gapinput@IsMutableDigraph(D);|
  true
  !gapprompt@gap>| !gapinput@D := DigraphMutableCopyIfImmutable(C);|
  <mutable digraph with 10 vertices, 10 edges>
  !gapprompt@gap>| !gapinput@IsIdenticalObj(C, D);|
  true
  !gapprompt@gap>| !gapinput@IsMutableDigraph(D);|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{InducedSubdigraph}}
\logpage{[ 3, 3, 3 ]}\nobreak
\hyperdef{L}{X83C51DA182CCEA2F}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{InducedSubdigraph({\mdseries\slshape digraph, verts})\index{InducedSubdigraph@\texttt{InducedSubdigraph}}
\label{InducedSubdigraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph, and \mbox{\texttt{\mdseries\slshape verts}} is a subset of the vertices of \mbox{\texttt{\mdseries\slshape digraph}}, then this operation returns a digraph constructed from \mbox{\texttt{\mdseries\slshape digraph}} by retaining precisely those vertices in \mbox{\texttt{\mdseries\slshape verts}}, and those edges whose source and range vertices are both contained in \mbox{\texttt{\mdseries\slshape verts}}. 

 The vertices of the induced subdigraph are \texttt{[1..Length(verts)]} but the original vertex labels can be accessed via \texttt{DigraphVertexLabels} (\ref{DigraphVertexLabels}). 

 If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then \mbox{\texttt{\mdseries\slshape digraph}} is modified in place. If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), a new immutable digraph containing the appropriate vertices and edges is
returned.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[1, 1, 2, 3, 4, 4], [1, 3, 4], [3, 1], [1, 1]]);|
  <immutable multidigraph with 4 vertices, 13 edges>
  !gapprompt@gap>| !gapinput@InducedSubdigraph(D, [1, 3, 4]);|
  <immutable multidigraph with 3 vertices, 9 edges>
  !gapprompt@gap>| !gapinput@DigraphVertices(last);|
  [ 1 .. 3 ]
  !gapprompt@gap>| !gapinput@D := DigraphMutableCopy(D);|
  <mutable multidigraph with 4 vertices, 13 edges>
  !gapprompt@gap>| !gapinput@new := InducedSubdigraph(D, [1, 3, 4]);|
  <mutable multidigraph with 3 vertices, 9 edges>
  !gapprompt@gap>| !gapinput@D = new;|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{ReducedDigraph}}
\logpage{[ 3, 3, 4 ]}\nobreak
\hyperdef{L}{X7CAF093B85A93D2F}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{ReducedDigraph({\mdseries\slshape digraph})\index{ReducedDigraph@\texttt{ReducedDigraph}}
\label{ReducedDigraph}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{ReducedDigraphAttr({\mdseries\slshape digraph})\index{ReducedDigraphAttr@\texttt{ReducedDigraphAttr}}
\label{ReducedDigraphAttr}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A digraph.



 This function returns a digraph isomorphic to the subdigraph of \mbox{\texttt{\mdseries\slshape digraph}} induced by the set of non\texttt{\symbol{45}}isolated vertices, i.e. the set
of those vertices of \mbox{\texttt{\mdseries\slshape digraph}} which are the source or range of some edge in \mbox{\texttt{\mdseries\slshape digraph}}. See \texttt{InducedSubdigraph} (\ref{InducedSubdigraph}). 

 The ordering of the remaining vertices of \mbox{\texttt{\mdseries\slshape digraph}} is preserved, as are the labels of the remaining vertices and edges; see \texttt{DigraphVertexLabels} (\ref{DigraphVertexLabels}) and \texttt{DigraphEdgeLabels} (\ref{DigraphEdgeLabels}). This can allow one to match a vertex in the reduced digraph to the
corresponding vertex in \mbox{\texttt{\mdseries\slshape digraph}}. 

 If \mbox{\texttt{\mdseries\slshape digraph}} is immutable, then a new immutable digraph is returned. Otherwise, the
isolated vertices of the mutable digraph \mbox{\texttt{\mdseries\slshape digraph}} are removed in\texttt{\symbol{45}}place. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[1, 2], [], [], [1, 4], []]);|
  <immutable digraph with 5 vertices, 4 edges>
  !gapprompt@gap>| !gapinput@R := ReducedDigraph(D);|
  <immutable digraph with 3 vertices, 4 edges>
  !gapprompt@gap>| !gapinput@OutNeighbours(R);|
  [ [ 1, 2 ], [  ], [ 1, 3 ] ]
  !gapprompt@gap>| !gapinput@DigraphEdges(D);|
  [ [ 1, 1 ], [ 1, 2 ], [ 4, 1 ], [ 4, 4 ] ]
  !gapprompt@gap>| !gapinput@DigraphEdges(R);|
  [ [ 1, 1 ], [ 1, 2 ], [ 3, 1 ], [ 3, 3 ] ]
  !gapprompt@gap>| !gapinput@DigraphVertexLabel(R, 3);|
  4
  !gapprompt@gap>| !gapinput@DigraphVertexLabel(R, 2);|
  2
  !gapprompt@gap>| !gapinput@D := Digraph(IsMutableDigraph, [[], [3], [2]]);|
  <mutable digraph with 3 vertices, 2 edges>
  !gapprompt@gap>| !gapinput@ReducedDigraph(D);|
  <mutable digraph with 2 vertices, 2 edges>
  !gapprompt@gap>| !gapinput@D;|
  <mutable digraph with 2 vertices, 2 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{MaximalSymmetricSubdigraph}}
\logpage{[ 3, 3, 5 ]}\nobreak
\hyperdef{L}{X829E3EAC7C4B3B1E}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{MaximalSymmetricSubdigraph({\mdseries\slshape digraph})\index{MaximalSymmetricSubdigraph@\texttt{MaximalSymmetricSubdigraph}}
\label{MaximalSymmetricSubdigraph}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{MaximalSymmetricSubdigraphAttr({\mdseries\slshape digraph})\index{MaximalSymmetricSubdigraphAttr@\texttt{MaximalSymmetricSubdigraphAttr}}
\label{MaximalSymmetricSubdigraphAttr}
}\hfill{\scriptsize (attribute)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{MaximalSymmetricSubdigraphWithoutLoops({\mdseries\slshape digraph})\index{MaximalSymmetricSubdigraphWithoutLoops@\texttt{Maximal}\-\texttt{Symmetric}\-\texttt{Subdigraph}\-\texttt{Without}\-\texttt{Loops}}
\label{MaximalSymmetricSubdigraphWithoutLoops}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{MaximalSymmetricSubdigraphWithoutLoopsAttr({\mdseries\slshape digraph})\index{MaximalSymmetricSubdigraphWithoutLoopsAttr@\texttt{Maximal}\-\texttt{Symmetric}\-\texttt{Subdigraph}\-\texttt{Without}\-\texttt{Loops}\-\texttt{Attr}}
\label{MaximalSymmetricSubdigraphWithoutLoopsAttr}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph, then \texttt{MaximalSymmetricSubdigraph} returns a symmetric digraph without multiple edges which has the same vertex
set as \mbox{\texttt{\mdseries\slshape digraph}}, and whose edge list is formed from \mbox{\texttt{\mdseries\slshape digraph}} by ignoring the multiplicity of edges, and by ignoring edges \texttt{[u,v]} for which there does not exist an edge \texttt{[v,u]}. 

 The digraph returned by \texttt{MaximalSymmetricSubdigraphWithoutLoops} is the same, except that loops are removed.

 If \mbox{\texttt{\mdseries\slshape digraph}} is immutable, then a new immutable digraph is returned. Otherwise, the mutable
digraph \mbox{\texttt{\mdseries\slshape digraph}} is changed in\texttt{\symbol{45}}place into such a digraph described above.

 See \texttt{IsSymmetricDigraph} (\ref{IsSymmetricDigraph}), \texttt{IsMultiDigraph} (\ref{IsMultiDigraph}), and \texttt{DigraphHasLoops} (\ref{DigraphHasLoops}) for more information. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[2, 2], [1, 3], [4], [3, 1]]);|
  <immutable multidigraph with 4 vertices, 7 edges>
  !gapprompt@gap>| !gapinput@not IsSymmetricDigraph(D) and IsMultiDigraph(D);|
  true
  !gapprompt@gap>| !gapinput@OutNeighbours(D);|
  [ [ 2, 2 ], [ 1, 3 ], [ 4 ], [ 3, 1 ] ]
  !gapprompt@gap>| !gapinput@S := MaximalSymmetricSubdigraph(D);|
  <immutable symmetric digraph with 4 vertices, 4 edges>
  !gapprompt@gap>| !gapinput@IsSymmetricDigraph(S) and not IsMultiDigraph(S);|
  true
  !gapprompt@gap>| !gapinput@OutNeighbours(S);|
  [ [ 2 ], [ 1 ], [ 4 ], [ 3 ] ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@MaximalSymmetricSubdigraph(D);|
  <mutable empty digraph with 3 vertices>
  !gapprompt@gap>| !gapinput@D;|
  <mutable empty digraph with 3 vertices>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{MaximalAntiSymmetricSubdigraph}}
\logpage{[ 3, 3, 6 ]}\nobreak
\hyperdef{L}{X79BA6A66846D5A95}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{MaximalAntiSymmetricSubdigraph({\mdseries\slshape digraph})\index{MaximalAntiSymmetricSubdigraph@\texttt{MaximalAntiSymmetricSubdigraph}}
\label{MaximalAntiSymmetricSubdigraph}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{MaximalAntiSymmetricSubdigraphAttr({\mdseries\slshape digraph})\index{MaximalAntiSymmetricSubdigraphAttr@\texttt{MaximalAntiSymmetricSubdigraphAttr}}
\label{MaximalAntiSymmetricSubdigraphAttr}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph, then \texttt{MaximalAntiSymmetricSubdigraph} returns an anti\texttt{\symbol{45}}symmetric subdigraph of \mbox{\texttt{\mdseries\slshape digraph}} formed by retaining the vertices of \mbox{\texttt{\mdseries\slshape digraph}}, discarding any duplicate edges, and discarding any edge \texttt{[i,j]} of \mbox{\texttt{\mdseries\slshape digraph}} where \texttt{i {\textgreater} j} and the reverse edge \texttt{[j,i]} is an edge of \mbox{\texttt{\mdseries\slshape digraph}}. In other words, for every symmetric pair of edges \texttt{[i,j]} and \texttt{[j,i]} in \mbox{\texttt{\mdseries\slshape digraph}}, where \texttt{i} and \texttt{j} are distinct, it discards the edge $[\max(i,j),\min(i,j)]$. 

 If \mbox{\texttt{\mdseries\slshape digraph}} is immutable, then a new immutable digraph is returned. Otherwise, the mutable
digraph \mbox{\texttt{\mdseries\slshape digraph}} is changed in\texttt{\symbol{45}}place. 

 See \texttt{IsAntisymmetricDigraph} (\ref{IsAntisymmetricDigraph}) for more information. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[2, 2], [1, 3], [4], [3, 1]]);|
  <immutable multidigraph with 4 vertices, 7 edges>
  !gapprompt@gap>| !gapinput@not IsAntiSymmetricDigraph(D) and IsMultiDigraph(D);|
  true
  !gapprompt@gap>| !gapinput@OutNeighbours(D);|
  [ [ 2, 2 ], [ 1, 3 ], [ 4 ], [ 3, 1 ] ]
  !gapprompt@gap>| !gapinput@D := MaximalAntiSymmetricSubdigraph(D);|
  <immutable antisymmetric digraph with 4 vertices, 4 edges>
  !gapprompt@gap>| !gapinput@IsAntiSymmetricDigraph(D) and not IsMultiDigraph(D);|
  true
  !gapprompt@gap>| !gapinput@OutNeighbours(D);|
  [ [ 2 ], [ 3 ], [ 4 ], [ 1 ] ]
  !gapprompt@gap>| !gapinput@D := Digraph(IsMutableDigraph, [[2], [1]]);|
  <mutable digraph with 2 vertices, 2 edges>
  !gapprompt@gap>| !gapinput@MaximalAntiSymmetricSubdigraph(D);|
  <mutable digraph with 2 vertices, 1 edge>
  !gapprompt@gap>| !gapinput@D;|
  <mutable digraph with 2 vertices, 1 edge>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{UndirectedSpanningForest}}
\logpage{[ 3, 3, 7 ]}\nobreak
\hyperdef{L}{X7DD9766C86D3ED20}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{UndirectedSpanningForest({\mdseries\slshape digraph})\index{UndirectedSpanningForest@\texttt{UndirectedSpanningForest}}
\label{UndirectedSpanningForest}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{UndirectedSpanningForestAttr({\mdseries\slshape digraph})\index{UndirectedSpanningForestAttr@\texttt{UndirectedSpanningForestAttr}}
\label{UndirectedSpanningForestAttr}
}\hfill{\scriptsize (attribute)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{UndirectedSpanningTree({\mdseries\slshape digraph})\index{UndirectedSpanningTree@\texttt{UndirectedSpanningTree}}
\label{UndirectedSpanningTree}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{UndirectedSpanningTreeAttr({\mdseries\slshape digraph})\index{UndirectedSpanningTreeAttr@\texttt{UndirectedSpanningTreeAttr}}
\label{UndirectedSpanningTreeAttr}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A digraph, or \texttt{fail}.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph with at least one vertex, then \texttt{UndirectedSpanningForest} returns an undirected spanning forest of \mbox{\texttt{\mdseries\slshape digraph}}, otherwise this attribute returns \texttt{fail}. See \texttt{IsUndirectedSpanningForest} (\ref{IsUndirectedSpanningForest}) for the definition of an undirected spanning forest.

 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph with at least one vertex and whose \texttt{MaximalSymmetricSubdigraph} (\ref{MaximalSymmetricSubdigraph}) is connected (see \texttt{IsConnectedDigraph} (\ref{IsConnectedDigraph})), then \texttt{UndirectedSpanningTree} returns an undirected spanning tree of \mbox{\texttt{\mdseries\slshape digraph}}, otherwise this attribute returns \texttt{fail}. See \texttt{IsUndirectedSpanningTree} (\ref{IsUndirectedSpanningTree}) for the definition of an undirected spanning tree.

 If \mbox{\texttt{\mdseries\slshape digraph}} is immutable, then an immutable digraph is returned. Otherwise, the mutable
digraph \mbox{\texttt{\mdseries\slshape digraph}} is changed in\texttt{\symbol{45}}place into an undirected spanning tree of \mbox{\texttt{\mdseries\slshape digraph}}.

 Note that for an immutable digraph that has known undirected spanning tree,
the attribute \texttt{UndirectedSpanningTree} returns the same digraph as the attribute \texttt{UndirectedSpanningForest}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[1, 2, 1, 3], [1], [4], [3, 4, 3]]);|
  <immutable multidigraph with 4 vertices, 9 edges>
  !gapprompt@gap>| !gapinput@UndirectedSpanningTree(D);|
  fail
  !gapprompt@gap>| !gapinput@forest := UndirectedSpanningForest(D);|
  <immutable undirected forest with 4 vertices>
  !gapprompt@gap>| !gapinput@OutNeighbours(forest);|
  [ [ 2 ], [ 1 ], [ 4 ], [ 3 ] ]
  !gapprompt@gap>| !gapinput@IsUndirectedSpanningForest(D, forest);|
  true
  !gapprompt@gap>| !gapinput@DigraphConnectedComponents(forest).comps;|
  [ [ 1, 2 ], [ 3, 4 ] ]
  !gapprompt@gap>| !gapinput@DigraphConnectedComponents(MaximalSymmetricSubdigraph(D)).comps;|
  [ [ 1, 2 ], [ 3, 4 ] ]
  !gapprompt@gap>| !gapinput@UndirectedSpanningForest(MaximalSymmetricSubdigraph(D))|
  !gapprompt@>| !gapinput@= forest;|
  true
  !gapprompt@gap>| !gapinput@D := CompleteDigraph(4);|
  <immutable complete digraph with 4 vertices>
  !gapprompt@gap>| !gapinput@tree := UndirectedSpanningTree(D);|
  <immutable undirected tree with 4 vertices>
  !gapprompt@gap>| !gapinput@IsUndirectedSpanningTree(D, tree);|
  true
  !gapprompt@gap>| !gapinput@tree = UndirectedSpanningForest(D);|
  true
  !gapprompt@gap>| !gapinput@UndirectedSpanningForest(EmptyDigraph(0));|
  fail
  !gapprompt@gap>| !gapinput@D := PetersenGraph(IsMutableDigraph);|
  <mutable digraph with 10 vertices, 30 edges>
  !gapprompt@gap>| !gapinput@UndirectedSpanningTree(D);|
  <mutable digraph with 10 vertices, 18 edges>
  !gapprompt@gap>| !gapinput@D;|
  <mutable digraph with 10 vertices, 18 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphShortestPathSpanningTree}}
\logpage{[ 3, 3, 8 ]}\nobreak
\hyperdef{L}{X79C770918610AD97}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphShortestPathSpanningTree({\mdseries\slshape digraph, v})\index{DigraphShortestPathSpanningTree@\texttt{DigraphShortestPathSpanningTree}}
\label{DigraphShortestPathSpanningTree}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph, or \texttt{fail}.



 If \mbox{\texttt{\mdseries\slshape v}} is a vertex in \mbox{\texttt{\mdseries\slshape digraph}} and every other vertex of \mbox{\texttt{\mdseries\slshape digraph}} is reachable from \mbox{\texttt{\mdseries\slshape v}}, then this operation returns the shortest path spanning tree of \mbox{\texttt{\mdseries\slshape digraph}} rooted at \mbox{\texttt{\mdseries\slshape v}}. If there exist vertices in \mbox{\texttt{\mdseries\slshape digraph}} (other than \mbox{\texttt{\mdseries\slshape v}}) that are not reachable from \mbox{\texttt{\mdseries\slshape v}}, then \texttt{DigraphShortestPathSpanningTree} returns \texttt{fail}. Se\texttt{IsReachable} (\ref{IsReachable}). 

 The \emph{shortest path spanning tree of \mbox{\texttt{\mdseries\slshape digraph}} rooted at \mbox{\texttt{\mdseries\slshape v}}} is a subdigraph of \mbox{\texttt{\mdseries\slshape digraph}} that is a directed tree, with unique source vertex \mbox{\texttt{\mdseries\slshape v}}, and where for each other vertex \mbox{\texttt{\mdseries\slshape u}} in \mbox{\texttt{\mdseries\slshape digraph}}, the unique directed path from \mbox{\texttt{\mdseries\slshape v}} to \mbox{\texttt{\mdseries\slshape u}} in the tree is the lexicographically\texttt{\symbol{45}}least shortest
directed path from \mbox{\texttt{\mdseries\slshape v}} to \mbox{\texttt{\mdseries\slshape u}} in \mbox{\texttt{\mdseries\slshape digraph}}. 

 See \texttt{IsDirectedTree} (\ref{IsDirectedTree}), \texttt{DigraphSources} (\ref{DigraphSources}), and \texttt{DigraphShortestPath} (\ref{DigraphShortestPath}). 

 If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then \mbox{\texttt{\mdseries\slshape digraph}} is modified in place. If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the spanning tree is a new immutable digraph. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[1, 2], [3], [2, 4], [1], [2, 4]]);|
  <immutable digraph with 5 vertices, 8 edges>
  !gapprompt@gap>| !gapinput@ForAll([2 .. 5], v -> IsReachable(D, 1, v));|
  false
  !gapprompt@gap>| !gapinput@DigraphShortestPathSpanningTree(D, 1);|
  fail
  !gapprompt@gap>| !gapinput@tree := DigraphShortestPathSpanningTree(D, 5);|
  <immutable directed tree with 5 vertices>
  !gapprompt@gap>| !gapinput@OutNeighbours(tree);|
  [ [  ], [ 3 ], [  ], [ 1 ], [ 2, 4 ] ]
  !gapprompt@gap>| !gapinput@ForAll(DigraphVertices(D), v ->|
  !gapprompt@>| !gapinput@DigraphShortestPath(D, 5, v) = DigraphPath(tree, 5, v));|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{QuotientDigraph}}
\logpage{[ 3, 3, 9 ]}\nobreak
\hyperdef{L}{X7D1D26D27F5B56C2}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{QuotientDigraph({\mdseries\slshape digraph, p})\index{QuotientDigraph@\texttt{QuotientDigraph}}
\label{QuotientDigraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph, and \mbox{\texttt{\mdseries\slshape p}} is a partition of the vertices of \mbox{\texttt{\mdseries\slshape digraph}}, then this operation returns a digraph constructed by amalgamating all
vertices of \mbox{\texttt{\mdseries\slshape digraph}} which lie in the same part of \mbox{\texttt{\mdseries\slshape p}}. 

 A partition of the vertices of \mbox{\texttt{\mdseries\slshape digraph}} is a list of non\texttt{\symbol{45}}empty disjoint lists, such that the union
of all the sub\texttt{\symbol{45}}lists is equal to vertex set of \mbox{\texttt{\mdseries\slshape digraph}}. In particular, each vertex must appear in precisely one
sub\texttt{\symbol{45}}list. 

 The vertices of \mbox{\texttt{\mdseries\slshape digraph}} in part \texttt{i} of \mbox{\texttt{\mdseries\slshape p}} will become vertex \texttt{i} in the quotient, and there exists some edge in \mbox{\texttt{\mdseries\slshape digraph}} with source in part \texttt{i} and range in part \texttt{j} if and only if there is an edge from \texttt{i} to \texttt{j} in the quotient. In particular, this means that the quotient of a digraph has
no multiple edges. which was a change introduced in version 1.0.0 of the \textsf{Digraphs} package. 

 If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then \mbox{\texttt{\mdseries\slshape digraph}} is modified in place. If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), a new immutable digraph with the above properties is returned.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[2, 1], [4], [1], [1, 3, 4]]);|
  <immutable digraph with 4 vertices, 7 edges>
  !gapprompt@gap>| !gapinput@DigraphVertices(D);|
  [ 1 .. 4 ]
  !gapprompt@gap>| !gapinput@DigraphEdges(D);|
  [ [ 1, 2 ], [ 1, 1 ], [ 2, 4 ], [ 3, 1 ], [ 4, 1 ], [ 4, 3 ], 
    [ 4, 4 ] ]
  !gapprompt@gap>| !gapinput@p := [[1], [2, 4], [3]];|
  [ [ 1 ], [ 2, 4 ], [ 3 ] ]
  !gapprompt@gap>| !gapinput@quo := QuotientDigraph(D, p);|
  <immutable digraph with 3 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@DigraphVertices(quo);|
  [ 1 .. 3 ]
  !gapprompt@gap>| !gapinput@DigraphEdges(quo);|
  [ [ 1, 1 ], [ 1, 2 ], [ 2, 1 ], [ 2, 2 ], [ 2, 3 ], [ 3, 1 ] ]
  !gapprompt@gap>| !gapinput@QuotientDigraph(EmptyDigraph(0), []);|
  <immutable empty digraph with 0 vertices>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphReverse}}
\logpage{[ 3, 3, 10 ]}\nobreak
\hyperdef{L}{X78DECD26811EFD7C}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphReverse({\mdseries\slshape digraph})\index{DigraphReverse@\texttt{DigraphReverse}}
\label{DigraphReverse}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphReverseAttr({\mdseries\slshape digraph})\index{DigraphReverseAttr@\texttt{DigraphReverseAttr}}
\label{DigraphReverseAttr}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A digraph.



 The reverse of a digraph is the digraph formed by reversing the orientation of
each of its edges, i.e. for every edge \texttt{[i, j]} of a digraph, the reverse contains the corresponding edge \texttt{[j, i]}.

 \texttt{DigraphReverse} returns the reverse of the digraph \mbox{\texttt{\mdseries\slshape digraph}}. If \mbox{\texttt{\mdseries\slshape digraph}} is immutable, then a new immutable digraph is returned. Otherwise, the mutable
digraph \mbox{\texttt{\mdseries\slshape digraph}} is changed in\texttt{\symbol{45}}place into its reverse. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[3], [1, 3, 5], [1], [1, 2, 4], [2, 3, 5]]);|
  <immutable digraph with 5 vertices, 11 edges>
  !gapprompt@gap>| !gapinput@DigraphReverse(D);|
  <immutable digraph with 5 vertices, 11 edges>
  !gapprompt@gap>| !gapinput@OutNeighbours(last);|
  [ [ 2, 3, 4 ], [ 4, 5 ], [ 1, 2, 5 ], [ 4 ], [ 2, 5 ] ]
  !gapprompt@gap>| !gapinput@D := Digraph([[2, 4], [1], [4], [3, 4]]);|
  <immutable digraph with 4 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@DigraphEdges(D);|
  [ [ 1, 2 ], [ 1, 4 ], [ 2, 1 ], [ 3, 4 ], [ 4, 3 ], [ 4, 4 ] ]
  !gapprompt@gap>| !gapinput@DigraphEdges(DigraphReverse(D));|
  [ [ 1, 2 ], [ 2, 1 ], [ 3, 4 ], [ 4, 1 ], [ 4, 3 ], [ 4, 4 ] ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@OutNeighbours(D);|
  [ [ 2 ], [ 3 ], [ 1 ] ]
  !gapprompt@gap>| !gapinput@DigraphReverse(D);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@OutNeighbours(D);|
  [ [ 3 ], [ 1 ], [ 2 ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphDual}}
\logpage{[ 3, 3, 11 ]}\nobreak
\hyperdef{L}{X7F71D99D852B130F}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphDual({\mdseries\slshape digraph})\index{DigraphDual@\texttt{DigraphDual}}
\label{DigraphDual}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphDualAttr({\mdseries\slshape digraph})\index{DigraphDualAttr@\texttt{DigraphDualAttr}}
\label{DigraphDualAttr}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A digraph.



 The \emph{dual} of \mbox{\texttt{\mdseries\slshape digraph}} has the same vertices as \mbox{\texttt{\mdseries\slshape digraph}}, and there is an edge in the dual from \texttt{i} to \texttt{j} whenever there is no edge from \texttt{i} to \texttt{j} in \mbox{\texttt{\mdseries\slshape digraph}}. The \emph{dual} is sometimes called the \emph{complement}.

 \texttt{DigraphDual} returns the dual of the digraph \mbox{\texttt{\mdseries\slshape digraph}}. If \mbox{\texttt{\mdseries\slshape digraph}} is an immutable digraph, then a new immutable digraph is returned. Otherwise,
the mutable digraph \mbox{\texttt{\mdseries\slshape digraph}} is changed in\texttt{\symbol{45}}place into its dual. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[2, 3], [], [4, 6], [5], [],|
  !gapprompt@>| !gapinput@[7, 8, 9], [], [], []]);|
  <immutable digraph with 9 vertices, 8 edges>
  !gapprompt@gap>| !gapinput@DigraphDual(D);|
  <immutable digraph with 9 vertices, 73 edges>
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphDual(D);|
  <mutable digraph with 3 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@D;|
  <mutable digraph with 3 vertices, 6 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphSymmetricClosure}}
\logpage{[ 3, 3, 12 ]}\nobreak
\hyperdef{L}{X874883DD7DD450C4}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphSymmetricClosure({\mdseries\slshape digraph})\index{DigraphSymmetricClosure@\texttt{DigraphSymmetricClosure}}
\label{DigraphSymmetricClosure}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphSymmetricClosureAttr({\mdseries\slshape digraph})\index{DigraphSymmetricClosureAttr@\texttt{DigraphSymmetricClosureAttr}}
\label{DigraphSymmetricClosureAttr}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph, then this attribute gives the minimal symmetric digraph which
has the same vertices and contains all the edges of \mbox{\texttt{\mdseries\slshape digraph}}.

 A digraph is \emph{symmetric} if its adjacency matrix \texttt{AdjacencyMatrix} (\ref{AdjacencyMatrix}) is symmetric. For a digraph with multiple edges this means that there are the
same number of edges from a vertex \texttt{u} to a vertex \texttt{v} as there are from \texttt{v} to \texttt{u}; see \texttt{IsSymmetricDigraph} (\ref{IsSymmetricDigraph}).

 If \mbox{\texttt{\mdseries\slshape digraph}} is immutable, then a new immutable digraph is returned. Otherwise, the mutable
digraph \mbox{\texttt{\mdseries\slshape digraph}} is changed in\texttt{\symbol{45}}place into its symmetric closure. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[1, 2, 3], [2, 4], [1], [3, 4]]);|
  <immutable digraph with 4 vertices, 8 edges>
  !gapprompt@gap>| !gapinput@D := DigraphSymmetricClosure(D);|
  <immutable symmetric digraph with 4 vertices, 11 edges>
  !gapprompt@gap>| !gapinput@IsSymmetricDigraph(D);|
  true
  !gapprompt@gap>| !gapinput@List(OutNeighbours(D), AsSet);|
  [ [ 1, 2, 3 ], [ 1, 2, 4 ], [ 1, 4 ], [ 2, 3, 4 ] ]
  !gapprompt@gap>| !gapinput@D := Digraph([[2, 2], [1]]);|
  <immutable multidigraph with 2 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@D := DigraphSymmetricClosure(D);|
  <immutable symmetric multidigraph with 2 vertices, 4 edges>
  !gapprompt@gap>| !gapinput@OutNeighbours(D);|
  [ [ 2, 2 ], [ 1, 1 ] ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphSymmetricClosure(D);|
  <mutable digraph with 3 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@D;|
  <mutable digraph with 3 vertices, 6 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphTransitiveClosure}}
\logpage{[ 3, 3, 13 ]}\nobreak
\hyperdef{L}{X7A6C419080AD41DE}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphTransitiveClosure({\mdseries\slshape digraph})\index{DigraphTransitiveClosure@\texttt{DigraphTransitiveClosure}}
\label{DigraphTransitiveClosure}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphTransitiveClosureAttr({\mdseries\slshape digraph})\index{DigraphTransitiveClosureAttr@\texttt{DigraphTransitiveClosureAttr}}
\label{DigraphTransitiveClosureAttr}
}\hfill{\scriptsize (attribute)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphReflexiveTransitiveClosure({\mdseries\slshape digraph})\index{DigraphReflexiveTransitiveClosure@\texttt{DigraphReflexiveTransitiveClosure}}
\label{DigraphReflexiveTransitiveClosure}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphReflexiveTransitiveClosureAttr({\mdseries\slshape digraph})\index{DigraphReflexiveTransitiveClosureAttr@\texttt{Digraph}\-\texttt{Reflexive}\-\texttt{Transitive}\-\texttt{Closure}\-\texttt{Attr}}
\label{DigraphReflexiveTransitiveClosureAttr}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph with no multiple edges, then these attributes return the
(reflexive) transitive closure of \mbox{\texttt{\mdseries\slshape digraph}}.

 A digraph is \emph{reflexive} if it has a loop at every vertex, and it is \emph{transitive} if whenever \texttt{[i,j]} and \texttt{[j,k]} are edges of \mbox{\texttt{\mdseries\slshape digraph}}, \texttt{[i,k]} is also an edge. The \emph{(reflexive) transitive closure} of a digrap\mbox{\texttt{\mdseries\slshape digraph}} is the least (reflexive and) transitive digraph containing \mbox{\texttt{\mdseries\slshape digraph}}.

 If \mbox{\texttt{\mdseries\slshape digraph}} is immutable, then a new immutable digraph is returned. Otherwise, the mutable
digraph \mbox{\texttt{\mdseries\slshape digraph}} is changed in\texttt{\symbol{45}}place into its (reflexive) transitive
closure.

 Let $n$ be the number of vertices of \mbox{\texttt{\mdseries\slshape digraph}}, and let $m$ be the number of edges. For an arbitrary digraph, these attributes will use a
version of the Floyd\texttt{\symbol{45}}Warshall algorithm, with complexity $O(n^3)$. However, for a topologically sortable digraph [see \texttt{DigraphTopologicalSort} (\ref{DigraphTopologicalSort})], these attributes will use methods with complexity $O(m + n + m \cdot n)$ when this is faster.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := DigraphFromDiSparse6String(".H`eOWR`Ul^");|
  <immutable digraph with 9 vertices, 8 edges>
  !gapprompt@gap>| !gapinput@IsReflexiveDigraph(D) or IsTransitiveDigraph(D);|
  false
  !gapprompt@gap>| !gapinput@OutNeighbours(D);|
  [ [ 4, 6 ], [ 1, 3 ], [  ], [ 5 ], [  ], [ 7, 8, 9 ], [  ], [  ], 
    [  ] ]
  !gapprompt@gap>| !gapinput@T := DigraphTransitiveClosure(D);|
  <immutable transitive digraph with 9 vertices, 18 edges>
  !gapprompt@gap>| !gapinput@OutNeighbours(T);|
  [ [ 4, 6, 5, 7, 8, 9 ], [ 1, 3, 4, 5, 6, 7, 8, 9 ], [  ], [ 5 ], 
    [  ], [ 7, 8, 9 ], [  ], [  ], [  ] ]
  !gapprompt@gap>| !gapinput@RT := DigraphReflexiveTransitiveClosure(D);|
  <immutable preorder digraph with 9 vertices, 27 edges>
  !gapprompt@gap>| !gapinput@OutNeighbours(RT);|
  [ [ 4, 6, 5, 7, 8, 9, 1 ], [ 1, 3, 4, 5, 6, 7, 8, 9, 2 ], [ 3 ], 
    [ 5, 4 ], [ 5 ], [ 7, 8, 9, 6 ], [ 7 ], [ 8 ], [ 9 ] ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphReflexiveTransitiveClosure(D);|
  <mutable digraph with 3 vertices, 9 edges>
  !gapprompt@gap>| !gapinput@D;|
  <mutable digraph with 3 vertices, 9 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphTransitiveReduction}}
\logpage{[ 3, 3, 14 ]}\nobreak
\hyperdef{L}{X82AD17517E273600}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphTransitiveReduction({\mdseries\slshape digraph})\index{DigraphTransitiveReduction@\texttt{DigraphTransitiveReduction}}
\label{DigraphTransitiveReduction}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphTransitiveReductionAttr({\mdseries\slshape digraph})\index{DigraphTransitiveReductionAttr@\texttt{DigraphTransitiveReductionAttr}}
\label{DigraphTransitiveReductionAttr}
}\hfill{\scriptsize (attribute)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphReflexiveTransitiveReduction({\mdseries\slshape digraph})\index{DigraphReflexiveTransitiveReduction@\texttt{DigraphReflexiveTransitiveReduction}}
\label{DigraphReflexiveTransitiveReduction}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphReflexiveTransitiveReductionAttr({\mdseries\slshape digraph})\index{DigraphReflexiveTransitiveReductionAttr@\texttt{Digraph}\-\texttt{Reflexive}\-\texttt{Transitive}\-\texttt{Reduction}\-\texttt{Attr}}
\label{DigraphReflexiveTransitiveReductionAttr}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a topologically sortable digraph [see \texttt{DigraphTopologicalSort} (\ref{DigraphTopologicalSort})] with no multiple edges, then these operations return the (reflexive)
transitive reduction of \mbox{\texttt{\mdseries\slshape digraph}}.

 The (reflexive) transitive reduction of such a digraph is the unique least
subgraph such that the (reflexive) transitive closure of the subgraph is equal
to the (reflexive) transitive closure of \mbox{\texttt{\mdseries\slshape digraph}} [see \texttt{DigraphReflexiveTransitiveClosure} (\ref{DigraphReflexiveTransitiveClosure})]. In order words, it is the least subgraph of \mbox{\texttt{\mdseries\slshape digraph}} which retains the same reachability as \mbox{\texttt{\mdseries\slshape digraph}}.

 If \mbox{\texttt{\mdseries\slshape digraph}} is immutable, then a new immutable digraph is returned. Otherwise, the mutable
digraph \mbox{\texttt{\mdseries\slshape digraph}} is changed in\texttt{\symbol{45}}place into its (reflexive) transitive
reduction.

 Let $n$ be the number of vertices of an arbitrary digraph, and let $m$ be the number of edges. Then these operations use methods with complexity $O(m + n + m \cdot n)$. 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[1, 2, 3], [3], [3]]);;|
  !gapprompt@gap>| !gapinput@DigraphHasLoops(D);|
  true
  !gapprompt@gap>| !gapinput@D1 := DigraphReflexiveTransitiveReduction(D);|
  <immutable digraph with 3 vertices, 2 edges>
  !gapprompt@gap>| !gapinput@DigraphHasLoops(D1);|
  false
  !gapprompt@gap>| !gapinput@OutNeighbours(D1);|
  [ [ 2 ], [ 3 ], [  ] ]
  !gapprompt@gap>| !gapinput@D2 := DigraphTransitiveReduction(D);|
  <immutable digraph with 3 vertices, 4 edges>
  !gapprompt@gap>| !gapinput@DigraphHasLoops(D2);|
  true
  !gapprompt@gap>| !gapinput@OutNeighbours(D2);|
  [ [ 2, 1 ], [ 3 ], [ 3 ] ]
  !gapprompt@gap>| !gapinput@DigraphReflexiveTransitiveClosure(D)|
  !gapprompt@>| !gapinput@ = DigraphReflexiveTransitiveClosure(D1);|
  true
  !gapprompt@gap>| !gapinput@DigraphTransitiveClosure(D)|
  !gapprompt@>| !gapinput@ = DigraphTransitiveClosure(D2);|
  true
  !gapprompt@gap>| !gapinput@D := Digraph(IsMutableDigraph, [[1], [1], [1, 2, 3]]);|
  <mutable digraph with 3 vertices, 5 edges>
  !gapprompt@gap>| !gapinput@DigraphReflexiveTransitiveReduction(D);|
  <mutable digraph with 3 vertices, 2 edges>
  !gapprompt@gap>| !gapinput@D;|
  <mutable digraph with 3 vertices, 2 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphAddVertex}}
\logpage{[ 3, 3, 15 ]}\nobreak
\hyperdef{L}{X83B2506D79453208}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphAddVertex({\mdseries\slshape digraph[, label]})\index{DigraphAddVertex@\texttt{DigraphAddVertex}}
\label{DigraphAddVertex}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 The operation returns a digraph constructed from \mbox{\texttt{\mdseries\slshape digraph}} by adding a single new vertex, and no new edges. 

 If the optional second argument \mbox{\texttt{\mdseries\slshape label}} is a \textsf{GAP} object, then the new vertex will be labelled \mbox{\texttt{\mdseries\slshape label}}. 

 If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the vertex is added directly to \mbox{\texttt{\mdseries\slshape digraph}}. If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), an immutable copy of \mbox{\texttt{\mdseries\slshape digraph}} with the additional vertex is returned.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := CompleteDigraph(3);|
  <immutable complete digraph with 3 vertices>
  !gapprompt@gap>| !gapinput@new := DigraphAddVertex(D);|
  <immutable digraph with 4 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@D = new;|
  false
  !gapprompt@gap>| !gapinput@DigraphVertices(new);|
  [ 1 .. 4 ]
  !gapprompt@gap>| !gapinput@new := DigraphAddVertex(D, Group([(1, 2)]));|
  <immutable digraph with 4 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@DigraphVertexLabels(new);|
  [ 1, 2, 3, Group([ (1,2) ]) ]
  !gapprompt@gap>| !gapinput@D := CompleteBipartiteDigraph(IsMutableDigraph, 2, 3);|
  <mutable digraph with 5 vertices, 12 edges>
  !gapprompt@gap>| !gapinput@new := DigraphAddVertex(D);|
  <mutable digraph with 6 vertices, 12 edges>
  !gapprompt@gap>| !gapinput@D = new;|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphAddVertices (for a digraph and an integer)}}
\logpage{[ 3, 3, 16 ]}\nobreak
\hyperdef{L}{X8134BEE7786BD3A7}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphAddVertices({\mdseries\slshape digraph, m})\index{DigraphAddVertices@\texttt{DigraphAddVertices}!for a digraph and an integer}
\label{DigraphAddVertices:for a digraph and an integer}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphAddVertices({\mdseries\slshape digraph, labels})\index{DigraphAddVertices@\texttt{DigraphAddVertices}!for a digraph and a list of labels}
\label{DigraphAddVertices:for a digraph and a list of labels}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 For a non\texttt{\symbol{45}}negative integer \mbox{\texttt{\mdseries\slshape m}}, this operation returns a digraph constructed from \mbox{\texttt{\mdseries\slshape digraph}} by adding \mbox{\texttt{\mdseries\slshape m}} new vertices. 

 Otherwise, if \mbox{\texttt{\mdseries\slshape labels}} is a list consisting of \texttt{k} \textsf{GAP} objects, then this operation returns a digraph constructed from \mbox{\texttt{\mdseries\slshape digraph}} by adding \texttt{k} new vertices, which are labelled according to this list. 

 If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the vertices are added directly to \mbox{\texttt{\mdseries\slshape digraph}}, which is changed in\texttt{\symbol{45}}place. If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then \mbox{\texttt{\mdseries\slshape digraph}} itself is returned if no vertices are added (i.e. \texttt{\mbox{\texttt{\mdseries\slshape m}}=0} or \mbox{\texttt{\mdseries\slshape labels}} is empty), otherwise the result is a new immutable digraph. 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := CompleteDigraph(3);|
  <immutable complete digraph with 3 vertices>
  !gapprompt@gap>| !gapinput@new := DigraphAddVertices(D, 3);|
  <immutable digraph with 6 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@DigraphVertices(new);|
  [ 1 .. 6 ]
  !gapprompt@gap>| !gapinput@new := DigraphAddVertices(D, [Group([(1, 2)]), "d"]);|
  <immutable digraph with 5 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@DigraphVertexLabels(new);|
  [ 1, 2, 3, Group([ (1,2) ]), "d" ]
  !gapprompt@gap>| !gapinput@DigraphAddVertices(D, 0) = D;|
  true
  !gapprompt@gap>| !gapinput@D := CompleteBipartiteDigraph(IsMutableDigraph, 2, 3);|
  <mutable digraph with 5 vertices, 12 edges>
  !gapprompt@gap>| !gapinput@new := DigraphAddVertices(D, 4);|
  <mutable digraph with 9 vertices, 12 edges>
  !gapprompt@gap>| !gapinput@D = new;|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphAddEdge (for a digraph and an edge)}}
\logpage{[ 3, 3, 17 ]}\nobreak
\hyperdef{L}{X7E58CC4880627658}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphAddEdge({\mdseries\slshape digraph, edge})\index{DigraphAddEdge@\texttt{DigraphAddEdge}!for a digraph and an edge}
\label{DigraphAddEdge:for a digraph and an edge}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphAddEdge({\mdseries\slshape digraph, src, ran})\index{DigraphAddEdge@\texttt{DigraphAddEdge}!for a digraph, source, and range}
\label{DigraphAddEdge:for a digraph, source, and range}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape edge}} is a pair of vertices of \mbox{\texttt{\mdseries\slshape digraph}}, or \mbox{\texttt{\mdseries\slshape src}} and \mbox{\texttt{\mdseries\slshape ran}} are vertices of \mbox{\texttt{\mdseries\slshape digraph}}, then this operation returns a digraph constructed from \mbox{\texttt{\mdseries\slshape digraph}} by adding a new edge with source \mbox{\texttt{\mdseries\slshape edge}}\texttt{[1]} [\mbox{\texttt{\mdseries\slshape src}}] and range \mbox{\texttt{\mdseries\slshape edge}}\texttt{[2]} [\mbox{\texttt{\mdseries\slshape ran}}]. 

 If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the edge is added directly to \mbox{\texttt{\mdseries\slshape digraph}}. If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then an immutable copy of \mbox{\texttt{\mdseries\slshape digraph}} with the additional edge is returned. 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D1 := Digraph([[2], [3], []]);|
  <immutable digraph with 3 vertices, 2 edges>
  !gapprompt@gap>| !gapinput@DigraphEdges(D1);|
  [ [ 1, 2 ], [ 2, 3 ] ]
  !gapprompt@gap>| !gapinput@D2 := DigraphAddEdge(D1, [3, 1]);|
  <immutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphEdges(D2);|
  [ [ 1, 2 ], [ 2, 3 ], [ 3, 1 ] ]
  !gapprompt@gap>| !gapinput@D3 := DigraphAddEdge(D2, [2, 3]);|
  <immutable multidigraph with 3 vertices, 4 edges>
  !gapprompt@gap>| !gapinput@DigraphEdges(D3);|
  [ [ 1, 2 ], [ 2, 3 ], [ 2, 3 ], [ 3, 1 ] ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 4);|
  <mutable digraph with 4 vertices, 4 edges>
  !gapprompt@gap>| !gapinput@new := DigraphAddEdge(D, [1, 3]);|
  <mutable digraph with 4 vertices, 5 edges>
  !gapprompt@gap>| !gapinput@DigraphEdges(new);|
  [ [ 1, 2 ], [ 1, 3 ], [ 2, 3 ], [ 3, 4 ], [ 4, 1 ] ]
  !gapprompt@gap>| !gapinput@D = new;|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphAddEdgeOrbit}}
\logpage{[ 3, 3, 18 ]}\nobreak
\hyperdef{L}{X7BE5C7028760B053}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphAddEdgeOrbit({\mdseries\slshape digraph, edge})\index{DigraphAddEdgeOrbit@\texttt{DigraphAddEdgeOrbit}}
\label{DigraphAddEdgeOrbit}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
 A new digraph. 



 This operation returns a new digraph with the same vertices and edges as \mbox{\texttt{\mdseries\slshape digraph}} and with additional edges consisting of the orbit of the edge \mbox{\texttt{\mdseries\slshape edge}} under the action of the \texttt{DigraphGroup} (\ref{DigraphGroup}) of \mbox{\texttt{\mdseries\slshape digraph}}. If \mbox{\texttt{\mdseries\slshape edge}} is already an edge in \mbox{\texttt{\mdseries\slshape digraph}}, then \mbox{\texttt{\mdseries\slshape digraph}} is returned unchanged. The argument \mbox{\texttt{\mdseries\slshape digraph}} must be an immutable digraph. 

 An edge is simply a pair of vertices of \mbox{\texttt{\mdseries\slshape digraph}}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gr1 := CayleyDigraph(DihedralGroup(8));|
  <immutable digraph with 8 vertices, 24 edges>
  !gapprompt@gap>| !gapinput@gr2 := DigraphAddEdgeOrbit(gr1, [1, 8]);|
  <immutable digraph with 8 vertices, 32 edges>
  !gapprompt@gap>| !gapinput@DigraphEdges(gr1);|
  [ [ 1, 2 ], [ 1, 3 ], [ 1, 4 ], [ 2, 1 ], [ 2, 5 ], [ 2, 6 ], 
    [ 3, 8 ], [ 3, 4 ], [ 3, 7 ], [ 4, 6 ], [ 4, 7 ], [ 4, 1 ], 
    [ 5, 7 ], [ 5, 6 ], [ 5, 8 ], [ 6, 4 ], [ 6, 8 ], [ 6, 2 ], 
    [ 7, 5 ], [ 7, 1 ], [ 7, 3 ], [ 8, 3 ], [ 8, 2 ], [ 8, 5 ] ]
  !gapprompt@gap>| !gapinput@DigraphEdges(gr2);|
  [ [ 1, 2 ], [ 1, 3 ], [ 1, 4 ], [ 1, 8 ], [ 2, 1 ], [ 2, 5 ], 
    [ 2, 6 ], [ 2, 7 ], [ 3, 8 ], [ 3, 4 ], [ 3, 7 ], [ 3, 6 ], 
    [ 4, 6 ], [ 4, 7 ], [ 4, 1 ], [ 4, 5 ], [ 5, 7 ], [ 5, 6 ], 
    [ 5, 8 ], [ 5, 4 ], [ 6, 4 ], [ 6, 8 ], [ 6, 2 ], [ 6, 3 ], 
    [ 7, 5 ], [ 7, 1 ], [ 7, 3 ], [ 7, 2 ], [ 8, 3 ], [ 8, 2 ], 
    [ 8, 5 ], [ 8, 1 ] ]
  !gapprompt@gap>| !gapinput@gr3 := DigraphRemoveEdgeOrbit(gr2, [1, 8]);|
  <immutable digraph with 8 vertices, 24 edges>
  !gapprompt@gap>| !gapinput@gr3 = gr1;|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphAddEdges}}
\logpage{[ 3, 3, 19 ]}\nobreak
\hyperdef{L}{X8693A61B7F752C76}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphAddEdges({\mdseries\slshape digraph, edges})\index{DigraphAddEdges@\texttt{DigraphAddEdges}}
\label{DigraphAddEdges}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape edges}} is a (possibly empty) list of pairs of vertices o\mbox{\texttt{\mdseries\slshape digraph}}, then this operation returns a digraph constructed from \mbox{\texttt{\mdseries\slshape digraph}} by adding the edges specified by \mbox{\texttt{\mdseries\slshape edges}}. More precisely, for every \texttt{edge} in \mbox{\texttt{\mdseries\slshape edges}}, a new edge will be added with source \texttt{edge[1]} and range \texttt{edges[2]}. 

 If an edge is included in \mbox{\texttt{\mdseries\slshape edges}} with multiplicity \texttt{k}, then it will be added \texttt{k} times. If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the edges are added directly to \mbox{\texttt{\mdseries\slshape digraph}}. If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the result is returned as an immutable digraph. 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@func := function(n)|
  !gapprompt@>| !gapinput@ local source, range, i;|
  !gapprompt@>| !gapinput@ source := [];|
  !gapprompt@>| !gapinput@ range  := [];|
  !gapprompt@>| !gapinput@ for i in [1 .. n - 2] do|
  !gapprompt@>| !gapinput@   Add(source, i);|
  !gapprompt@>| !gapinput@   Add(range, i + 1);|
  !gapprompt@>| !gapinput@ od;|
  !gapprompt@>| !gapinput@ return Digraph(n, source, range);|
  !gapprompt@>| !gapinput@end;;|
  !gapprompt@gap>| !gapinput@D := func(1024);|
  <immutable digraph with 1024 vertices, 1022 edges>
  !gapprompt@gap>| !gapinput@new := DigraphAddEdges(D,|
  !gapprompt@>| !gapinput@[[1023, 1024], [1, 1024], [1023, 1024], [1024, 1]]);|
  <immutable multidigraph with 1024 vertices, 1026 edges>
  !gapprompt@gap>| !gapinput@D = new;|
  false
  !gapprompt@gap>| !gapinput@D2 := DigraphMutableCopy(func(1024));|
  <mutable digraph with 1024 vertices, 1022 edges>
  !gapprompt@gap>| !gapinput@new := DigraphAddEdges(D2,|
  !gapprompt@>| !gapinput@[[1023, 1024], [1, 1024], [1023, 1024], [1024, 1]]);|
  <mutable multidigraph with 1024 vertices, 1026 edges>
  !gapprompt@gap>| !gapinput@D2 = new;|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphRemoveVertex}}
\logpage{[ 3, 3, 20 ]}\nobreak
\hyperdef{L}{X7B634A2B83C08B16}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphRemoveVertex({\mdseries\slshape digraph, v})\index{DigraphRemoveVertex@\texttt{DigraphRemoveVertex}}
\label{DigraphRemoveVertex}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape v}} is a vertex of \mbox{\texttt{\mdseries\slshape digraph}}, then this operation returns a digraph constructed from \mbox{\texttt{\mdseries\slshape digraph}} by removing vertex \mbox{\texttt{\mdseries\slshape v}}, along with any edge whose source or range vertex is \mbox{\texttt{\mdseries\slshape v}}.

 If \mbox{\texttt{\mdseries\slshape digraph}} has \texttt{n} vertices, then the vertices of the returned digraph are \texttt{[1..n\texttt{\symbol{45}}1]}, but the original labels can be accessed via \texttt{DigraphVertexLabels} (\ref{DigraphVertexLabels}). 

 If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the vertex is removed directly from \mbox{\texttt{\mdseries\slshape digraph}}. If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), an immutable copy of \mbox{\texttt{\mdseries\slshape digraph}} without the vertex is returned.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph(["a""b""c"],|
  !gapprompt@>| !gapinput@                 ["a""a""b""c""c"],|
  !gapprompt@>| !gapinput@                 ["b""c""a""a""c"]);|
  <immutable digraph with 3 vertices, 5 edges>
  !gapprompt@gap>| !gapinput@DigraphVertexLabels(D);|
  [ "a""b""c" ]
  !gapprompt@gap>| !gapinput@DigraphEdges(D);|
  [ [ 1, 2 ], [ 1, 3 ], [ 2, 1 ], [ 3, 1 ], [ 3, 3 ] ]
  !gapprompt@gap>| !gapinput@new := DigraphRemoveVertex(D, 2);|
  <immutable digraph with 2 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphVertexLabels(new);|
  [ "a""c" ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 5);|
  <mutable digraph with 5 vertices, 5 edges>
  !gapprompt@gap>| !gapinput@new := DigraphRemoveVertex(D, 1);|
  <mutable digraph with 4 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphVertexLabels(D);|
  [ 2, 3, 4, 5 ]
  !gapprompt@gap>| !gapinput@D = new;|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphRemoveVertices}}
\logpage{[ 3, 3, 21 ]}\nobreak
\hyperdef{L}{X7E290E847A5A299A}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphRemoveVertices({\mdseries\slshape digraph, verts})\index{DigraphRemoveVertices@\texttt{DigraphRemoveVertices}}
\label{DigraphRemoveVertices}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape verts}} is a (possibly empty) duplicate\texttt{\symbol{45}}free list of vertices of \mbox{\texttt{\mdseries\slshape digraph}}, then this operation returns a digraph constructed from \mbox{\texttt{\mdseries\slshape digraph}} by removing every vertex in \mbox{\texttt{\mdseries\slshape verts}}, along with any edge whose source or range vertex is in \mbox{\texttt{\mdseries\slshape verts}}.

 If \mbox{\texttt{\mdseries\slshape digraph}} has \texttt{n} vertices, then the vertices of the new digraph are \texttt{[1 .. n\texttt{\symbol{45}}Length(\mbox{\texttt{\mdseries\slshape verts}})]}, but the original labels can be accessed via \texttt{DigraphVertexLabels} (\ref{DigraphVertexLabels}). 

 If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the vertices are removed directly from \mbox{\texttt{\mdseries\slshape digraph}}. If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), an immutable copy of \mbox{\texttt{\mdseries\slshape digraph}} without the vertices is returned.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[3], [1, 3, 5], [1], [1, 2, 4], [2, 3, 5]]);|
  <immutable digraph with 5 vertices, 11 edges>
  !gapprompt@gap>| !gapinput@SetDigraphVertexLabels(D, ["a""b""c""d""e"]);|
  !gapprompt@gap>| !gapinput@new := DigraphRemoveVertices(D, [2, 4]);|
  <immutable digraph with 3 vertices, 4 edges>
  !gapprompt@gap>| !gapinput@DigraphVertexLabels(new);|
  [ "a""c""e" ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 5);|
  <mutable digraph with 5 vertices, 5 edges>
  !gapprompt@gap>| !gapinput@new := DigraphRemoveVertices(D, [1, 3]);|
  <mutable digraph with 3 vertices, 1 edge>
  !gapprompt@gap>| !gapinput@DigraphVertexLabels(D);|
  [ 2, 4, 5 ]
  !gapprompt@gap>| !gapinput@D = new;|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphRemoveEdge (for a digraph and an edge)}}
\logpage{[ 3, 3, 22 ]}\nobreak
\hyperdef{L}{X8433E3BC7E5EA6BF}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphRemoveEdge({\mdseries\slshape digraph, edge})\index{DigraphRemoveEdge@\texttt{DigraphRemoveEdge}!for a digraph and an edge}
\label{DigraphRemoveEdge:for a digraph and an edge}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphRemoveEdge({\mdseries\slshape digraph, src, ran})\index{DigraphRemoveEdge@\texttt{DigraphRemoveEdge}!for a digraph, source, and range}
\label{DigraphRemoveEdge:for a digraph, source, and range}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph with no multiple edges and \mbox{\texttt{\mdseries\slshape edge}} is a pair of vertices of \mbox{\texttt{\mdseries\slshape digraph}}, or \mbox{\texttt{\mdseries\slshape src}} and \mbox{\texttt{\mdseries\slshape ran}} are vertices of \mbox{\texttt{\mdseries\slshape digraph}}, then this operation returns a digraph constructed from \mbox{\texttt{\mdseries\slshape digraph}} by removing the edge specified by \mbox{\texttt{\mdseries\slshape edge}} or \mbox{\texttt{\mdseries\slshape [src, ran]}}. 

 If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the edge is removed directly from \mbox{\texttt{\mdseries\slshape digraph}}. If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), an immutable copy of \mbox{\texttt{\mdseries\slshape digraph}} without the edge is returned. 

 Note that if \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then a new copy of \mbox{\texttt{\mdseries\slshape digraph}} will be returned even if \mbox{\texttt{\mdseries\slshape edge}} or \mbox{\texttt{\mdseries\slshape [src, ran]}} does not define an edge of \mbox{\texttt{\mdseries\slshape digraph}}.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(250000);|
  <immutable cycle digraph with 250000 vertices>
  !gapprompt@gap>| !gapinput@D := DigraphRemoveEdge(D, [250000, 1]);|
  <immutable digraph with 250000 vertices, 249999 edges>
  !gapprompt@gap>| !gapinput@new := DigraphRemoveEdge(D, [25000, 2]);;|
  !gapprompt@gap>| !gapinput@new = D;|
  true
  !gapprompt@gap>| !gapinput@IsIdenticalObj(new, D);|
  false
  !gapprompt@gap>| !gapinput@D := DigraphMutableCopy(D);;|
  !gapprompt@gap>| !gapinput@new := DigraphRemoveEdge(D, 2500, 2);;|
  !gapprompt@gap>| !gapinput@IsIdenticalObj(new, D);|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphRemoveEdgeOrbit}}
\logpage{[ 3, 3, 23 ]}\nobreak
\hyperdef{L}{X85981D9187F49018}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphRemoveEdgeOrbit({\mdseries\slshape digraph, edge})\index{DigraphRemoveEdgeOrbit@\texttt{DigraphRemoveEdgeOrbit}}
\label{DigraphRemoveEdgeOrbit}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
 A new digraph. 



 This operation returns a new digraph with the same vertices as \mbox{\texttt{\mdseries\slshape digraph}} and with the orbit of the edge \mbox{\texttt{\mdseries\slshape edge}} (under the action of the \texttt{DigraphGroup} (\ref{DigraphGroup}) of \mbox{\texttt{\mdseries\slshape digraph}}) removed. If \mbox{\texttt{\mdseries\slshape edge}} is not an edge in \mbox{\texttt{\mdseries\slshape digraph}}, then \mbox{\texttt{\mdseries\slshape digraph}} is returned unchanged. The argument \mbox{\texttt{\mdseries\slshape digraph}} must be an immutable digraph. 

 An edge is simply a pair of vertices of \mbox{\texttt{\mdseries\slshape digraph}}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gr1 := CayleyDigraph(DihedralGroup(8));|
  <immutable digraph with 8 vertices, 24 edges>
  !gapprompt@gap>| !gapinput@gr2 := DigraphAddEdgeOrbit(gr1, [1, 8]);|
  <immutable digraph with 8 vertices, 32 edges>
  !gapprompt@gap>| !gapinput@DigraphEdges(gr1);|
  [ [ 1, 2 ], [ 1, 3 ], [ 1, 4 ], [ 2, 1 ], [ 2, 5 ], [ 2, 6 ], 
    [ 3, 8 ], [ 3, 4 ], [ 3, 7 ], [ 4, 6 ], [ 4, 7 ], [ 4, 1 ], 
    [ 5, 7 ], [ 5, 6 ], [ 5, 8 ], [ 6, 4 ], [ 6, 8 ], [ 6, 2 ], 
    [ 7, 5 ], [ 7, 1 ], [ 7, 3 ], [ 8, 3 ], [ 8, 2 ], [ 8, 5 ] ]
  !gapprompt@gap>| !gapinput@DigraphEdges(gr2);|
  [ [ 1, 2 ], [ 1, 3 ], [ 1, 4 ], [ 1, 8 ], [ 2, 1 ], [ 2, 5 ], 
    [ 2, 6 ], [ 2, 7 ], [ 3, 8 ], [ 3, 4 ], [ 3, 7 ], [ 3, 6 ], 
    [ 4, 6 ], [ 4, 7 ], [ 4, 1 ], [ 4, 5 ], [ 5, 7 ], [ 5, 6 ], 
    [ 5, 8 ], [ 5, 4 ], [ 6, 4 ], [ 6, 8 ], [ 6, 2 ], [ 6, 3 ], 
    [ 7, 5 ], [ 7, 1 ], [ 7, 3 ], [ 7, 2 ], [ 8, 3 ], [ 8, 2 ], 
    [ 8, 5 ], [ 8, 1 ] ]
  !gapprompt@gap>| !gapinput@gr3 := DigraphRemoveEdgeOrbit(gr2, [1, 8]);|
  <immutable digraph with 8 vertices, 24 edges>
  !gapprompt@gap>| !gapinput@gr3 = gr1;|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphRemoveEdges}}
\logpage{[ 3, 3, 24 ]}\nobreak
\hyperdef{L}{X87093FDA7F88E732}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphRemoveEdges({\mdseries\slshape digraph, edges})\index{DigraphRemoveEdges@\texttt{DigraphRemoveEdges}}
\label{DigraphRemoveEdges}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If one of the following holds: 
\begin{itemize}
\item  \mbox{\texttt{\mdseries\slshape digraph}} is a digraph with no multiple edges, and \mbox{\texttt{\mdseries\slshape edges}} is a list of pairs of vertices of \mbox{\texttt{\mdseries\slshape digraph}}, or 
\item  \mbox{\texttt{\mdseries\slshape digraph}} is a digraph and \mbox{\texttt{\mdseries\slshape edges}} is an empty list 
\end{itemize}
 then this operation returns a digraph constructed from \mbox{\texttt{\mdseries\slshape digraph}} by removing all of the edges specified by \mbox{\texttt{\mdseries\slshape edges}} (see \texttt{DigraphRemoveEdge} (\ref{DigraphRemoveEdge:for a digraph and an edge})). 

 If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the edge is removed directly from \mbox{\texttt{\mdseries\slshape digraph}}. If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), the edge is removed from an immutable copy of \mbox{\texttt{\mdseries\slshape digraph}} and this new digraph is returned.

 Note that if \mbox{\texttt{\mdseries\slshape edges}} is empty, then this operation will always return \mbox{\texttt{\mdseries\slshape digraph}} rather than a copy. Also, if any element of \mbox{\texttt{\mdseries\slshape edges}} is invalid (i.e. does not define an edge of \mbox{\texttt{\mdseries\slshape digraph}}) then that element will simply be ignored. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(250000);|
  <immutable cycle digraph with 250000 vertices>
  !gapprompt@gap>| !gapinput@D := DigraphRemoveEdges(D, [[250000, 1]]);|
  <immutable digraph with 250000 vertices, 249999 edges>
  !gapprompt@gap>| !gapinput@D := DigraphMutableCopy(D);|
  <mutable digraph with 250000 vertices, 249999 edges>
  !gapprompt@gap>| !gapinput@new := DigraphRemoveEdges(D, [[1, 2], [2, 3], [3, 100]]);|
  <mutable digraph with 250000 vertices, 249997 edges>
  !gapprompt@gap>| !gapinput@new = D;|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphRemoveLoops}}
\logpage{[ 3, 3, 25 ]}\nobreak
\hyperdef{L}{X79324AF7818C0C02}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphRemoveLoops({\mdseries\slshape digraph})\index{DigraphRemoveLoops@\texttt{DigraphRemoveLoops}}
\label{DigraphRemoveLoops}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphRemoveLoopsAttr({\mdseries\slshape digraph})\index{DigraphRemoveLoopsAttr@\texttt{DigraphRemoveLoopsAttr}}
\label{DigraphRemoveLoopsAttr}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph, then this operation returns a digraph constructed from \mbox{\texttt{\mdseries\slshape digraph}} by removing every loop. A loop is an edge with equal source and range.

 If \mbox{\texttt{\mdseries\slshape digraph}} is immutable, then a new immutable digraph is returned. Otherwise, the loops
are removed from the mutable digraph \mbox{\texttt{\mdseries\slshape digraph}} in\texttt{\symbol{45}}place. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[1, 2, 4], [1, 4], [3, 4], [1, 4, 5], [1, 5]]);|
  <immutable digraph with 5 vertices, 12 edges>
  !gapprompt@gap>| !gapinput@DigraphRemoveLoops(D);|
  <immutable digraph with 5 vertices, 8 edges>
  !gapprompt@gap>| !gapinput@D := Digraph(IsMutableDigraph, [[1, 2], [1]]);|
  <mutable digraph with 2 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphRemoveLoops(D);|
  <mutable digraph with 2 vertices, 2 edges>
  !gapprompt@gap>| !gapinput@D;|
  <mutable digraph with 2 vertices, 2 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphRemoveAllMultipleEdges}}
\logpage{[ 3, 3, 26 ]}\nobreak
\hyperdef{L}{X7DCCD0247897A3DE}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphRemoveAllMultipleEdges({\mdseries\slshape digraph})\index{DigraphRemoveAllMultipleEdges@\texttt{DigraphRemoveAllMultipleEdges}}
\label{DigraphRemoveAllMultipleEdges}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphRemoveAllMultipleEdgesAttr({\mdseries\slshape digraph})\index{DigraphRemoveAllMultipleEdgesAttr@\texttt{DigraphRemoveAllMultipleEdgesAttr}}
\label{DigraphRemoveAllMultipleEdgesAttr}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph, then this operation returns a digraph constructed from \mbox{\texttt{\mdseries\slshape digraph}} by removing all multiple edges. The result is the largest subdigraph of \mbox{\texttt{\mdseries\slshape digraph}} which does not contain multiple edges.

 If \mbox{\texttt{\mdseries\slshape digraph}} is immutable, then a new immutable digraph is returned. Otherwise, the
multiple edges of the mutable digraph \mbox{\texttt{\mdseries\slshape digraph}} are removed in\texttt{\symbol{45}}place. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D1 := Digraph([[1, 2, 3, 2], [1, 1, 3], [2, 2, 2]]);|
  <immutable multidigraph with 3 vertices, 10 edges>
  !gapprompt@gap>| !gapinput@D2 := DigraphRemoveAllMultipleEdges(D1);|
  <immutable digraph with 3 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@OutNeighbours(D2);|
  [ [ 1, 2, 3 ], [ 1, 3 ], [ 2 ] ]
  !gapprompt@gap>| !gapinput@D := Digraph(IsMutableDigraph, [[2, 2], [1]]);|
  <mutable multidigraph with 2 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphRemoveAllMultipleEdges(D);|
  <mutable digraph with 2 vertices, 2 edges>
  !gapprompt@gap>| !gapinput@D;|
  <mutable digraph with 2 vertices, 2 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphContractEdge (for a digraph and a list of positive integers)}}
\logpage{[ 3, 3, 27 ]}\nobreak
\hyperdef{L}{X792AD1147E2BFCB7}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphContractEdge({\mdseries\slshape digraph, edge})\index{DigraphContractEdge@\texttt{DigraphContractEdge}!for a digraph and a list of positive integers}
\label{DigraphContractEdge:for a digraph and a list of positive integers}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphContractEdge({\mdseries\slshape digraph, src, ran})\index{DigraphContractEdge@\texttt{DigraphContractEdge}!for a digraph and two positive integers}
\label{DigraphContractEdge:for a digraph and two positive integers}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape edge}} is a pair of vertices of \mbox{\texttt{\mdseries\slshape digraph}}, or \mbox{\texttt{\mdseries\slshape src}} and \mbox{\texttt{\mdseries\slshape ran}} are vertices of \mbox{\texttt{\mdseries\slshape digraph}}, where \mbox{\texttt{\mdseries\slshape ran}} {\textless}{\textgreater\mbox{\texttt{\mdseries\slshape src}}, then then this operation merges the two vertices of the edge given into one.
Edges incident to \mbox{\texttt{\mdseries\slshape src}} and \mbox{\texttt{\mdseries\slshape ran}} will now be incident to \texttt{v}, the new vertex, with their direction preserved. 

 A new digraph constructed from \mbox{\texttt{\mdseries\slshape digraph}} is returned, unless \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}); in this case changes are made directly to \mbox{\texttt{\mdseries\slshape digraph}}, which is then returned. The \mbox{\texttt{\mdseries\slshape digraph}} must not belong to \texttt{IsMultiDigraph} (\ref{IsMultiDigraph}). 

 The labels of any remaining edges will be preserved. 

 Assigned vertex labels for \mbox{\texttt{\mdseries\slshape src}} and \mbox{\texttt{\mdseries\slshape ran}} are combined into a list, and assigned to the new vertex \texttt{v}. 

 If an edge \mbox{\texttt{\mdseries\slshape [src, src]}} or \mbox{\texttt{\mdseries\slshape [ran, ran]}} exists, a singular edge \texttt{[v, v]} is created. If edge \mbox{\texttt{\mdseries\slshape [ran, src]}} exists, this is also removed. 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := DigraphByEdges([[1, 2], [2, 1]]);|
  <immutable digraph with 2 vertices, 2 edges>
  !gapprompt@gap>| !gapinput@D2 := DigraphContractEdge(D, 1, 2);|
  <immutable empty digraph with 1 vertex>
  !gapprompt@gap>| !gapinput@DigraphEdges(D2);|
  [  ]
  !gapprompt@gap>| !gapinput@D := DigraphByEdges(IsMutableDigraph, [[1, 2], [2, 3], [3, 4]]);|
  <mutable digraph with 4 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphVertexLabels(D);;  # setting vertex labels|
  !gapprompt@gap>| !gapinput@DigraphContractEdge(D, [2, 3]);|
  <mutable digraph with 3 vertices, 2 edges>
  !gapprompt@gap>| !gapinput@DigraphEdges(D);|
  [ [ 1, 3 ], [ 3, 2 ] ]
  !gapprompt@gap>| !gapinput@DigraphVertexLabels(D);|
  [ 1, 4, [ 2, 3 ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphReverseEdges (for a digraph and a list of edges)}}
\logpage{[ 3, 3, 28 ]}\nobreak
\hyperdef{L}{X7821753D85402A8C}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphReverseEdges({\mdseries\slshape digraph, edges})\index{DigraphReverseEdges@\texttt{DigraphReverseEdges}!for a digraph and a list of edges}
\label{DigraphReverseEdges:for a digraph and a list of edges}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphReverseEdge({\mdseries\slshape digraph, edge})\index{DigraphReverseEdge@\texttt{DigraphReverseEdge}!for a digraph and an edge}
\label{DigraphReverseEdge:for a digraph and an edge}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphReverseEdge({\mdseries\slshape digraph, src, ran})\index{DigraphReverseEdge@\texttt{DigraphReverseEdge}!for a digraph, source, and range}
\label{DigraphReverseEdge:for a digraph, source, and range}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph without multiple edges, and \mbox{\texttt{\mdseries\slshape edges}} is a list of pairs of vertices of \mbox{\texttt{\mdseries\slshape digraph}} (the entries of each pair corresponding to the source and the range of an
edge, respectively), then \texttt{DigraphReverseEdges} returns a digraph constructed fro\mbox{\texttt{\mdseries\slshape digraph}} by reversing the orientation of every edge specified by \mbox{\texttt{\mdseries\slshape edges}}. If only one edge is to be reversed, then \texttt{DigraphReverseEdge} can be used instead. In this case, the second argument should just be a single
vertex\texttt{\symbol{45}}pair, or the second and third arguments should be
the source and range of an edge respectively. 

 Note that even though \mbox{\texttt{\mdseries\slshape digraph}} cannot have multiple edges, the output may have multiple edges. 

 If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the edges are reversed in \mbox{\texttt{\mdseries\slshape digraph}}. If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), an immutable copy of \mbox{\texttt{\mdseries\slshape digraph}} with the specified edges reversed is returned.

 
\begin{Verbatim}[commandchars=!|A,fontsize=\small,frame=single,label=Example]
  !gapprompt|gap>A !gapinput|D := DigraphFromDiSparse6String(".Tg?i@s?t_e?_qEsC");A
  <immutable digraph with 21 vertices, 8 edges>
  !gapprompt|gap>A !gapinput|DigraphEdges(D);A
  [ [ 1, 2 ], [ 1, 7 ], [ 1, 8 ], [ 5, 21 ], [ 7, 19 ], [ 9, 1 ], 
    [ 11, 2 ], [ 21, 1 ] ]
  !gapprompt|gap>A !gapinput|new := DigraphReverseEdge(D, [7, 19]);A
  <immutable digraph with 21 vertices, 8 edges>
  !gapprompt|gap>A !gapinput|DigraphEdges(new);A
  [ [ 1, 2 ], [ 1, 7 ], [ 1, 8 ], [ 5, 21 ], [ 9, 1 ], [ 11, 2 ], 
    [ 19, 7 ], [ 21, 1 ] ]
  !gapprompt|gap>A !gapinput|D2 := DigraphMutableCopy(new);;A
  !gapprompt|gap>A !gapinput|new := DigraphReverseEdges(D2, [[19, 7]]);;A
  !gapprompt|gap>A !gapinput|D2 = new;A
  true
  !gapprompt|gap>A !gapinput|D = new;A
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphDisjointUnion (for an
    arbitrary number of digraphs)}}
\logpage{[ 3, 3, 29 ]}\nobreak
\hyperdef{L}{X814F1DFC83DB273F}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphDisjointUnion({\mdseries\slshape D1, D2, ...})\index{DigraphDisjointUnion@\texttt{DigraphDisjointUnion}!for an
    arbitrary number of digraphs}
\label{DigraphDisjointUnion:for an
    arbitrary number of digraphs}
}\hfill{\scriptsize (function)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphDisjointUnion({\mdseries\slshape list})\index{DigraphDisjointUnion@\texttt{DigraphDisjointUnion}!for a list of digraphs}
\label{DigraphDisjointUnion:for a list of digraphs}
}\hfill{\scriptsize (function)}}\\
\textbf{\indent Returns:}
A digraph.



 In the first form, if \mbox{\texttt{\mdseries\slshape D1}}, \mbox{\texttt{\mdseries\slshape D2}}, etc. are digraphs, then \texttt{DigraphDisjointUnion} returns their disjoint union. In the second form, if \mbox{\texttt{\mdseries\slshape list}} is a non\texttt{\symbol{45}}empty list of digraphs, then \texttt{DigraphDisjointUnion} returns the disjoint union of the digraphs contained in the list. 

 For a disjoint union of digraphs, the vertex set is the disjoint union of the
vertex sets, and the edge list is the disjoint union of the edge lists. 

 More specifically, for a collection of digraphs \mbox{\texttt{\mdseries\slshape D1}}, \mbox{\texttt{\mdseries\slshape D2}}, \texttt{...}, the disjoint union with have \texttt{DigraphNrVertices(}\mbox{\texttt{\mdseries\slshape D1}}\texttt{)} \texttt{+} \texttt{DigraphNrVertices(}\mbox{\texttt{\mdseries\slshape D2}}\texttt{)} \texttt{+} \texttt{...} vertices. The edges of \mbox{\texttt{\mdseries\slshape D1}} will remain unchanged, whilst the edges of the \texttt{i}th digraph, \mbox{\texttt{\mdseries\slshape D}}\texttt{[i]}, will be changed so that they belong to the vertices of the disjoint union
corresponding to \mbox{\texttt{\mdseries\slshape D}}\texttt{[i]}. In particular, the edges of \mbox{\texttt{\mdseries\slshape D}}\texttt{[i]} will have their source and range increased by \texttt{DigraphNrVertices(}\mbox{\texttt{\mdseries\slshape D1}}\texttt{)} \texttt{+} \texttt{...} \texttt{+} \texttt{DigraphNrVertices(}\mbox{\texttt{\mdseries\slshape D}}\texttt{[i\texttt{\symbol{45}}1])}. 

 Note that previously set \texttt{DigraphVertexLabels} (\ref{DigraphVertexLabels}) will be lost.

 If the first digraph \mbox{\texttt{\mdseries\slshape D1}} [\mbox{\texttt{\mdseries\slshape list[1]}}] belongs to \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then \mbox{\texttt{\mdseries\slshape D1}} [\mbox{\texttt{\mdseries\slshape list[1]}}] is modified in place to contain the appropriate vertices and edges. If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), a new immutable digraph containing the appropriate vertices and edges is
returned. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D1 := CycleDigraph(3);|
  <immutable cycle digraph with 3 vertices>
  !gapprompt@gap>| !gapinput@OutNeighbours(D1);|
  [ [ 2 ], [ 3 ], [ 1 ] ]
  !gapprompt@gap>| !gapinput@D2 := CompleteDigraph(3);|
  <immutable complete digraph with 3 vertices>
  !gapprompt@gap>| !gapinput@OutNeighbours(D2);|
  [ [ 2, 3 ], [ 1, 3 ], [ 1, 2 ] ]
  !gapprompt@gap>| !gapinput@union := DigraphDisjointUnion(D1, D2);|
  <immutable digraph with 6 vertices, 9 edges>
  !gapprompt@gap>| !gapinput@OutNeighbours(union);|
  [ [ 2 ], [ 3 ], [ 1 ], [ 5, 6 ], [ 4, 6 ], [ 4, 5 ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphEdgeUnion (for a positive number of digraphs)}}
\logpage{[ 3, 3, 30 ]}\nobreak
\hyperdef{L}{X7DA997697D310E44}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphEdgeUnion({\mdseries\slshape D1, D2, ...})\index{DigraphEdgeUnion@\texttt{DigraphEdgeUnion}!for a positive number of digraphs}
\label{DigraphEdgeUnion:for a positive number of digraphs}
}\hfill{\scriptsize (function)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphEdgeUnion({\mdseries\slshape list})\index{DigraphEdgeUnion@\texttt{DigraphEdgeUnion}!for a list of digraphs}
\label{DigraphEdgeUnion:for a list of digraphs}
}\hfill{\scriptsize (function)}}\\
\textbf{\indent Returns:}
A digraph.



 In the first form, if \mbox{\texttt{\mdseries\slshape D1}}, \mbox{\texttt{\mdseries\slshape D2}}, etc. are digraphs, then \texttt{DigraphEdgeUnion} returns their edge union. In the second form, if \mbox{\texttt{\mdseries\slshape list}} is a non\texttt{\symbol{45}}empty list of digraphs, then \texttt{DigraphEdgeUnion} returns the edge union of the digraphs contained in the list. 

 The vertex set of the edge union of a collection of digraphs is the \emph{union} of the vertex sets, whilst the edge list of the edge union is the \emph{concatenation} of the edge lists. The number of vertices of the edge union is equal to the \emph{maximum} number of vertices of one of the digraphs, whilst the number of edges of the
edge union will equal the \emph{sum} of the number of edges of each digraph. 

 Note that previously set \texttt{DigraphVertexLabels} (\ref{DigraphVertexLabels}) will be lost. 

 If the first digraph \mbox{\texttt{\mdseries\slshape D1}} [\mbox{\texttt{\mdseries\slshape list[1]}}] belongs to \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then \mbox{\texttt{\mdseries\slshape D1}} [\mbox{\texttt{\mdseries\slshape list[1]}}] is modified in place to contain the appropriate vertices and edges. If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), a new immutable digraph containing the appropriate vertices and edges is
returned. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(10);|
  <immutable cycle digraph with 10 vertices>
  !gapprompt@gap>| !gapinput@DigraphEdgeUnion(D, D);|
  <immutable multidigraph with 10 vertices, 20 edges>
  !gapprompt@gap>| !gapinput@D1 := Digraph([[2], [1]]);|
  <immutable digraph with 2 vertices, 2 edges>
  !gapprompt@gap>| !gapinput@D2 := Digraph([[2, 3], [2], [1]]);|
  <immutable digraph with 3 vertices, 4 edges>
  !gapprompt@gap>| !gapinput@union := DigraphEdgeUnion(D1, D2);|
  <immutable multidigraph with 3 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@OutNeighbours(union);|
  [ [ 2, 2, 3 ], [ 1, 2 ], [ 1 ] ]
  !gapprompt@gap>| !gapinput@union = DigraphByEdges(|
  !gapprompt@>| !gapinput@Concatenation(DigraphEdges(D1), DigraphEdges(D2)));|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphJoin (for a positive number of digraphs)}}
\logpage{[ 3, 3, 31 ]}\nobreak
\hyperdef{L}{X7DDFC759860E3390}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphJoin({\mdseries\slshape D1, D2, ...})\index{DigraphJoin@\texttt{DigraphJoin}!for a positive number of digraphs}
\label{DigraphJoin:for a positive number of digraphs}
}\hfill{\scriptsize (function)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphJoin({\mdseries\slshape list})\index{DigraphJoin@\texttt{DigraphJoin}!for a list of digraphs}
\label{DigraphJoin:for a list of digraphs}
}\hfill{\scriptsize (function)}}\\
\textbf{\indent Returns:}
A digraph.



 In the first form, if \mbox{\texttt{\mdseries\slshape D1}}, \mbox{\texttt{\mdseries\slshape D2}}, etc. are digraphs, then \texttt{DigraphJoin} returns their join. In the second form, if \mbox{\texttt{\mdseries\slshape list}} is a non\texttt{\symbol{45}}empty list of digraphs, then \texttt{DigraphJoin} returns the join of the digraphs contained in the list. 

 The join of a collection of digraphs \mbox{\texttt{\mdseries\slshape D1}}, \mbox{\texttt{\mdseries\slshape D2}}, \texttt{...} is formed by first taking the \texttt{DigraphDisjointUnion} (\ref{DigraphDisjointUnion:for a list of digraphs}) of the collection. In the disjoint union, if $i \neq j$ then there are no edges between vertices corresponding to digraphs \mbox{\texttt{\mdseries\slshape D}}\texttt{[i]} and \mbox{\texttt{\mdseries\slshape D}}\texttt{[j]} in the collection; the join is created by including all such edges.

 For example, the join of two empty digraphs is a complete bipartite digraph.

 Note that previously set \texttt{DigraphVertexLabels} (\ref{DigraphVertexLabels}) will be lost. 

 If the first digraph \mbox{\texttt{\mdseries\slshape D1}} [\mbox{\texttt{\mdseries\slshape list[1]}}] belongs to \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then \mbox{\texttt{\mdseries\slshape D1}} [\mbox{\texttt{\mdseries\slshape list[1]}}] is modified in place to contain the appropriate vertices and edges. If \mbox{\texttt{\mdseries\slshape digraph}} belongs to \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), a new immutable digraph containing the appropriate vertices and edges is
returned. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := CompleteDigraph(3);|
  <immutable complete digraph with 3 vertices>
  !gapprompt@gap>| !gapinput@IsCompleteDigraph(DigraphJoin(D, D));|
  true
  !gapprompt@gap>| !gapinput@D2 := CycleDigraph(3);|
  <immutable cycle digraph with 3 vertices>
  !gapprompt@gap>| !gapinput@DigraphJoin(D, D2);|
  <immutable digraph with 6 vertices, 27 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphCartesianProduct (for a positive number of digraphs)}}
\logpage{[ 3, 3, 32 ]}\nobreak
\hyperdef{L}{X7D625CC87DBFFDED}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphCartesianProduct({\mdseries\slshape gr1, gr2, ...})\index{DigraphCartesianProduct@\texttt{DigraphCartesianProduct}!for a positive number of digraphs}
\label{DigraphCartesianProduct:for a positive number of digraphs}
}\hfill{\scriptsize (function)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphCartesianProduct({\mdseries\slshape list})\index{DigraphCartesianProduct@\texttt{DigraphCartesianProduct}!for a list of digraphs}
\label{DigraphCartesianProduct:for a list of digraphs}
}\hfill{\scriptsize (function)}}\\
\textbf{\indent Returns:}
A digraph.



 In the first form, if \mbox{\texttt{\mdseries\slshape gr1}}, \mbox{\texttt{\mdseries\slshape gr2}}, etc. are digraphs, then \texttt{DigraphCartesianProduct} returns a digraph isomorphic to their Cartesian product. 

 In the second form, if \mbox{\texttt{\mdseries\slshape list}} is a non\texttt{\symbol{45}}empty list of digraphs, then \texttt{DigraphCartesianProduct} returns a digraph isomorphic to the Cartesian product of the digraphs
contained in the list. 

 Mathematically, the Cartesian product of two digraphs \texttt{G}, \texttt{H} is a digraph with vertex set \texttt{Cartesian(DigraphVertices(G), DigraphVertices(H))} such that there is an edge from \texttt{[u, u']} to \texttt{[v, v']} iff \texttt{ u = v } and there is an edge from \texttt{u'} to \texttt{v'} in \texttt{H} or \texttt{ u' = v'} and there is an edge from \texttt{u} t\texttt{v} in \texttt{G}. 

 Due to technical reasons, the digraph \texttt{D} returned by \texttt{DigraphCartesianProduct} has vertex set \texttt{[1 .. DigraphNrVertices(G)*DigraphNrVertices(H)]} instead, and the exact method of encoding pairs of vertices into integers is
implementation specific. The original vertex pair can be somewhat regained by
using \texttt{DigraphCartesianProductProjections} (\ref{DigraphCartesianProductProjections}). In addition, \texttt{DigraphVertexLabels} (\ref{DigraphVertexLabels}) are preserved: if vertex pair \texttt{[u,u']} was encoded as \texttt{i} then the vertex label of \texttt{i} will be the pair of vertex labels of \texttt{u} and \texttt{u'} i.e. \texttt{DigraphVertexLabel(D,i) = [DigraphVertexLabel(G,u), DigraphVertexLabel(H,u')]}. 

 As the Cartesian product is associative, the Cartesian product of a collection
of digraphs \mbox{\texttt{\mdseries\slshape gr1}}, \mbox{\texttt{\mdseries\slshape gr2}}, \texttt{...} is computed in the obvious fashion. 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gr := ChainDigraph(4);|
  <immutable chain digraph with 4 vertices>
  !gapprompt@gap>| !gapinput@gr2 := CycleDigraph(3);|
  <immutable cycle digraph with 3 vertices>
  !gapprompt@gap>| !gapinput@gr3 := DigraphCartesianProduct(gr, gr2);|
  <immutable digraph with 12 vertices, 21 edges>
  !gapprompt@gap>| !gapinput@IsIsomorphicDigraph(gr3, |
  !gapprompt@>| !gapinput@Digraph([[2, 5], [3, 6], [4, 7], [8], |
  !gapprompt@>| !gapinput@         [6, 9], [7, 10], [8, 11], [12],|
  !gapprompt@>| !gapinput@         [10, 1], [11, 2], [12, 3], [4]]));|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphDirectProduct (for a positive number of digraphs)}}
\logpage{[ 3, 3, 33 ]}\nobreak
\hyperdef{L}{X84D24DC9833B54A5}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphDirectProduct({\mdseries\slshape gr1, gr2, ...})\index{DigraphDirectProduct@\texttt{DigraphDirectProduct}!for a positive number of digraphs}
\label{DigraphDirectProduct:for a positive number of digraphs}
}\hfill{\scriptsize (function)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphDirectProduct({\mdseries\slshape list})\index{DigraphDirectProduct@\texttt{DigraphDirectProduct}!for a list of digraphs}
\label{DigraphDirectProduct:for a list of digraphs}
}\hfill{\scriptsize (function)}}\\
\textbf{\indent Returns:}
A digraph.



 In the first form, if \mbox{\texttt{\mdseries\slshape gr1}}, \mbox{\texttt{\mdseries\slshape gr2}}, etc. are digraphs, then \texttt{DigraphDirectProduct} returns a digraph isomorphic to their direct product. 

 In the second form, if \mbox{\texttt{\mdseries\slshape list}} is a non\texttt{\symbol{45}}empty list of digraphs, then \texttt{DigraphDirectProduct} returns a digraph isomorphic to the direct product of the digraphs contained
in the list. 

 Mathematically, the direct product of two digraphs \texttt{G}, \texttt{H} is a digraph with vertex set \texttt{Cartesian(DigraphVertices(G), DigraphVertices(H))} such that there is an edge from \texttt{[u, u']} to \texttt{[v, v']} iff there is an edge from \texttt{u} to \texttt{v} in \texttt{G} and an edge from \texttt{u'} to \texttt{v'} in \texttt{H}. 

 Due to technical reasons, the digraph \texttt{D} returned by \texttt{DigraphDirectProduct} has vertex set \texttt{[1 .. DigraphNrVertices(G)*DigraphNrVertices(H)]} instead, and the exact method of encoding pairs of vertices into integers is
implementation specific. The original vertex pair can be somewhat regained by
using \texttt{DigraphDirectProductProjections} (\ref{DigraphDirectProductProjections}). In addition \texttt{DigraphVertexLabels} (\ref{DigraphVertexLabels}) are preserved: if vertex pair \texttt{[u,u']} was encoded as \texttt{i} then the vertex label of \texttt{i} will be the pair of vertex labels of \texttt{u} and \texttt{u'} i.e. \texttt{DigraphVertexLabel(D,i) = [DigraphVertexLabel(G,u), DigraphVertexLabel(H,u')]}. 

 As the direct product is associative, the direct product of a collection of
digraphs \mbox{\texttt{\mdseries\slshape gr1}}, \mbox{\texttt{\mdseries\slshape gr2}}, \texttt{...} is computed in the obvious fashion. 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gr := ChainDigraph(4);|
  <immutable chain digraph with 4 vertices>
  !gapprompt@gap>| !gapinput@gr2 := CycleDigraph(3);|
  <immutable cycle digraph with 3 vertices>
  !gapprompt@gap>| !gapinput@gr3 := DigraphDirectProduct(gr, gr2);|
  <immutable digraph with 12 vertices, 9 edges>
  !gapprompt@gap>| !gapinput@IsIsomorphicDigraph(gr3, |
  !gapprompt@>| !gapinput@Digraph([[6], [7], [8], [], |
  !gapprompt@>| !gapinput@         [10], [11], [12], [],|
  !gapprompt@>| !gapinput@         [2], [3], [4], []]));|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{ConormalProduct}}
\logpage{[ 3, 3, 34 ]}\nobreak
\hyperdef{L}{X8160BCC378AF000F}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{ConormalProduct({\mdseries\slshape D1, D2})\index{ConormalProduct@\texttt{ConormalProduct}}
\label{ConormalProduct}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape D1}} and \mbox{\texttt{\mdseries\slshape D2}} are digraphs without multiple edges, then \texttt{ConormalProduct} calculates the \emph{co\texttt{\symbol{45}}normal product digraph} (\texttt{CNPD}) of \mbox{\texttt{\mdseries\slshape D1}} and \mbox{\texttt{\mdseries\slshape D2}}. \texttt{CNPD} has vertex set \texttt{V1 x V2} where \texttt{V1} is the vertex set of \mbox{\texttt{\mdseries\slshape D1}} and \texttt{V2} is the vertex set of \mbox{\texttt{\mdseries\slshape D2}} (a vertex \texttt{[a, b]} has label \texttt{(a \texttt{\symbol{45}} 1) * |V2| + b} in the output). There is an edge from \texttt{[a, b]} to \texttt{[c, d]} when at least one of the following two conditions are satisfied: 
\begin{itemize}
\item  There is an edge from \texttt{a} to \texttt{c} in \mbox{\texttt{\mdseries\slshape D1}}. 
\item  There is an edge from \texttt{b} to \texttt{d} in \mbox{\texttt{\mdseries\slshape D2}}. 
\end{itemize}
 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@ConormalProduct(DigraphSymmetricClosure(CycleDigraph(7)),|
  !gapprompt@>| !gapinput@DigraphSymmetricClosure(CycleDigraph(4)));|
  <immutable digraph with 28 vertices, 504 edges>
  !gapprompt@gap>| !gapinput@ConormalProduct(NullDigraph(0), CompleteDigraph(10));|
  <immutable empty digraph with 0 vertices>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{HomomorphicProduct}}
\logpage{[ 3, 3, 35 ]}\nobreak
\hyperdef{L}{X79FD2AF279F20A72}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{HomomorphicProduct({\mdseries\slshape D1, D2})\index{HomomorphicProduct@\texttt{HomomorphicProduct}}
\label{HomomorphicProduct}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape D1}} and \mbox{\texttt{\mdseries\slshape D2}} are digraphs without multiple edges, then \texttt{HomomorphicProduct} calculates the \emph{homomorphic product digraph} (\texttt{HPD}) of \mbox{\texttt{\mdseries\slshape D1}} and \mbox{\texttt{\mdseries\slshape D2}}. \texttt{HPD} has vertex set \texttt{V1 x V2} where \texttt{V1} is the vertex set of \mbox{\texttt{\mdseries\slshape D1}} and \texttt{V2} is the vertex set of \mbox{\texttt{\mdseries\slshape D2}} (a vertex \texttt{[a, b]} has label \texttt{(a \texttt{\symbol{45}} 1) * |V2| + b} in the output). There is an edge from \texttt{[a, b]} to \texttt{[c, d]} when at least one of the following two conditions are satisfied: 
\begin{itemize}
\item  The vertices \texttt{a} and \texttt{c} of \mbox{\texttt{\mdseries\slshape D1}} are equal. 
\item  There is an edge from \texttt{a} to \texttt{c} in \mbox{\texttt{\mdseries\slshape D1}} and no edge from \texttt{b} to \texttt{d} in \mbox{\texttt{\mdseries\slshape D2}}. 
\end{itemize}
 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@HomomorphicProduct(PetersenGraph(),|
  !gapprompt@>| !gapinput@DigraphSymmetricClosure(ChainDigraph(4)));|
  <immutable digraph with 40 vertices, 460 edges>
  !gapprompt@gap>| !gapinput@D1 := Digraph([[2], [1, 3, 4], [2, 5], [2, 5], [3, 4]]);|
  <immutable digraph with 5 vertices, 10 edges>
  !gapprompt@gap>| !gapinput@D2 := Digraph([[2], [1, 3], [2, 4], [3]]);|
  <immutable digraph with 4 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@HomomorphicProduct(D1, D2);|
  <immutable digraph with 20 vertices, 180 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{LexicographicProduct}}
\logpage{[ 3, 3, 36 ]}\nobreak
\hyperdef{L}{X8151176882BA9901}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{LexicographicProduct({\mdseries\slshape D1, D2})\index{LexicographicProduct@\texttt{LexicographicProduct}}
\label{LexicographicProduct}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape D1}} and \mbox{\texttt{\mdseries\slshape D2}} are digraphs without multiple edges, then \texttt{LexicographicProduct} calculates the \emph{lexicographic product digraph} (\texttt{LPD}) of \mbox{\texttt{\mdseries\slshape D1}} and \mbox{\texttt{\mdseries\slshape D2}}. \texttt{LPD} has vertex set \texttt{V1 x V2} where \texttt{V1} is the vertex set of \mbox{\texttt{\mdseries\slshape D1}} and \texttt{V2} is the vertex set of \mbox{\texttt{\mdseries\slshape D2}} (a vertex \texttt{[a, b]} has label \texttt{(a \texttt{\symbol{45}} 1) * |V2| + b} in the output). There is an edge from \texttt{[a, b]} to \texttt{[c, d]} when at least one of the following two conditions are satisfied: 
\begin{itemize}
\item  There is an edge from \texttt{a} to \texttt{c} in \mbox{\texttt{\mdseries\slshape D1}}. 
\item  The vertices \texttt{a} and \texttt{c} of \mbox{\texttt{\mdseries\slshape D1}} are equal and there is an edge from \texttt{b} to \texttt{d} in \mbox{\texttt{\mdseries\slshape D2}}. 
\end{itemize}
 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@LexicographicProduct(DigraphSymmetricClosure(CycleDigraph(3)),|
  !gapprompt@>| !gapinput@DigraphSymmetricClosure(ChainDigraph(2)));|
  <immutable digraph with 6 vertices, 30 edges>
  !gapprompt@gap>| !gapinput@OutNeighbours(last);|
  [ [ 2, 3, 4, 5, 6 ], [ 1, 3, 4, 5, 6 ], [ 1, 2, 4, 5, 6 ], 
    [ 1, 2, 3, 5, 6 ], [ 1, 2, 3, 4, 6 ], [ 1, 2, 3, 4, 5 ] ]
  !gapprompt@gap>| !gapinput@LexicographicProduct(NullDigraph(0), CompleteDigraph(10));|
  <immutable empty digraph with 0 vertices>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{ModularProduct}}
\logpage{[ 3, 3, 37 ]}\nobreak
\hyperdef{L}{X807F95057F9DF576}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{ModularProduct({\mdseries\slshape D1, D2})\index{ModularProduct@\texttt{ModularProduct}}
\label{ModularProduct}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape D1}} and \mbox{\texttt{\mdseries\slshape D2}} are digraphs without multiple edges, then \texttt{ModularProduct} calculates the \emph{modular product digraph} (\texttt{MPD}) of \mbox{\texttt{\mdseries\slshape D1}} and \mbox{\texttt{\mdseries\slshape D2}}. \texttt{MPD} has vertex set \texttt{V1 x V2} where \texttt{V1} is the vertex set of \mbox{\texttt{\mdseries\slshape D1}} and \texttt{V2} is the vertex set of \mbox{\texttt{\mdseries\slshape D2}} (a vertex \texttt{[a, b]} has label \texttt{(a \texttt{\symbol{45}} 1) * |V2| + b} in the output). There is an edge from \texttt{[a, b]} to \texttt{[c, d]} precisely when the following two conditions are satisfied: 
\begin{itemize}
\item  The vertices \texttt{a} and \texttt{c} of \mbox{\texttt{\mdseries\slshape D1}} are equal if and only if the vertices \texttt{b} and \texttt{d} of \mbox{\texttt{\mdseries\slshape D2}} are equal. 
\item  There is an edge from \texttt{a} to \texttt{c} in \mbox{\texttt{\mdseries\slshape D1}} if and only if there is an edge from \texttt{b} to \texttt{d} in \mbox{\texttt{\mdseries\slshape D2}}. 
\end{itemize}
 Notably, the complete (with loops) subdigraphs of \texttt{MPD} are precisely the partial isomorphisms from \mbox{\texttt{\mdseries\slshape D1}} to \mbox{\texttt{\mdseries\slshape D2}}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@ModularProduct(Digraph([[1], [1, 2]]), Digraph([[], [2]]));|
  <immutable digraph with 4 vertices, 4 edges>
  !gapprompt@gap>| !gapinput@OutNeighbours(last);|
  [ [ 4 ], [ 2, 3 ], [  ], [ 4 ] ]
  !gapprompt@gap>| !gapinput@ModularProduct(PetersenGraph(),|
  !gapprompt@>| !gapinput@DigraphSymmetricClosure(CycleDigraph(5)));|
  <immutable digraph with 50 vertices, 950 edges>
  !gapprompt@gap>| !gapinput@ModularProduct(NullDigraph(0), CompleteDigraph(10));|
  <immutable empty digraph with 0 vertices>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{StrongProduct}}
\logpage{[ 3, 3, 38 ]}\nobreak
\hyperdef{L}{X82E200F07FEFAF27}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{StrongProduct({\mdseries\slshape D1, D2})\index{StrongProduct@\texttt{StrongProduct}}
\label{StrongProduct}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape D1}} and \mbox{\texttt{\mdseries\slshape D2}} are digraphs without multiple edges, then \texttt{StrongProduct} calculates the \emph{strong product digraph} (\texttt{SPD}) of \mbox{\texttt{\mdseries\slshape D1}} and \mbox{\texttt{\mdseries\slshape D2}}. \texttt{SPD} has vertex set \texttt{V1 x V2} where \texttt{V1} is the vertex set of \mbox{\texttt{\mdseries\slshape D1}} and \texttt{V2} is the vertex set of \mbox{\texttt{\mdseries\slshape D2}} (a vertex \texttt{[a, b]} has label \texttt{(a \texttt{\symbol{45}} 1) * |V2| + b} in the output). There is an edge from \texttt{[a, b]} to \texttt{[c, d]} when at least one of the following three conditions are satisfied: 
\begin{itemize}
\item  The vertices \texttt{a} and \texttt{c} of \mbox{\texttt{\mdseries\slshape D1}} are equal and there is an edge from \texttt{b} to \texttt{d} in \mbox{\texttt{\mdseries\slshape D2}}. 
\item  The vertices \texttt{b} and \texttt{d} of \mbox{\texttt{\mdseries\slshape D2}} are equal and there is an edge from \texttt{a} to \texttt{c} in \mbox{\texttt{\mdseries\slshape D1}}. 
\item  There is an edge from \texttt{a} to \texttt{c} in \mbox{\texttt{\mdseries\slshape D1}} and there is an edge from \texttt{b} to \texttt{d} in \mbox{\texttt{\mdseries\slshape D2}}. 
\end{itemize}
 The SPD of two paths of lengths \texttt{m} and \texttt{n} is also the king's graph for an \texttt{m} by \texttt{n} board. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D1 := Digraph([[2], [1, 3, 4], [2, 5], [2, 5], [3, 4]]);|
  <immutable digraph with 5 vertices, 10 edges>
  !gapprompt@gap>| !gapinput@D2 := Digraph([[2], [1, 3, 4], [2], [2]]);|
  <immutable digraph with 4 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@StrongProduct(D1, D2);|
  <immutable digraph with 20 vertices, 130 edges>
  !gapprompt@gap>| !gapinput@StrongProduct(DigraphSymmetricClosure(ChainDigraph(3)),|
  !gapprompt@>| !gapinput@DigraphSymmetricClosure(ChainDigraph(4)));|
  <immutable digraph with 12 vertices, 58 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphCartesianProductProjections}}
\logpage{[ 3, 3, 39 ]}\nobreak
\hyperdef{L}{X8795087A78FE7D54}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphCartesianProductProjections({\mdseries\slshape digraph})\index{DigraphCartesianProductProjections@\texttt{DigraphCartesianProductProjections}}
\label{DigraphCartesianProductProjections}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A list of transformations.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a Cartesian product digraph, \texttt{digraph = DigraphCartesianProduct(gr{\textunderscore}1, gr{\textunderscore}2,
... )}, then \texttt{DigraphCartesianProductProjections} returns a list \texttt{proj} such that \texttt{proj[i]} is the projection onto the \texttt{i}\texttt{\symbol{45}}th coordinate of the product. 

 A projection is an idempotent endomorphism of \mbox{\texttt{\mdseries\slshape digraph}}. If \texttt{gr1, gr2, ...} are all loopless digraphs, then the induced subdigraph of \mbox{\texttt{\mdseries\slshape digraph}} on the image of \texttt{proj[i]} is isomorphic to \texttt{gr{\textunderscore}i}. 

 Currently this attribute is only set upon creating an immutable digraph via \texttt{DigraphCartesianProduct} and there is no way of calculating it for other digraphs. 

 For more information see \texttt{DigraphCartesianProduct} (\ref{DigraphCartesianProduct:for a list of digraphs}) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := DigraphCartesianProduct(ChainDigraph(3), CycleDigraph(4),|
  !gapprompt@>| !gapinput@Digraph([[2], [2]]));;|
  !gapprompt@gap>| !gapinput@HasDigraphCartesianProductProjections(D);|
  true
  !gapprompt@gap>| !gapinput@proj := DigraphCartesianProductProjections(D);; Length(proj);|
  3
  !gapprompt@gap>| !gapinput@IsIdempotent(proj[2]);|
  true
  !gapprompt@gap>| !gapinput@RankOfTransformation(proj[3]);|
  2
  !gapprompt@gap>| !gapinput@S := ImageSetOfTransformation(proj[2]);;|
  !gapprompt@gap>| !gapinput@IsIsomorphicDigraph(CycleDigraph(4), InducedSubdigraph(D, S));|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphDirectProductProjections}}
\logpage{[ 3, 3, 40 ]}\nobreak
\hyperdef{L}{X84FB64F185B804C2}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphDirectProductProjections({\mdseries\slshape digraph})\index{DigraphDirectProductProjections@\texttt{DigraphDirectProductProjections}}
\label{DigraphDirectProductProjections}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A list of transformations.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a direct product digraph, \texttt{digraph = DigraphDirectProduct(gr{\textunderscore}1, gr{\textunderscore}2, ...
)}, then \texttt{DigraphDirectProductProjections} returns a list \texttt{proj} such that \texttt{proj[i]} is the projection onto the \texttt{i}\texttt{\symbol{45}}th coordinate of the product. 

 A projection is an idempotent endomorphism of \mbox{\texttt{\mdseries\slshape digraph}}. If \texttt{gr1, gr2, ...} are all loopless digraphs, then the image of \mbox{\texttt{\mdseries\slshape digraph}} under \texttt{proj[i]} is isomorphic to \texttt{gr{\textunderscore}i}. 

 Currently this attribute is only set upon creating an immutable digraph via \texttt{DigraphDirectProduct} and there is no way of calculating it for other digraphs. 

 For more information, see \texttt{DigraphDirectProduct} (\ref{DigraphDirectProduct:for a list of digraphs}) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := DigraphDirectProduct(ChainDigraph(3), CycleDigraph(4),|
  !gapprompt@>| !gapinput@Digraph([[2], [2]]));;|
  !gapprompt@gap>| !gapinput@HasDigraphDirectProductProjections(D);|
  true
  !gapprompt@gap>| !gapinput@proj := DigraphDirectProductProjections(D);; Length(proj);|
  3
  !gapprompt@gap>| !gapinput@IsIdempotent(proj[2]);|
  true
  !gapprompt@gap>| !gapinput@RankOfTransformation(proj[3]);|
  2
  !gapprompt@gap>| !gapinput@P := DigraphRemoveAllMultipleEdges(|
  !gapprompt@>| !gapinput@ReducedDigraph(OnDigraphs(D, proj[2])));; |
  !gapprompt@gap>| !gapinput@IsIsomorphicDigraph(CycleDigraph(4), P);|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{LineDigraph}}
\logpage{[ 3, 3, 41 ]}\nobreak
\hyperdef{L}{X8595BF937B749F22}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{LineDigraph({\mdseries\slshape digraph})\index{LineDigraph@\texttt{LineDigraph}}
\label{LineDigraph}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{EdgeDigraph({\mdseries\slshape digraph})\index{EdgeDigraph@\texttt{EdgeDigraph}}
\label{EdgeDigraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 Given a digraph \mbox{\texttt{\mdseries\slshape digraph}}, the operation returns the digraph obtained by associating a vertex with each
edge of \mbox{\texttt{\mdseries\slshape digraph}}, and creating an edge from a vertex \texttt{v} to a vertex \texttt{u} if and only if the terminal vertex of the edge associated with \texttt{v} is the start vertex of the edge associated with \texttt{u}.

 Note that the returned digraph is always a new immutable digraph, and the
argument \mbox{\texttt{\mdseries\slshape digraph}} is never modified. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@LineDigraph(CompleteDigraph(3));|
  <immutable digraph with 6 vertices, 12 edges>
  !gapprompt@gap>| !gapinput@LineDigraph(ChainDigraph(3));|
  <immutable digraph with 2 vertices, 1 edge>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{LineUndirectedDigraph}}
\logpage{[ 3, 3, 42 ]}\nobreak
\hyperdef{L}{X8364C6F17A1680CB}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{LineUndirectedDigraph({\mdseries\slshape digraph})\index{LineUndirectedDigraph@\texttt{LineUndirectedDigraph}}
\label{LineUndirectedDigraph}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{EdgeUndirectedDigraph({\mdseries\slshape digraph})\index{EdgeUndirectedDigraph@\texttt{EdgeUndirectedDigraph}}
\label{EdgeUndirectedDigraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 Given a symmetric digraph \mbox{\texttt{\mdseries\slshape digraph}}, the operation returns the symmetric digraph obtained by associating a vertex
with each edge of \mbox{\texttt{\mdseries\slshape digraph}}, ignoring directions and multiplicities, and adding an edge between two
vertices if and only if the corresponding edges have a vertex in common.

 Note that the returned digraph is always a new immutable digraph, and the
argument \mbox{\texttt{\mdseries\slshape digraph}} is never modified. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@LineUndirectedDigraph(CompleteDigraph(3));|
  <immutable digraph with 3 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@LineUndirectedDigraph(DigraphSymmetricClosure(ChainDigraph(3)));|
  <immutable digraph with 2 vertices, 2 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DoubleDigraph}}
\logpage{[ 3, 3, 43 ]}\nobreak
\hyperdef{L}{X7FB8B48C87C0ED16}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DoubleDigraph({\mdseries\slshape digraph})\index{DoubleDigraph@\texttt{DoubleDigraph}}
\label{DoubleDigraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 Let \mbox{\texttt{\mdseries\slshape digraph}} be a digraph with vertex set \texttt{V}. This function returns the double digraph of \mbox{\texttt{\mdseries\slshape digraph}}. The vertex set of the double digraph is the original vertex set together
with a duplicate. The edges are \texttt{[u{\textunderscore}1, v{\textunderscore}2]} and \texttt{[u{\textunderscore}2, v{\textunderscore}1]} if and only if \texttt{[u, v]} is an edge in \mbox{\texttt{\mdseries\slshape digraph}}, together with the original edges and their duplicates.

 If \mbox{\texttt{\mdseries\slshape digraph}} is mutable, then \mbox{\texttt{\mdseries\slshape digraph}} is modified in\texttt{\symbol{45}}place. If \mbox{\texttt{\mdseries\slshape digraph}} is immutable, then a new immutable digraph constructed as described above is
returned. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gamma := Digraph([[2], [3], [1]]);|
  <immutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DoubleDigraph(gamma);|
  <immutable digraph with 6 vertices, 12 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{BipartiteDoubleDigraph}}
\logpage{[ 3, 3, 44 ]}\nobreak
\hyperdef{L}{X7C6E6CB284982C7A}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{BipartiteDoubleDigraph({\mdseries\slshape digraph})\index{BipartiteDoubleDigraph@\texttt{BipartiteDoubleDigraph}}
\label{BipartiteDoubleDigraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 Let \mbox{\texttt{\mdseries\slshape digraph}} be a digraph with vertex set \texttt{V}. This function returns the bipartite double digraph of \mbox{\texttt{\mdseries\slshape digraph}}. The vertex set of the double digraph is the original vertex set together
with a duplicate. The edges are \texttt{[u{\textunderscore}1, v{\textunderscore}2]} and \texttt{[u{\textunderscore}2, v{\textunderscore}1]} if and only if \texttt{[u, v]} is an edge in \mbox{\texttt{\mdseries\slshape digraph}}. The resulting graph is bipartite, since the original edges are not included
in the resulting digraph.

 If \mbox{\texttt{\mdseries\slshape digraph}} is mutable, then \mbox{\texttt{\mdseries\slshape digraph}} is modified in\texttt{\symbol{45}}place. If \mbox{\texttt{\mdseries\slshape digraph}} is immutable, then a new immutable digraph constructed as described above is
returned. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gamma := Digraph([[2], [3], [1]]);|
  <immutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@BipartiteDoubleDigraph(gamma);|
  <immutable digraph with 6 vertices, 6 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphAddAllLoops}}
\logpage{[ 3, 3, 45 ]}\nobreak
\hyperdef{L}{X8167A50A83256ED1}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphAddAllLoops({\mdseries\slshape digraph})\index{DigraphAddAllLoops@\texttt{DigraphAddAllLoops}}
\label{DigraphAddAllLoops}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphAddAllLoopsAttr({\mdseries\slshape digraph})\index{DigraphAddAllLoopsAttr@\texttt{DigraphAddAllLoopsAttr}}
\label{DigraphAddAllLoopsAttr}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A digraph.



 For a digraph \mbox{\texttt{\mdseries\slshape digraph}} this operation returns a new digraph constructed from \mbox{\texttt{\mdseries\slshape digraph}}, such that a loop is added for every vertex which did not have a loop in \mbox{\texttt{\mdseries\slshape digraph}}.

 If \mbox{\texttt{\mdseries\slshape digraph}} is immutable, then a new immutable digraph is returned. Otherwise, the loops
are added to the loopless vertices of the mutable digraph \mbox{\texttt{\mdseries\slshape digraph}} in\texttt{\symbol{45}}place. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := EmptyDigraph(13);|
  <immutable empty digraph with 13 vertices>
  !gapprompt@gap>| !gapinput@D := DigraphAddAllLoops(D);|
  <immutable reflexive digraph with 13 vertices, 13 edges>
  !gapprompt@gap>| !gapinput@OutNeighbours(D);|
  [ [ 1 ], [ 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], 
    [ 10 ], [ 11 ], [ 12 ], [ 13 ] ]
  !gapprompt@gap>| !gapinput@D := Digraph([[1, 2, 3], [1, 3], [1]]);|
  <immutable digraph with 3 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@D := DigraphAddAllLoops(D);|
  <immutable reflexive digraph with 3 vertices, 8 edges>
  !gapprompt@gap>| !gapinput@OutNeighbours(D);|
  [ [ 1, 2, 3 ], [ 1, 3, 2 ], [ 1, 3 ] ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphAddAllLoops(D);|
  <mutable digraph with 3 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@D;|
  <mutable digraph with 3 vertices, 6 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DistanceDigraph (for digraph and int)}}
\logpage{[ 3, 3, 46 ]}\nobreak
\hyperdef{L}{X865436437DF95FEF}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DistanceDigraph({\mdseries\slshape digraph, i})\index{DistanceDigraph@\texttt{DistanceDigraph}!for digraph and int}
\label{DistanceDigraph:for digraph and int}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DistanceDigraph({\mdseries\slshape digraph, list})\index{DistanceDigraph@\texttt{DistanceDigraph}!for digraph and list}
\label{DistanceDigraph:for digraph and list}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 The first argument is a digraph, the second argument is a
non\texttt{\symbol{45}}negative integer or a list of positive integers. This
operation returns a digraph on the same set of vertices as \mbox{\texttt{\mdseries\slshape digraph}}, with two vertices being adjacent if and only if the distance between them in \mbox{\texttt{\mdseries\slshape digraph}} equals \mbox{\texttt{\mdseries\slshape i}} or is a number in \mbox{\texttt{\mdseries\slshape list}}. See \texttt{DigraphShortestDistance} (\ref{DigraphShortestDistance:for a digraph and two vertices}). 

 If \mbox{\texttt{\mdseries\slshape digraph}} is mutable, then \mbox{\texttt{\mdseries\slshape digraph}} is modified in\texttt{\symbol{45}}place. If \mbox{\texttt{\mdseries\slshape digraph}} is immutable, then a new immutable digraph constructed as described above is
returned. 
\begin{Verbatim}[commandchars=!|N,fontsize=\small,frame=single,label=Example]
  !gapprompt|gap>N !gapinput|digraph := DigraphFromSparse6String(N
  !gapprompt|>N !gapinput|":]n?AL`BC_DEbEF`GIaGHdIJeGKcKL_@McDHfILaBJfHMjKM");N
  <immutable symmetric digraph with 30 vertices, 90 edges>
  !gapprompt|gap>N !gapinput|DistanceDigraph(digraph, 1);N
  <immutable digraph with 30 vertices, 90 edges>
  !gapprompt|gap>N !gapinput|DistanceDigraph(digraph, [1, 2]);N
  <immutable digraph with 30 vertices, 270 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphClosure}}
\logpage{[ 3, 3, 47 ]}\nobreak
\hyperdef{L}{X86F9CCEA839ABC48}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphClosure({\mdseries\slshape digraph, k})\index{DigraphClosure@\texttt{DigraphClosure}}
\label{DigraphClosure}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 Given a symmetric loopless digraph with no multiple edges \mbox{\texttt{\mdseries\slshape digraph}}, the \emph{\mbox{\texttt{\mdseries\slshape k}}\texttt{\symbol{45}}closure o\mbox{\texttt{\mdseries\slshape digraph}}} is defined to be the unique smallest symmetric loopless digraph \texttt{C} with no multiple edges on the vertices of \mbox{\texttt{\mdseries\slshape digraph}} that contains all the edges of \mbox{\texttt{\mdseries\slshape digraph}} and satisfies the property that the sum of the degrees of every two
non\texttt{\symbol{45}}adjacenct vertices in \texttt{C} is less than \mbox{\texttt{\mdseries\slshape k}}. See \texttt{IsSymmetricDigraph} (\ref{IsSymmetricDigraph}), \texttt{DigraphHasLoops} (\ref{DigraphHasLoops}), \texttt{IsMultiDigraph} (\ref{IsMultiDigraph}), and \texttt{OutDegreeOfVertex} (\ref{OutDegreeOfVertex}). 

 The operation \texttt{DigraphClosure} returns the \mbox{\texttt{\mdseries\slshape k}}\texttt{\symbol{45}}closure of \mbox{\texttt{\mdseries\slshape digraph}}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := CompleteDigraph(6);|
  <immutable complete digraph with 6 vertices>
  !gapprompt@gap>| !gapinput@D := DigraphRemoveEdges(D, [[1, 2], [2, 1]]);|
  <immutable digraph with 6 vertices, 28 edges>
  !gapprompt@gap>| !gapinput@closure := DigraphClosure(D, 6);|
  <immutable digraph with 6 vertices, 30 edges>
  !gapprompt@gap>| !gapinput@IsCompleteDigraph(closure);|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphMycielskian}}
\logpage{[ 3, 3, 48 ]}\nobreak
\hyperdef{L}{X7B5AC5FE859F4D80}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphMycielskian({\mdseries\slshape digraph})\index{DigraphMycielskian@\texttt{DigraphMycielskian}}
\label{DigraphMycielskian}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphMycielskianAttr({\mdseries\slshape digraph})\index{DigraphMycielskianAttr@\texttt{DigraphMycielskianAttr}}
\label{DigraphMycielskianAttr}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a symmetric digraph, then \texttt{DigraphMycielskian} returns the Mycielskian of \mbox{\texttt{\mdseries\slshape digraph}}.

 The Mycielskian of a symmetric digraph is a larger symmetric digraph
constructed from it, which has a larger chromatic number. For further
information, see \href{https://en.wikipedia.org/wiki/Mycielskian} {\texttt{https://en.wikipedia.org/wiki/Mycielskian}}.

 If \mbox{\texttt{\mdseries\slshape digraph}} is immutable, then a new immutable digraph is returned. Otherwise, the mutable
digraph \mbox{\texttt{\mdseries\slshape digraph}} is changed in\texttt{\symbol{45}}place into its Mycielskian.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(2);|
  <immutable cycle digraph with 2 vertices>
  !gapprompt@gap>| !gapinput@ChromaticNumber(D);|
  2
  !gapprompt@gap>| !gapinput@D := DigraphMycielskian(D);|
  <immutable digraph with 5 vertices, 10 edges>
  !gapprompt@gap>| !gapinput@ChromaticNumber(D);|
  3
  !gapprompt@gap>| !gapinput@D := DigraphMycielskian(D);|
  <immutable digraph with 11 vertices, 40 edges>
  !gapprompt@gap>| !gapinput@ChromaticNumber(D);|
  4
  !gapprompt@gap>| !gapinput@D := CompleteBipartiteDigraph(IsMutable, 2, 3);|
  <mutable digraph with 5 vertices, 12 edges>
  !gapprompt@gap>| !gapinput@DigraphMycielskian(D);|
  <mutable digraph with 11 vertices, 46 edges>
  !gapprompt@gap>| !gapinput@D;|
  <mutable digraph with 11 vertices, 46 edges>
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{Random digraphs}}\logpage{[ 3, 4, 0 ]}
\hyperdef{L}{X85B5D9B97F5187B7}{}
{
 

\subsection{\textcolor{Chapter }{RandomDigraph}}
\logpage{[ 3, 4, 1 ]}\nobreak
\hyperdef{L}{X86CF9F66788B2A24}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{RandomDigraph({\mdseries\slshape [filt, ]n[, p]})\index{RandomDigraph@\texttt{RandomDigraph}}
\label{RandomDigraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 The other implemented filters are as follows: \texttt{IsConnectedDigraph} (\ref{IsConnectedDigraph}), \texttt{IsSymmetricDigraph} (\ref{IsSymmetricDigraph}), \texttt{IsAcyclicDigraph} (\ref{IsAcyclicDigraph}), \texttt{IsEulerianDigraph} (\ref{IsEulerianDigraph}), \texttt{IsHamiltonianDigraph} (\ref{IsHamiltonianDigraph}).

 For \texttt{IsConnectedDigraph} (\ref{IsConnectedDigraph}), a random tree is first created independent of the value of \mbox{\texttt{\mdseries\slshape p}}, guaranteeing connectivity (with $\mbox{\texttt{\mdseries\slshape n}}-1$ edges), and then edges are added between the remaining pairs of vertices with
probability approximately \mbox{\texttt{\mdseries\slshape p}}.

 For \texttt{IsHamiltonianDigraph} (\ref{IsHamiltonianDigraph}), a random Hamiltonian cycle is first created independent of the value of \mbox{\texttt{\mdseries\slshape p}} (with \mbox{\texttt{\mdseries\slshape n}} edges), and then edges are added between the remaining pairs of vertices with
probability approximately \mbox{\texttt{\mdseries\slshape p}}.

 For \texttt{IsEulerianDigraph} (\ref{IsEulerianDigraph}), a random Eulerian cycle is created where \mbox{\texttt{\mdseries\slshape p}} influences how long the cycle will be. The cycle grows by randomly considering
edges that extend the cycle, and adding an edge with probability approximately \mbox{\texttt{\mdseries\slshape p}}. The cycle stops when we get back to the start vertex and have no more edges
left to consider from it that extend the cycle further (any possible edge from
the start vertex has either been added to the cycle, or rejected, leaving no
more edges to consider). Thus $\mbox{\texttt{\mdseries\slshape p}} = 1$ does not necessarily guarantee a complete digraph. Instead, it guarantees that
all edges considered up to the point where the cycle stops, are added.

 For \texttt{IsAcyclicDigraph} (\ref{IsAcyclicDigraph}) and \texttt{IsSymmetricDigraph} (\ref{IsSymmetricDigraph}), edges are added between any pairs of vertices with probability approximately \mbox{\texttt{\mdseries\slshape p}}.

 If \mbox{\texttt{\mdseries\slshape n}} is a positive integer, then this function returns a random digraph with \mbox{\texttt{\mdseries\slshape n}} vertices and without multiple edges. The result may or may not have loops. If
using \texttt{IsAcyclicDigraph} (\ref{IsAcyclicDigraph}), the resulting graph will not have any loops by definition.

 If the optional second argument \mbox{\texttt{\mdseries\slshape p}} is a float with value $0 \leq $ \mbox{\texttt{\mdseries\slshape  p }} $ \leq 1$, then an edge will exist between each pair of vertices with probability
approximately \mbox{\texttt{\mdseries\slshape p}}. If \mbox{\texttt{\mdseries\slshape p}} is not specified, then a random probability will be assumed (chosen with
uniform probability).

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@RandomDigraph(1000);|
  <immutable digraph with 1000 vertices, 364444 edges>
  !gapprompt@gap>| !gapinput@RandomDigraph(10000, 0.023);|
  <immutable digraph with 10000 vertices, 2300438 edges>
  !gapprompt@gap>| !gapinput@RandomDigraph(IsMutableDigraph, 1000, 1 / 2);|
  <mutable digraph with 1000 vertices, 499739 edges>
  !gapprompt@gap>| !gapinput@RandomDigraph(IsConnectedDigraph, 1000, 0.75);|
  <immutable digraph with 1000 vertices, 750265 edges>
  !gapprompt@gap>| !gapinput@RandomDigraph(IsSymmetricDigraph, 1000);|
  <immutable digraph with 1000 vertices, 329690 edges>
  !gapprompt@gap>| !gapinput@RandomDigraph(IsAcyclicDigraph, 1000, 0.25);|
  <immutable digraph with 1000 vertices, 125070 edges>
  !gapprompt@gap>| !gapinput@RandomDigraph(IsHamiltonianDigraph, 1000, 0.5);|
  <immutable digraph with 1000 vertices, 500327 edges>
  !gapprompt@gap>| !gapinput@RandomDigraph(IsEulerianDigraph, 1000, 0.5);|
  <immutable digraph with 1000 vertices, 433869 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{RandomMultiDigraph}}
\logpage{[ 3, 4, 2 ]}\nobreak
\hyperdef{L}{X78FE275E7E77D56F}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{RandomMultiDigraph({\mdseries\slshape n[, m]})\index{RandomMultiDigraph@\texttt{RandomMultiDigraph}}
\label{RandomMultiDigraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is a positive integer, then this function returns a random digraph with \mbox{\texttt{\mdseries\slshape n}} vertices. If the optional second argument \mbox{\texttt{\mdseries\slshape m}} is a positive integer, then the digraph will have \mbox{\texttt{\mdseries\slshape m}} edges. If \mbox{\texttt{\mdseries\slshape m}} is not specified, then the number of edges will be chosen randomly (with
uniform probability) from the range \texttt{[1 .. }${n \choose 2}$\texttt{]}. 

 The method used by this function chooses each edge from the set of all
possible edges with uniform probability. No effort is made to avoid creating
multiple edges, so it is possible (but not guaranteed) that the result will
have multiple edges. The result may or may not have loops.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@RandomMultiDigraph(1000);|
  <immutable multidigraph with 1000 vertices, 216659 edges>
  !gapprompt@gap>| !gapinput@RandomMultiDigraph(1000, 950);|
  <immutable multidigraph with 1000 vertices, 950 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{RandomTournament}}
\logpage{[ 3, 4, 3 ]}\nobreak
\hyperdef{L}{X7D36B5E57F055051}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{RandomTournament({\mdseries\slshape [filt, ]n})\index{RandomTournament@\texttt{RandomTournament}}
\label{RandomTournament}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 If \mbox{\texttt{\mdseries\slshape n}} is a non\texttt{\symbol{45}}negative integer, this function returns a random
tournament with \mbox{\texttt{\mdseries\slshape n}} vertices. See \texttt{IsTournament} (\ref{IsTournament}). 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@RandomTournament(10);|
  <immutable tournament with 10 vertices>
  !gapprompt@gap>| !gapinput@RandomTournament(IsMutableDigraph, 10);|
  <mutable digraph with 1000 vertices, 500601 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{RandomLattice}}
\logpage{[ 3, 4, 4 ]}\nobreak
\hyperdef{L}{X7A023E4787682475}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{RandomLattice({\mdseries\slshape n})\index{RandomLattice@\texttt{RandomLattice}}
\label{RandomLattice}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 If \mbox{\texttt{\mdseries\slshape n}} is a positive integer, this function return a random lattice with \texttt{m} vertices, where it is guaranteed that \texttt{m} is between \mbox{\texttt{\mdseries\slshape n}} and \texttt{2 * \mbox{\texttt{\mdseries\slshape n}}}. See \texttt{IsLatticeDigraph} (\ref{IsLatticeDigraph}). 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@RandomLattice(10);|
  <immutable lattice digraph with 10 vertices, 39 edges>
  !gapprompt@gap>| !gapinput@RandomLattice(IsMutableDigraph, 10);|
  <mutable digraph with 12 vertices, 52 edges>
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{Standard examples}}\logpage{[ 3, 5, 0 ]}
\hyperdef{L}{X7C76D1DC7DAF03D3}{}
{
 

\subsection{\textcolor{Chapter }{AndrasfaiGraph}}
\logpage{[ 3, 5, 1 ]}\nobreak
\hyperdef{L}{X7D5E3E337D03EDFF}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{AndrasfaiGraph({\mdseries\slshape [filt, ]n})\index{AndrasfaiGraph@\texttt{AndrasfaiGraph}}
\label{AndrasfaiGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is an integer greater than 0, then this operation returns the \mbox{\texttt{\mdseries\slshape n}}th \emph{Andrasfai graph}. The Andrasfai graph is a circulant graph with \texttt{3\mbox{\texttt{\mdseries\slshape n}} \texttt{\symbol{45}} 1} vertices. The indices of the Andrasfai graph are given by the numbers between \texttt{1} and \texttt{3\mbox{\texttt{\mdseries\slshape n}} \texttt{\symbol{45}} 1} that are congruent to \texttt{1} mod \texttt{3} (that is, for each index $j$, vertex $i$ is adjacent to the $i + j$th and $i - j$ vertices). The graph has \texttt{6(3\mbox{\texttt{\mdseries\slshape n}} \texttt{\symbol{45}} 1)} edges. The graph is triangle free.

 As a circulant graph, the Andrasfai graph is biconnected, cyclic, Hamiltonian,
regular, and vertex transitive.

 See \href{https://mathworld.wolfram.com/AndrasfaiGraph.html} {\texttt{https://mathworld.wolfram.com/AndrasfaiGraph.html}} for further details.

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := AndrasfaiGraph(4);|
  <immutable Hamiltonian biconnected vertex-transitive symmetric digraphjava.lang.NullPointerException
   with 11 vertices, 44 edges>
  !gapprompt@gap>| !gapinput@IsBiconnectedDigraph(D);|
  true
  !gapprompt@gap>| !gapinput@IsIsomorphicDigraph(D, CirculantGraph(11, [1, 4, 7, 10]));|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{BananaTree}}
\logpage{[ 3, 5, 2 ]}\nobreak
\hyperdef{L}{X8636C2898395B7DF}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{BananaTree({\mdseries\slshape [filt, ]n, k})\index{BananaTree@\texttt{BananaTree}}
\label{BananaTree}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph



 If \mbox{\texttt{\mdseries\slshape n}} and \mbox{\texttt{\mdseries\slshape k}} are positive integers with \mbox{\texttt{\mdseries\slshape k}} greater than $1$, then this operation returns the \emph{banana tree} with parameters \mbox{\texttt{\mdseries\slshape n}} and \mbox{\texttt{\mdseries\slshape k}}, as defined below. 

 From \href{https://mathworld.wolfram.com/BananaTree.html} {\texttt{https://mathworld.wolfram.com/BananaTree.html}}: 

 ``An \texttt{(\mbox{\texttt{\mdseries\slshape n}},\mbox{\texttt{\mdseries\slshape k}})}\texttt{\symbol{45}}banana tree, as defined by Chen et al. (1997), is a graph
obtained by connecting one leaf of each of \mbox{\texttt{\mdseries\slshape n}} copies of an \mbox{\texttt{\mdseries\slshape k}}\texttt{\symbol{45}}star graph with a single root vertex that is distinct from
all the stars.'' 

 Specifically, in the resulting digraph, vertex \texttt{1} is the 'root', and for each \texttt{m} in \texttt{[1 .. \mbox{\texttt{\mdseries\slshape k}}]}, the \texttt{m}th star is on the vertices \texttt{[((m \texttt{\symbol{45}} 1) * n) + 2 .. (m * n) + 1]}, with the first of these being the 'centre' of the star, and the second being
the 'leaf' adjacent \texttt{1}. 

 See also \texttt{StarGraph} (\ref{StarGraph}) and \texttt{IsUndirectedTree} (\ref{IsUndirectedTree}). 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := BananaTree(2, 4);|
  <immutable undirected tree with 9 vertices>
  !gapprompt@gap>| !gapinput@D := BananaTree(3, 3);|
  <immutable undirected tree with 10 vertices>
  !gapprompt@gap>| !gapinput@D := BananaTree(5, 2);|
  <immutable undirected tree with 11 vertices>
  !gapprompt@gap>| !gapinput@D := BananaTree(3, 4);|
  <immutable undirected tree with 13 vertices>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{BinaryTree}}
\logpage{[ 3, 5, 3 ]}\nobreak
\hyperdef{L}{X7FC309427BB170D8}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{BinaryTree({\mdseries\slshape [filt, ]m})\index{BinaryTree@\texttt{BinaryTree}}
\label{BinaryTree}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 This function returns a binary tree of depth \mbox{\texttt{\mdseries\slshape m}} with \texttt{2 \texttt{\symbol{94}} \mbox{\texttt{\mdseries\slshape m}} \texttt{\symbol{45}} 1} vertices. All edges are directed towards the root of the tree, which is vertex \texttt{1}. 

 Note that \texttt{BinaryTree(\mbox{\texttt{\mdseries\slshape m}})} is the induced subdigraph of \texttt{BinaryTree(\mbox{\texttt{\mdseries\slshape m}}+1)} on the vertices \texttt{[1..2\texttt{\symbol{94}}(\mbox{\texttt{\mdseries\slshape m}}\texttt{\symbol{45}}1)]}. 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@BinaryTree(1);|
  <immutable empty digraph with 1 vertex>
  !gapprompt@gap>| !gapinput@BinaryTree(8);|
  <immutable digraph with 255 vertices, 254 edges>
  !gapprompt@gap>| !gapinput@BinaryTree(IsMutableDigraph, 8);|
  <mutable digraph with 255 vertices, 254 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{BinomialTreeGraph}}
\logpage{[ 3, 5, 4 ]}\nobreak
\hyperdef{L}{X845C374280D6EAA4}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{BinomialTreeGraph({\mdseries\slshape [filt, ]n})\index{BinomialTreeGraph@\texttt{BinomialTreeGraph}}
\label{BinomialTreeGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is a positive integer then this operation returns th\mbox{\texttt{\mdseries\slshape n}}th \emph{binomial tree graph}. The binomial tree graph has \mbox{\texttt{\mdseries\slshape n}} vertices and \texttt{\mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}1} undirected edges. The vertices of the binomial tree graph are the numbers from
1 to \mbox{\texttt{\mdseries\slshape n}} in binary representation, with a vertex \texttt{v} having as a direct parent the vertex with binary representation the same as \texttt{v} but with the lowest 1\texttt{\symbol{45}}bit cleared. For example, the vertex $011$ has parent $010$, and the vertex $010$ has parent $000$.

 The binomial tree graph is an undirected tree, and is symmetric as a digraph.

 See \href{https://metacpan.org/pod/Graph::Maker::BinomialTree} {\texttt{https://metacpan.org/pod/Graph::Maker::BinomialTree}} for further details.

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := BinomialTreeGraph(9);|
  <immutable undirected tree with 9 vertices>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{BishopsGraph}}
\logpage{[ 3, 5, 5 ]}\nobreak
\hyperdef{L}{X7E3240047C92733F}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{BishopsGraph({\mdseries\slshape [filt, ][color, ]m, n})\index{BishopsGraph@\texttt{BishopsGraph}}
\label{BishopsGraph}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{BishopGraph({\mdseries\slshape [filt, ][color, ]m, n})\index{BishopGraph@\texttt{BishopGraph}}
\label{BishopGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape m}} and \mbox{\texttt{\mdseries\slshape n}} are positive integers, then this operation returns the \emph{bishop's graph} of an \mbox{\texttt{\mdseries\slshape m}} by \mbox{\texttt{\mdseries\slshape n}} chessboard, as a symmetric digraph. 

 A bishop's graph represents all possible moves of the bishop chess piece
across a chessboard. An \mbox{\texttt{\mdseries\slshape m}} by \mbox{\texttt{\mdseries\slshape n}} chessboard is a grid of \mbox{\texttt{\mdseries\slshape m}} columns ("files") an\mbox{\texttt{\mdseries\slshape n}} rows ("ranks") that intersect in squares. Orthogonally adjacent squares are
alternately colored light and dark, with the square in the first rank and file
being dark.

 The \texttt{\mbox{\texttt{\mdseries\slshape m}} * \mbox{\texttt{\mdseries\slshape n}}} vertices of the bishop's graph can be placed onto the \texttt{\mbox{\texttt{\mdseries\slshape m}} * \mbox{\texttt{\mdseries\slshape n}}} squares of an \mbox{\texttt{\mdseries\slshape m}} by \mbox{\texttt{\mdseries\slshape n}} chessboard, such that two vertices are adjacent in the digraph if and only if
a bishop can move between the corresponding squares in a single turn. A legal
bishop's move is defined as any move which moves the bishop piece to a
diagonally adjacent square or to a square which can be reached through a
series of diagonally adjacent squares, with all of these small moves being in
the same direction.

 The chosen correspondence between vertices and chess squares is given by \texttt{DigraphVertexLabels} (\ref{DigraphVertexLabels}). In more detail, the vertices of the digraph are labelled by elements of the
Cartesian product \texttt{[1..\mbox{\texttt{\mdseries\slshape m}}] x [1..\mbox{\texttt{\mdseries\slshape n}}]}, where the first entry indexes the column (file) of the square in the
chessboard, and the second entry indexes the row (rank) of the square. (Note
that the files are traditionally indexed by the lowercase letters of the
alphabet). The vertices are sorted in ascending order, first by row (second
component) and then column (first component). If the optional second argument \mbox{\texttt{\mdseries\slshape color}} is present, then this should be one of the strings \texttt{"dark"}\texttt{"light"}, or \texttt{"both"}. The default is \texttt{"both"}. A bishop on a light square can only move to light squares, and a bishop on a
dark square can only move to dark squares. This optional argument controls
which bishops are represented in the resulting digraph. If \mbox{\texttt{\mdseries\slshape color}} is \texttt{"both"}, then the resulting digraph will show all the vertices of an \mbox{\texttt{\mdseries\slshape m}} by \mbox{\texttt{\mdseries\slshape n}} chessboard, and will be disconnected (unless \texttt{\mbox{\texttt{\mdseries\slshape m}} = \mbox{\texttt{\mdseries\slshape n}} = 1}). Otherwise, \texttt{BishopsGraph} returns the induced subdigraph of this on the vertices that correspond to
either the dark squares or the light squares, according to the value of \mbox{\texttt{\mdseries\slshape color}}. 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@BishopsGraph(8, 8);|
  <immutable symmetric digraph with 64 vertices, 560 edges>
  !gapprompt@gap>| !gapinput@D := BishopsGraph("dark", 3, 5);|
  <immutable connected symmetric digraph with 8 vertices, 24 edges>
  !gapprompt@gap>| !gapinput@IsConnectedDigraph(D);       |
  true
  !gapprompt@gap>| !gapinput@BishopsGraph("light", 4, 4);|
  <immutable connected symmetric digraph with 8 vertices, 28 edges>
  !gapprompt@gap>| !gapinput@D := BishopsGraph("both", 1, 5);|
  <immutable empty digraph with 5 vertices>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{BondyGraph}}
\logpage{[ 3, 5, 6 ]}\nobreak
\hyperdef{L}{X81A0AC37816D287B}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{BondyGraph({\mdseries\slshape [filt, ]n})\index{BondyGraph@\texttt{BondyGraph}}
\label{BondyGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is a non\texttt{\symbol{45}}negative integer then this operation returns the \mbox{\texttt{\mdseries\slshape n}}th \emph{Bondy graph}. The Bondy graphs are a family of hypohamiltonian graphs: a graph which is
not Hamiltonian itself but the removal of any vertex produces a Hamiltonian
graph. The Bondy graphs are the \texttt{(3(2\mbox{\texttt{\mdseries\slshape n}} + 1) + 2, 2)}\texttt{\symbol{45}}th Generalised Petersen graphs, and have \texttt{12\mbox{\texttt{\mdseries\slshape n}} + 10} vertices and \texttt{15 + 18\mbox{\texttt{\mdseries\slshape n}}} undirected edges.

 See \href{https://mathworld.wolfram.com/HypohamiltonianGraph.html} {\texttt{https://mathworld.wolfram.com/HypohamiltonianGraph.html}} for further details.

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := BondyGraph(1);|
  <immutable symmetric digraph with 22 vertices, 66 edges>
  !gapprompt@gap>| !gapinput@IsHamiltonianDigraph(D);|
  false
  !gapprompt@gap>| !gapinput@G := List([1 .. 22], x -> DigraphRemoveVertex(D, x));;|
  !gapprompt@gap>| !gapinput@ForAll(G, IsHamiltonianDigraph);|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{BookGraph}}
\logpage{[ 3, 5, 7 ]}\nobreak
\hyperdef{L}{X861F493382FA7C0B}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{BookGraph({\mdseries\slshape [filt, ]m})\index{BookGraph@\texttt{BookGraph}}
\label{BookGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 The \emph{book graph} is the Cartesian product of a complete digraph with two vertices (as the "book
spine") and the $\mbox{\texttt{\mdseries\slshape m}}+1$ star graph (as the "pages"). For more details on the book graph please refer
to \href{https://mathworld.wolfram.com/BookGraph.html} {\texttt{https://mathworld.wolfram.com/BookGraph.html}}.

 See \texttt{DigraphCartesianProduct} (\ref{DigraphCartesianProduct:for a positive number of digraphs}), \texttt{CompleteDigraph} (\ref{CompleteDigraph}), and \texttt{StarGraph} (\ref{StarGraph}). 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@BookGraph(1);|
  <immutable bipartite symmetric digraph with bicomponents of size 2>
  !gapprompt@gap>| !gapinput@BookGraph(2);|
  <immutable bipartite symmetric digraph with bicomponents of size 3>
  !gapprompt@gap>| !gapinput@BookGraph(IsMutable, 12);|
  <mutable digraph with 26 vertices, 74 edges>
  !gapprompt@gap>| !gapinput@BookGraph(7);|
  <immutable bipartite symmetric digraph with bicomponents of size 8>
  !gapprompt@gap>| !gapinput@IsSymmetricDigraph(BookGraph(24));|
  true
  !gapprompt@gap>| !gapinput@IsBipartiteDigraph(BookGraph(24));|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{BurntPancakeGraph}}
\logpage{[ 3, 5, 8 ]}\nobreak
\hyperdef{L}{X8542287E81BDB55E}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{BurntPancakeGraph({\mdseries\slshape [filt, ]n})\index{BurntPancakeGraph@\texttt{BurntPancakeGraph}}
\label{BurntPancakeGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is a positive integer, then this operation returns the \emph{burnt pancake graph} with $n!$ vertices and $n2^{n}n!$ directed edges. The $n$th burnt pancake graph is the Cayley graph of the hyperoctahedral group acting
on \texttt{[\mbox{\texttt{\mdseries\slshape \texttt{\symbol{45}}n}} .. \texttt{\symbol{45}}1, 1 .. \mbox{\texttt{\mdseries\slshape n}}]} with respect to the generating set consisting of the ``prefix reversals'', which are defined in exactly the same way as in \texttt{PancakeGraph} (\ref{PancakeGraph}). The hyperoctahedral group consists of permutations $p$ acting on \texttt{[\mbox{\texttt{\mdseries\slshape \texttt{\symbol{45}}n}} .. \texttt{\symbol{45}}1, 1 .. \mbox{\texttt{\mdseries\slshape n}}]}, where the image of every point $i$ in \texttt{[\mbox{\texttt{\mdseries\slshape \texttt{\symbol{45}}n}} .. \texttt{\symbol{45}}1, 1 .. \mbox{\texttt{\mdseries\slshape n}}]} is equal to the negative of the image of $-i$ under $p$. GAP only works with permutations of positive integers and so \texttt{BurntPancakeGraph} returns the Cayley graph of the hyperoctahedral group acting on \texttt{[1 .. \mbox{\texttt{\mdseries\slshape 2n}}]} instead of \texttt{[\mbox{\texttt{\mdseries\slshape \texttt{\symbol{45}}n}} .. \texttt{\symbol{45}}1, 1 .. \mbox{\texttt{\mdseries\slshape n}}]}. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 See \href{https://en.wikipedia.org/wiki/Pancake_graph} {\texttt{https://en.wikipedia.org/wiki/Pancake{\textunderscore}graph}} for further details. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@BurntPancakeGraph(3);|
  <immutable symmetric digraph with 48 vertices, 144 edges>
  !gapprompt@gap>| !gapinput@BurntPancakeGraph(4);|
  <immutable symmetric digraph with 384 vertices, 1536 edges>
  !gapprompt@gap>| !gapinput@BurntPancakeGraph(5);|
  <immutable symmetric digraph with 3840 vertices, 19200 edges>
  !gapprompt@gap>| !gapinput@BurntPancakeGraph(IsMutableDigraph, 1);|
  <mutable digraph with 1 vertex, 1 edge>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{PancakeGraph}}
\logpage{[ 3, 5, 9 ]}\nobreak
\hyperdef{L}{X84C1D3D67E3979A5}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{PancakeGraph({\mdseries\slshape [filt, ]n})\index{PancakeGraph@\texttt{PancakeGraph}}
\label{PancakeGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is a positive integer, then this operation returns the \emph{pancake graph} with $n!$ vertices and $n!(n - 1)$ directed edges. The $n$th pancake graph is the Cayley graph of the symmetric group acting on \texttt{[1 .. \mbox{\texttt{\mdseries\slshape n}}]} with respect to the generating set consisting of the ``prefix reversals''. This generating set consists of the permutations \texttt{p2}, \texttt{p3}, ..., \texttt{p\mbox{\texttt{\mdseries\slshape n}}} where \texttt{ListPerm(pi, \mbox{\texttt{\mdseries\slshape n}})} is the concatenation of \texttt{[i, i \texttt{\symbol{45}} 1 .. 1]} and \texttt{[i + 1 .. \mbox{\texttt{\mdseries\slshape n}}]}. 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 See \href{https://en.wikipedia.org/wiki/Pancake_graph} {\texttt{https://en.wikipedia.org/wiki/Pancake{\textunderscore}graph}} for further details. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := PancakeGraph(5);|
  <immutable Hamiltonian symmetric digraph with 120 vertices, 480 edges>
  !gapprompt@gap>| !gapinput@DigraphUndirectedGirth(D);|
  6
  !gapprompt@gap>| !gapinput@ChromaticNumber(D);|
  3
  !gapprompt@gap>| !gapinput@IsHamiltonianDigraph(D);|
  true
  !gapprompt@gap>| !gapinput@IsCayleyDigraph(D);|
  true
  !gapprompt@gap>| !gapinput@IsVertexTransitive(D);|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{StackedBookGraph}}
\logpage{[ 3, 5, 10 ]}\nobreak
\hyperdef{L}{X7B5E9D857D47F5C2}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{StackedBookGraph({\mdseries\slshape [filt, ]m, n})\index{StackedBookGraph@\texttt{StackedBookGraph}}
\label{StackedBookGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 The \emph{stacked book graph} is the Cartesian product of the symmetric closure of the chain digraph with \mbox{\texttt{\mdseries\slshape n}} vertices (as the "book spine") and the $\mbox{\texttt{\mdseries\slshape m}}+1$ star graph (as the "pages"). For more details on the stackebook graph please
refer to \href{https://mathworld.wolfram.com/StackedBookGraph.html} {\texttt{https://mathworld.wolfram.com/StackedBookGraph.html}}.

 See \texttt{DigraphCartesianProduct} (\ref{DigraphCartesianProduct:for a positive number of digraphs}), \texttt{DigraphSymmetricClosure} (\ref{DigraphSymmetricClosure}), \texttt{ChainDigraph} (\ref{ChainDigraph}), and \texttt{StarGraph} (\ref{StarGraph}). 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@StackedBookGraph(1, 1);|
  <immutable bipartite symmetric digraph with bicomponents of size 1>
  !gapprompt@gap>| !gapinput@StackedBookGraph(1, 2);|
  <immutable bipartite symmetric digraph with bicomponents of size 2>
  !gapprompt@gap>| !gapinput@StackedBookGraph(3, 4);|
  <immutable bipartite symmetric digraph with bicomponents of size 8>
  !gapprompt@gap>| !gapinput@StackedBookGraph(IsMutable, 12, 5);|
  <mutable digraph with 65 vertices, 224 edges>
  !gapprompt@gap>| !gapinput@StackedBookGraph(5, 5);|
  <immutable bipartite symmetric digraph with bicomponent sizes 13 and 1java.lang.NullPointerException
  7>
  !gapprompt@gap>| !gapinput@IsSymmetricDigraph(StackedBookGraph(24, 8));|
  true
  !gapprompt@gap>| !gapinput@IsBipartiteDigraph(StackedBookGraph(24, 8));|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{ChainDigraph}}
\logpage{[ 3, 5, 11 ]}\nobreak
\hyperdef{L}{X870594FC866AC88E}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{ChainDigraph({\mdseries\slshape [filt, ]n})\index{ChainDigraph@\texttt{ChainDigraph}}
\label{ChainDigraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is a positive integer, this function returns a chain with \mbox{\texttt{\mdseries\slshape n}} vertices and \texttt{\mbox{\texttt{\mdseries\slshape n}} \texttt{\symbol{45}} 1} edges. Specifically, for each vertex \texttt{i} (with \texttt{i} {\textless\texttt{n}), there is a directed edge with source \texttt{i} and range \texttt{i + 1}. 

 The \texttt{DigraphReflexiveTransitiveClosure} (\ref{DigraphReflexiveTransitiveClosure}) of a chain represents a total order. 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@ChainDigraph(42);|
  <immutable chain digraph with 42 vertices>
  !gapprompt@gap>| !gapinput@ChainDigraph(IsMutableDigraph, 10);|
  <mutable digraph with 10 vertices, 9 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{CirculantGraph}}
\logpage{[ 3, 5, 12 ]}\nobreak
\hyperdef{L}{X7DB5AB657A797CF2}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{CirculantGraph({\mdseries\slshape [filt, ]n, par})\index{CirculantGraph@\texttt{CirculantGraph}}
\label{CirculantGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is an integer greater than 1, and \mbox{\texttt{\mdseries\slshape par}} is a list of integers that are contained in \texttt{[1..\mbox{\texttt{\mdseries\slshape n}}]} then this operation returns a \emph{circulant graph}. The circulant graph is a graph on \mbox{\texttt{\mdseries\slshape n}} vertices, where for each element $j$ of \mbox{\texttt{\mdseries\slshape par}}, the $i$th vertex is adjacent to the $(i + j)$th and $(i - j)$th vertices.

 If \mbox{\texttt{\mdseries\slshape par}} is $[1]$, then the graph is the \mbox{\texttt{\mdseries\slshape n}}th cyclic graph. If \mbox{\texttt{\mdseries\slshape par}} is \texttt{[1,2,...,Int(\mbox{\texttt{\mdseries\slshape n}}/2)]}, then the graph is the complete graph on \mbox{\texttt{\mdseries\slshape n}} vertices. If \mbox{\texttt{\mdseries\slshape n}} is at least 4 and \mbox{\texttt{\mdseries\slshape par}} is \texttt{[1,\mbox{\texttt{\mdseries\slshape n}}]} then the graph is the \mbox{\texttt{\mdseries\slshape n}}th Mobius ladder graph.

 A circulant graph is vertex transitive, but is not necessarily connected
(consider \texttt{CirculantGraph(4, [2])}, for example). However, a \emph{connected} circulant graph is also Hamiltonian and biconnected.

 See \href{https://mathworld.wolfram.com/CirculantGraph.html} {\texttt{https://mathworld.wolfram.com/CirculantGraph.html}} for further details.

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := CirculantGraph(6, [2]);|
  <immutable vertex-transitive symmetric digraph with 6 vertices, 12 edgjava.lang.NullPointerException
  es>
  !gapprompt@gap>| !gapinput@DigraphNrConnectedComponents(D);|
  2
  !gapprompt@gap>| !gapinput@D := CirculantGraph(6, [2, 3]);|
  <immutable Hamiltonian biconnected vertex-transitive symmetric digraphjava.lang.NullPointerException
   with 6 vertices, 18 edges>
  !gapprompt@gap>| !gapinput@AutomorphismGroup(D) = DihedralGroup(IsPermGroup, 12);|
  true
  !gapprompt@gap>| !gapinput@HamiltonianPath(D);|
  [ 1, 3, 5, 2, 6, 4 ]
  !gapprompt@gap>| !gapinput@IsCompleteDigraph(CirculantGraph(6, [1, 2, 3]));|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{CompleteDigraph}}
\logpage{[ 3, 5, 13 ]}\nobreak
\hyperdef{L}{X812417E278198D9C}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{CompleteDigraph({\mdseries\slshape [filt, ]n})\index{CompleteDigraph@\texttt{CompleteDigraph}}
\label{CompleteDigraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is a non\texttt{\symbol{45}}negative integer, this function returns the
complete digraph with \mbox{\texttt{\mdseries\slshape n}} vertices. See \texttt{IsCompleteDigraph} (\ref{IsCompleteDigraph}). 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@CompleteDigraph(20);|
  <immutable complete digraph with 20 vertices>
  !gapprompt@gap>| !gapinput@CompleteDigraph(IsMutableDigraph, 10);|
  <mutable digraph with 10 vertices, 90 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{CompleteBipartiteDigraph}}
\logpage{[ 3, 5, 14 ]}\nobreak
\hyperdef{L}{X8795B0AD856014FA}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{CompleteBipartiteDigraph({\mdseries\slshape [filt, ]m, n})\index{CompleteBipartiteDigraph@\texttt{CompleteBipartiteDigraph}}
\label{CompleteBipartiteDigraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 A complete bipartite digraph is a digraph whose vertices can be partitioned
into two non\texttt{\symbol{45}}empty vertex sets, such there exists a unique
edge with source \texttt{i} and range \texttt{j} if and only if \texttt{i} and \texttt{j} lie in different vertex sets. 

 If \mbox{\texttt{\mdseries\slshape m}} and \mbox{\texttt{\mdseries\slshape n}} are positive integers, this function returns the complete bipartite digraph
with vertex sets of sizes \mbox{\texttt{\mdseries\slshape m}} (containing the vertices \texttt{[1 .. m]}) and \mbox{\texttt{\mdseries\slshape n}} (containing the vertices \texttt{[m + 1 .. m + n]}). 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@CompleteBipartiteDigraph(2, 3);|
  <immutable complete bipartite digraph with bicomponent sizes 2 and 3>
  !gapprompt@gap>| !gapinput@CompleteBipartiteDigraph(IsMutableDigraph, 3, 2);|
  <mutable digraph with 5 vertices, 12 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{CompleteMultipartiteDigraph}}
\logpage{[ 3, 5, 15 ]}\nobreak
\hyperdef{L}{X873F29CC863241F8}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{CompleteMultipartiteDigraph({\mdseries\slshape [filt, ]orders})\index{CompleteMultipartiteDigraph@\texttt{CompleteMultipartiteDigraph}}
\label{CompleteMultipartiteDigraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 For a list \mbox{\texttt{\mdseries\slshape orders}} of \texttt{n} positive integers, this function returns the digraph containing \texttt{n} independent sets of vertices of orders \texttt{[\mbox{\texttt{\mdseries\slshape l}}[1] .. \mbox{\texttt{\mdseries\slshape l}}[n]]}. Moreover, each vertex is adjacent to every other not contained in the same
independent set. 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@CompleteMultipartiteDigraph([5, 4, 2]);|
  <immutable complete multipartite digraph with 11 vertices, 76 edges>
  !gapprompt@gap>| !gapinput@CompleteMultipartiteDigraph(IsMutableDigraph, [5, 4, 2]);|
  <mutable digraph with 11 vertices, 76 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{CycleDigraph}}
\logpage{[ 3, 5, 16 ]}\nobreak
\hyperdef{L}{X80C29DDE876FFBEB}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{CycleDigraph({\mdseries\slshape [filt, ]n})\index{CycleDigraph@\texttt{CycleDigraph}}
\label{CycleDigraph}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphCycle({\mdseries\slshape [filt, ]n})\index{DigraphCycle@\texttt{DigraphCycle}}
\label{DigraphCycle}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is a positive integer, then these functions return a \emph{cycle digraph} with \mbox{\texttt{\mdseries\slshape n}} vertices and \mbox{\texttt{\mdseries\slshape n}} edges. Specifically, for each vertex \texttt{i} (with \texttt{i} {\textless\texttt{n}), there is a directed edge with source \texttt{i} and range \texttt{i + 1}. In addition, there is an edge with source \texttt{n} and range \texttt{1}. 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@CycleDigraph(1);|
  <immutable digraph with 1 vertex, 1 edge>
  !gapprompt@gap>| !gapinput@CycleDigraph(123);|
  <immutable cycle digraph with 123 vertices>
  !gapprompt@gap>| !gapinput@CycleDigraph(IsMutableDigraph, 10);|
  <mutable digraph with 10 vertices, 10 edges>
  !gapprompt@gap>| !gapinput@DigraphCycle(4) = CycleDigraph(4);|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{CycleGraph}}
\logpage{[ 3, 5, 17 ]}\nobreak
\hyperdef{L}{X7F6EC0AE81531C3C}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{CycleGraph({\mdseries\slshape [filt, ]n})\index{CycleGraph@\texttt{CycleGraph}}
\label{CycleGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is an integer greater than 2 then this operation returns the \mbox{\texttt{\mdseries\slshape n}}th \emph{cycle graph}, consisting of the cycle o\mbox{\texttt{\mdseries\slshape n}} vertices. The cycle graph, unlike the cycle digraph, is symmetric. The cycle
graph has \mbox{\texttt{\mdseries\slshape n}} vertices and \mbox{\texttt{\mdseries\slshape n}} undirected edges. The cycle graph is simple so the
non\texttt{\symbol{45}}simple graphs with a single vertex and single loop and
with two vertices and two edges between them are excluded.

 See \href{https://mathworld.wolfram.com/CycleGraph.html} {\texttt{https://mathworld.wolfram.com/CycleGraph.html}} for further details.

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := CycleGraph(7);|
  <immutable symmetric digraph with 7 vertices, 14 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{EmptyDigraph}}
\logpage{[ 3, 5, 18 ]}\nobreak
\hyperdef{L}{X80DAE31A79FEFD40}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{EmptyDigraph({\mdseries\slshape [filt, ]n})\index{EmptyDigraph@\texttt{EmptyDigraph}}
\label{EmptyDigraph}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{NullDigraph({\mdseries\slshape [filt, ]n})\index{NullDigraph@\texttt{NullDigraph}}
\label{NullDigraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is a non\texttt{\symbol{45}}negative integer, this function returns the \emph{empty} or \emph{null} digraph with \mbox{\texttt{\mdseries\slshape n}} vertices. An empty digraph is one with no edges. 

 \texttt{NullDigraph} is a synonym for \texttt{EmptyDigraph}. 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@EmptyDigraph(20);|
  <immutable empty digraph with 20 vertices>
  !gapprompt@gap>| !gapinput@NullDigraph(10);|
  <immutable empty digraph with 10 vertices>
  !gapprompt@gap>| !gapinput@EmptyDigraph(IsMutableDigraph, 10);|
  <mutable empty digraph with 10 vertices>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{GearGraph}}
\logpage{[ 3, 5, 19 ]}\nobreak
\hyperdef{L}{X7CE45E2B782ADE9A}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{GearGraph({\mdseries\slshape [filt, ]n})\index{GearGraph@\texttt{GearGraph}}
\label{GearGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is a positive integer at least 3, then this operation returns the \emph{gear graph} with \texttt{2\mbox{\texttt{\mdseries\slshape n}} + 1} vertices and \texttt{3\mbox{\texttt{\mdseries\slshape n}}} undirected edges. The \mbox{\texttt{\mdseries\slshape n}}th gear graph is the \texttt{2\mbox{\texttt{\mdseries\slshape }}}th cycle graph with one additional central vertex, to which every other vertex
of the cycle is connected. The gear graph is a symmetric digraph. A gear graph
is a Matchstick graph, that is it is simple with a planar graph embedding, and
is a unit\texttt{\symbol{45}}distance graph (that is, it can be embedded into
the Euclidean plane with vertices being distinct points and edges having
length 1).

 See \href{https://mathworld.wolfram.com/GearGraph.html} {\texttt{https://mathworld.wolfram.com/GearGraph.html}} for further details.

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := GearGraph(4);|
  <immutable symmetric digraph with 9 vertices, 24 edges>
  !gapprompt@gap>| !gapinput@ChromaticNumber(D);|
  2
  !gapprompt@gap>| !gapinput@IsVertexTransitive(D);|
  false
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{HaarGraph}}
\logpage{[ 3, 5, 20 ]}\nobreak
\hyperdef{L}{X795B62398767E313}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{HaarGraph({\mdseries\slshape [filt, ]n})\index{HaarGraph@\texttt{HaarGraph}}
\label{HaarGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is a positive integer then this operation returns th\emph{Haar graph} $H(\mbox{\texttt{\mdseries\slshape n}})$. 

 The number of vertices in the Haar graph $H(\mbox{\texttt{\mdseries\slshape n}})$ is equal to twice $m$, where $m$ is the number of digits required to represent \mbox{\texttt{\mdseries\slshape n}} in binary. These vertices are arranged into bicomponents \texttt{[1..m]} and \texttt{[m+1..2*m]}. Vertices $i$ and $j$ in different bicomponents are adjacent by a symmetric pair of edges if and
only if the binary representation of \mbox{\texttt{\mdseries\slshape n}} has a 1 in position ($j-i$ modulo $m$) + 1 from the left. 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@HaarGraph(3);|
  <immutable bipartite vertex-transitive symmetric digraph with bicomponjava.lang.NullPointerException
  ents of size 2>
  !gapprompt@gap>| !gapinput@D := HaarGraph(16);|
  <immutable bipartite vertex-transitive symmetric digraph with bicomponjava.lang.NullPointerException
  ents of size 5>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{HalvedCubeGraph}}
\logpage{[ 3, 5, 21 ]}\nobreak
\hyperdef{L}{X801024F57DDC8A39}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{HalvedCubeGraph({\mdseries\slshape [filt, ]n})\index{HalvedCubeGraph@\texttt{HalvedCubeGraph}}
\label{HalvedCubeGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is a positive integer at least 1, then this operation returns the \mbox{\texttt{\mdseries\slshape n}}th \emph{halved cube graph}, the graph of th\mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}} demihypercube. The vertices of the graph are those of the \mbox{\texttt{\mdseries\slshape n}}th\texttt{\symbol{45}} hypercube, with two vertices adjacent if and only if
they are at distance 1 or 2 from each other. Equivalent constructions are as
the second graph power of the \texttt{\mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}1}th hypercube graph, or as with vertices labelled as the binary numbers where
two vertices are adjacent if they differ in a single bit, or with vertices
labelled with the subset of binary numbers with even Hamming weight, with
edges connecting vertices with Hamming distance exactly 2. The Halved Cube
graph is distance regular and contains a Hamiltonian cycle.

 See \href{https://mathworld.wolfram.com/HalvedCubeGraph.html} {\texttt{https://mathworld.wolfram.com/HalvedCubeGraph.html}} for further details.

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := HalvedCubeGraph(3);|
  <immutable Hamiltonian symmetric digraph with 4 vertices, 12 edges>
  !gapprompt@gap>| !gapinput@IsDistanceRegularDigraph(D);|
  true
  !gapprompt@gap>| !gapinput@IsHamiltonianDigraph(D);|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{HanoiGraph}}
\logpage{[ 3, 5, 22 ]}\nobreak
\hyperdef{L}{X7C43BDE47DF6553A}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{HanoiGraph({\mdseries\slshape [filt, ]n})\index{HanoiGraph@\texttt{HanoiGraph}}
\label{HanoiGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is positive integer then this operation returns the \mbox{\texttt{\mdseries\slshape n}}th \emph{Hanoi graph}. The Hanoi graph's vertices represent the possible states of the 'Tower of
Hanoi' puzzle on three 'towers', while its edges represent possible moves. The
Hanoi graph has \texttt{3\texttt{\symbol{94}}\mbox{\texttt{\mdseries\slshape n}}} vertices, and \texttt{3 * (3\texttt{\symbol{94}}\mbox{\texttt{\mdseries\slshape n}} \texttt{\symbol{45}} 1) / 2} undirected edges.

 The Hanoi graph is Hamiltonian. The graph superficially resembles the
Sierpinski triangle. The graph is also a 'penny graph' \texttt{\symbol{45}} a
graph whose vertices can be considered to be
non\texttt{\symbol{45}}overlapping unit circles on a flat surface, with two
vertices adjacent only if the unit circles touch at a single point. Thus the
Hanoi graph is planar.

 See \href{https://mathworld.wolfram.com/HanoiGraph.html} {\texttt{https://mathworld.wolfram.com/HanoiGraph.html}} for further details.

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := HanoiGraph(5);|
  <immutable planar Hamiltonian symmetric digraph with 243 vertices, 726java.lang.NullPointerException
   edges>
  !gapprompt@gap>| !gapinput@IsPlanarDigraph(D);|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{HelmGraph}}
\logpage{[ 3, 5, 23 ]}\nobreak
\hyperdef{L}{X782ABFCE812B020A}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{HelmGraph({\mdseries\slshape [filt, ]n})\index{HelmGraph@\texttt{HelmGraph}}
\label{HelmGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is a positive integer at least 3, then this operation returns the \mbox{\texttt{\mdseries\slshape n}}th \emph{helm graph}. The helm graph is the \mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}1th wheel graph with, for each external vertex of the
'wheel', adjoining a new vertex incident only to the first vertex. That is,
the graph looks similar to a ship's helm.

 See \href{https://mathworld.wolfram.com/WheelGraph.html} {\texttt{https://mathworld.wolfram.com/WheelGraph.html}} for further details.

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := HelmGraph(4);|
  <immutable symmetric digraph with 9 vertices, 24 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{HypercubeGraph}}
\logpage{[ 3, 5, 24 ]}\nobreak
\hyperdef{L}{X7EE552F88609B1A2}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{HypercubeGraph({\mdseries\slshape [filt, ]n})\index{HypercubeGraph@\texttt{HypercubeGraph}}
\label{HypercubeGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is a non\texttt{\symbol{45}}negative integer, then this operation returns the \mbox{\texttt{\mdseries\slshape n}}th \emph{hypercube graph}. The graph has \texttt{2\texttt{\symbol{94}}\mbox{\texttt{\mdseries\slshape n}}} vertices and \texttt{2\texttt{\symbol{94}}(\mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}1)\mbox{\texttt{\mdseries\slshape n}}} edges. It is formed from the vertices and edges of the \mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}dimensional hypercube. Alternatively, the graph can be
constructed by labelling each vertex with the binary numbers, with two
vertices adjacent if they have Hamming distance exactly one. The hypercube
graphs are Hamiltonian, distance\texttt{\symbol{45}}transitive and therefore
distance\texttt{\symbol{45}}regular, and bipartite.

 See \href{https://mathworld.wolfram.com/HypercubeGraph.html} {\texttt{https://mathworld.wolfram.com/HypercubeGraph.html}} for further details.

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := HypercubeGraph(5);|
  <immutable Hamiltonian bipartite symmetric digraph with bicomponents ojava.lang.NullPointerException
  f size 16>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{JohnsonDigraph}}
\logpage{[ 3, 5, 25 ]}\nobreak
\hyperdef{L}{X80ED9CE785819607}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{JohnsonDigraph({\mdseries\slshape [filt, ]n, k})\index{JohnsonDigraph@\texttt{JohnsonDigraph}}
\label{JohnsonDigraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} and \mbox{\texttt{\mdseries\slshape k}} are non\texttt{\symbol{45}}negative integers, then this operation returns a
symmetric digraph which corresponds to the undirected \emph{Johnson graph} $J(n, k)$. 

 The \emph{Johnson graph} $J(n, k)$ has vertices given by all the \mbox{\texttt{\mdseries\slshape k}}\texttt{\symbol{45}}subsets of the range \texttt{[1 .. \mbox{\texttt{\mdseries\slshape n}}]}, and two vertices are connected by an edge if and only if their intersection
has size $\mbox{\texttt{\mdseries\slshape k}} - 1$. 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gr := JohnsonDigraph(3, 1);|
  <immutable symmetric digraph with 3 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@OutNeighbours(gr);|
  [ [ 2, 3 ], [ 1, 3 ], [ 1, 2 ] ]
  !gapprompt@gap>| !gapinput@gr := JohnsonDigraph(4, 2);|
  <immutable symmetric digraph with 6 vertices, 24 edges>
  !gapprompt@gap>| !gapinput@OutNeighbours(gr);|
  [ [ 2, 3, 4, 5 ], [ 1, 3, 4, 6 ], [ 1, 2, 5, 6 ], [ 1, 2, 5, 6 ], 
    [ 1, 3, 4, 6 ], [ 2, 3, 4, 5 ] ]
  !gapprompt@gap>| !gapinput@JohnsonDigraph(1, 0);|
  <immutable empty digraph with 1 vertex>
  !gapprompt@gap>| !gapinput@JohnsonDigraph(IsMutableDigraph, 1, 0);|
  <mutable empty digraph with 1 vertex>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{KellerGraph}}
\logpage{[ 3, 5, 26 ]}\nobreak
\hyperdef{L}{X79483C677AF65688}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{KellerGraph({\mdseries\slshape [filt, ]n})\index{KellerGraph@\texttt{KellerGraph}}
\label{KellerGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is a nonnegative integer then this operation returns the \mbox{\texttt{\mdseries\slshape n}}th or \mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}dimensional \emph{Keller graph}. The graph has vertices given by the \mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}tuples on the set $[0, 1, 2, 3]$. Two vertices are adjacent if their respective tuples are such that they
differ in at least two coordinates and in at least one coordinate the
difference between the two is \texttt{2} mod \texttt{4}. The Keller graph has \texttt{4\texttt{\symbol{94}}\mbox{\texttt{\mdseries\slshape n}}} vertices.

 The Keller graphs were constructed with the intention of finding
counterexamples to Keller's conjecture (\href{https://mathworld.wolfram.com/KellersConjecture.html} {\texttt{https://mathworld.wolfram.com/KellersConjecture.html}}), and has been used since for testing maximum clique algorithms.

 If \mbox{\texttt{\mdseries\slshape n}} is 1 then the graph is empty, for \mbox{\texttt{\mdseries\slshape n}} greater than 1 the chromatic number of the Keller graph is \texttt{2\texttt{\symbol{94}}\mbox{\texttt{\mdseries\slshape n}}} and the graph is Hamiltonian.

 See \href{https://mathworld.wolfram.com/KellerGraph.html} {\texttt{https://mathworld.wolfram.com/KellerGraph.html}} for further details.

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := KellerGraph(3);|
  <immutable Hamiltonian symmetric digraph with 64 vertices, 2176 edges>
  !gapprompt@gap>| !gapinput@ChromaticNumber(D);|
  8
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{KingsGraph}}
\logpage{[ 3, 5, 27 ]}\nobreak
\hyperdef{L}{X80576A8C861512FD}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{KingsGraph({\mdseries\slshape [filt, ]m, n})\index{KingsGraph@\texttt{KingsGraph}}
\label{KingsGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape m}} and \mbox{\texttt{\mdseries\slshape n}} are positive integers, then this operation returns the \emph{king's graph} of an \mbox{\texttt{\mdseries\slshape m}} by \mbox{\texttt{\mdseries\slshape n}} chessboard, as a symmetric digraph

 The king's graph represents all possible moves of the king chess piece across
a chessboard. An \mbox{\texttt{\mdseries\slshape m}} by \mbox{\texttt{\mdseries\slshape n}} chessboard is a grid of \mbox{\texttt{\mdseries\slshape m}} columns ("files") and \mbox{\texttt{\mdseries\slshape n}} rows ("ranks") that intersect in squares. Orthogonally adjacent squares are
alternately colored light and dark, with the square in the first rank and file
being dark.

 The king can move only to any orthogonally or diagonally adjacent square. Thus
the \texttt{\mbox{\texttt{\mdseries\slshape m}} * \mbox{\texttt{\mdseries\slshape n}}} vertices of the king's graph can be placed onto the \texttt{\mbox{\texttt{\mdseries\slshape m}} * \mbox{\texttt{\mdseries\slshape n}}} squares of an \mbox{\texttt{\mdseries\slshape m}} by \mbox{\texttt{\mdseries\slshape n}} chessboard, such that two vertices are adjacent in the digraph if and only if
the corresponding squares are orthogonally or diagonally adjacent on the
chessboard. 

 The chosen correspondence between vertices and chess squares is given by \texttt{DigraphVertexLabels} (\ref{DigraphVertexLabels}). In more detail, the vertices of the digraph are labelled by elements of the
Cartesian product \texttt{[1..\mbox{\texttt{\mdseries\slshape m}}] x [1..\mbox{\texttt{\mdseries\slshape n}}]}, where the first entry indexes the column (file) of the square in the
chessboard, and the second entry indexes the row (rank) of the square. (Note
that the files are traditionally indexed by the lowercase letters of the
alphabet). The vertices are sorted in ascending order, first by row (second
component) and then column (first component). See \href{https://en.wikipedia.org/wiki/King's_graph} {Wikipedia} for further information. See also \texttt{SquareGridGraph} (\ref{SquareGridGraph}), \texttt{TriangularGridGraph} (\ref{TriangularGridGraph}), and \texttt{StrongProduct} (\ref{StrongProduct}). 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@KingsGraph(8, 8);|
  <immutable connected symmetric digraph with 64 vertices, 420 edges>
  !gapprompt@gap>| !gapinput@D := KingsGraph(IsMutable, 2, 7);|
  <mutable digraph with 14 vertices, 62 edges>
  !gapprompt@gap>| !gapinput@IsPlanarDigraph(D);|
  true
  !gapprompt@gap>| !gapinput@D := KingsGraph(3, 3);|
  <immutable planar connected symmetric digraph with 9 vertices, 40 edgejava.lang.NullPointerException
  s>
  !gapprompt@gap>| !gapinput@OutNeighbors(D);|
  [ [ 2, 4, 5 ], [ 1, 3, 5, 4, 6 ], [ 2, 6, 5 ], [ 5, 1, 7, 2, 8 ], 
    [ 4, 6, 2, 8, 3, 7, 1, 9 ], [ 5, 3, 9, 8, 2 ], [ 8, 4, 5 ], 
    [ 7, 9, 5, 6, 4 ], [ 8, 6, 5 ] ]
  !gapprompt@gap>| !gapinput@IsSubdigraph(QueensGraph(3, 4), KingsGraph(3, 4));|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{KneserGraph}}
\logpage{[ 3, 5, 28 ]}\nobreak
\hyperdef{L}{X8655BA8584B3ACD0}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{KneserGraph({\mdseries\slshape [filt, ]n, k})\index{KneserGraph@\texttt{KneserGraph}}
\label{KneserGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} and \mbox{\texttt{\mdseries\slshape k}} are integers greater than 0, with \mbox{\texttt{\mdseries\slshape k}} less than \mbox{\texttt{\mdseries\slshape n}}, then this operation returns the \texttt{(\mbox{\texttt{\mdseries\slshape n}},\mbox{\texttt{\mdseries\slshape k}})}\texttt{\symbol{45}}th \emph{Kneser graph}. The Kneser graph's vertices correspond to the \mbox{\texttt{\mdseries\slshape k}}\texttt{\symbol{45}} element subsets of a set of \mbox{\texttt{\mdseries\slshape n}} elements, with two vertices being adjacent if and only if the subsets are
disjoint. The graph has \texttt{Binomial(\mbox{\texttt{\mdseries\slshape n}}, \mbox{\texttt{\mdseries\slshape k}})} vertices and \texttt{Binomial(\mbox{\texttt{\mdseries\slshape n}}, \mbox{\texttt{\mdseries\slshape k}}) * Binomial(\mbox{\texttt{\mdseries\slshape n}} \texttt{\symbol{45}} \mbox{\texttt{\mdseries\slshape k}}, \mbox{\texttt{\mdseries\slshape k}})} edges. Kneser graphs are regular, edge transitive, and vertex transitive. If \mbox{\texttt{\mdseries\slshape k}} is 1, then the graph is the complete graph on \mbox{\texttt{\mdseries\slshape n}} vertices. If \texttt{(\mbox{\texttt{\mdseries\slshape n}}, \mbox{\texttt{\mdseries\slshape k}})} is \texttt{(2m\texttt{\symbol{45}}1, \mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}1)}, then the graph is the \texttt{m}th Odd graph. The Petersen graph is the $(5, 2)$th Kneser graph.

 If \texttt{\mbox{\texttt{\mdseries\slshape n}} {\textgreater}= 2\mbox{\texttt{\mdseries\slshape k}}} then the graph's chromatic number is \texttt{\mbox{\texttt{\mdseries\slshape n}} \texttt{\symbol{45}} 2\mbox{\texttt{\mdseries\slshape k}} + 2}, and otherwise is 1. The Kneser graph contains a Hamiltonian cycle if \texttt{\mbox{\texttt{\mdseries\slshape n}} {\textgreater}= ((3 + 5 \texttt{\symbol{94}} 0.5) / 2)\mbox{\texttt{\mdseries\slshape k}} + 1}. The graph has clique number equal to the floor of \texttt{\mbox{\texttt{\mdseries\slshape n}} / \mbox{\texttt{\mdseries\slshape k}}}.

 See \href{https://mathworld.wolfram.com/KneserGraph.html} {\texttt{https://mathworld.wolfram.com/KneserGraph.html}} for further details.

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := KneserGraph(7, 3);|
  <immutable edge- and vertex-transitive symmetric digraph with 35 vertijava.lang.NullPointerException
  ces, 140 edges>
  !gapprompt@gap>| !gapinput@IsRegularDigraph(D);|
  true
  !gapprompt@gap>| !gapinput@ChromaticNumber(D);|
  3
  !gapprompt@gap>| !gapinput@CliqueNumber(D);|
  2
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{KnightsGraph}}
\logpage{[ 3, 5, 29 ]}\nobreak
\hyperdef{L}{X84609DCA79FD9B56}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{KnightsGraph({\mdseries\slshape [filt, ]m, n})\index{KnightsGraph@\texttt{KnightsGraph}}
\label{KnightsGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape m}} and \mbox{\texttt{\mdseries\slshape n}} are positive integers, then this operation returns the \emph{knight's graph} of an \mbox{\texttt{\mdseries\slshape m}} by \mbox{\texttt{\mdseries\slshape n}} chessboard, as a symmetric digraph. 

 A knight's graph represents all possible moves of the knight chess piece
across a chessboard. An \mbox{\texttt{\mdseries\slshape m}} by \mbox{\texttt{\mdseries\slshape n}} chessboard is a grid of \mbox{\texttt{\mdseries\slshape m}} columns ("files") an\mbox{\texttt{\mdseries\slshape n}} rows ("ranks") that intersect in squares. Orthogonally adjacent squares are
alternately colored light and dark, with the square in the first rank and file
being dark.

 The \texttt{\mbox{\texttt{\mdseries\slshape m}} * \mbox{\texttt{\mdseries\slshape n}}} vertices of the knight's graph can be placed onto the \texttt{\mbox{\texttt{\mdseries\slshape m}} * \mbox{\texttt{\mdseries\slshape n}}} squares of an \mbox{\texttt{\mdseries\slshape m}} by \mbox{\texttt{\mdseries\slshape n}} chessboard, such that two vertices are adjacent in the digraph if and only if
a knight can move between the corresponding squares in a single turn. 

 The chosen correspondence between vertices and chess squares is given by \texttt{DigraphVertexLabels} (\ref{DigraphVertexLabels}). In more detail, the vertices of the digraph are labelled by elements of the
Cartesian product \texttt{[1..\mbox{\texttt{\mdseries\slshape m}}] x [1..\mbox{\texttt{\mdseries\slshape n}}]}, where the first entry indexes the column (file) of the square in the
chessboard, and the second entry indexes the row (rank) of the square. (Note
that the files are traditionally indexed by the lowercase letters of the
alphabet). The vertices are sorted in ascending order, first by row (second
component) and then column (first component). See \href{https://en.wikipedia.org/wiki/Knight's_graph} {Wikipedia} for further information. 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := KnightsGraph(8, 8);|
  <immutable connected symmetric digraph with 64 vertices, 336 edges>
  !gapprompt@gap>| !gapinput@IsConnectedDigraph(D);|
  true
  !gapprompt@gap>| !gapinput@D := KnightsGraph(3, 3);|
  <immutable symmetric digraph with 9 vertices, 16 edges>
  !gapprompt@gap>| !gapinput@IsConnectedDigraph(D);|
  false
  !gapprompt@gap>| !gapinput@KnightsGraph(IsMutable, 3, 9);|
  <mutable digraph with 27 vertices, 88 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{LindgrenSousselierGraph}}
\logpage{[ 3, 5, 30 ]}\nobreak
\hyperdef{L}{X7F61140C822880DA}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{LindgrenSousselierGraph({\mdseries\slshape [filt, ]n})\index{LindgrenSousselierGraph@\texttt{LindgrenSousselierGraph}}
\label{LindgrenSousselierGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is an integer greater than 0, then this operation returns the \mbox{\texttt{\mdseries\slshape n}}th \emph{Lindgren\texttt{\symbol{45}}Sousselier graph}, an infinite family of hyophamiltonian graphs \texttt{\symbol{45}} a graph
that is non\texttt{\symbol{45}}Hamiltonian but removing any vector gives a
Hamiltonian graph. The graph has \texttt{6\mbox{\texttt{\mdseries\slshape n}}+4} vertices and \texttt{15 + 10(\mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}1)} undirected edges. The first Lindgren\texttt{\symbol{45}}Sousselier graph is
the Petersen graph, and is in fact the smallest hyophamiltonian graph.

 See \href{https://mathworld.wolfram.com/HypohamiltonianGraph.html} {\texttt{https://mathworld.wolfram.com/HypohamiltonianGraph.html}} for further details.

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := LindgrenSousselierGraph(3);|
  <immutable symmetric digraph with 22 vertices, 70 edges>
  !gapprompt@gap>| !gapinput@IsHamiltonianDigraph(D);|
  false
  !gapprompt@gap>| !gapinput@IsHamiltonianDigraph(DigraphRemoveVertex(D, 1));|
  true
  !gapprompt@gap>| !gapinput@IsIsomorphicDigraph(LindgrenSousselierGraph(1), PetersenGraph());|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{LollipopGraph}}
\logpage{[ 3, 5, 31 ]}\nobreak
\hyperdef{L}{X832E82CF87BF5D43}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{LollipopGraph({\mdseries\slshape [filt, ]m, n})\index{LollipopGraph@\texttt{LollipopGraph}}
\label{LollipopGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape m}} and \mbox{\texttt{\mdseries\slshape n}} are positive integers, then this operation returns the \emph{(\mbox{\texttt{\mdseries\slshape m}},\mbox{\texttt{\mdseries\slshape n}})\texttt{\symbol{45}}lollipop graph}. As defined a\href{https://en.wikipedia.org/wiki/Lollipop_graph} {\texttt{https://en.wikipedia.org/wiki/Lollipop{\textunderscore}graph}}, this consists of a complete digraph on the vertices \texttt{[1..\mbox{\texttt{\mdseries\slshape m}}]} (the 'head' of the lollipop), and the symmetric closure of a chain digraph on
the remaining \mbox{\texttt{\mdseries\slshape n}} vertices (the 'stick'), connected by a bridge (the edge \texttt{[\mbox{\texttt{\mdseries\slshape m}}, \mbox{\texttt{\mdseries\slshape m}}+1]} and its reverse). 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := LollipopGraph(5, 3);|
  <immutable connected symmetric digraph with 8 vertices, 26 edges>
  !gapprompt@gap>| !gapinput@CliqueNumber(D);|
  5
  !gapprompt@gap>| !gapinput@DigraphUndirectedGirth(D);|
  3
  !gapprompt@gap>| !gapinput@LollipopGraph(IsMutableDigraph, 3, 8);|
  <mutable digraph with 11 vertices, 22 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{MobiusLadderGraph}}
\logpage{[ 3, 5, 32 ]}\nobreak
\hyperdef{L}{X853613228110588E}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{MobiusLadderGraph({\mdseries\slshape [filt, ]n})\index{MobiusLadderGraph@\texttt{MobiusLadderGraph}}
\label{MobiusLadderGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is a positive integer at least 4, then this operation returns the \emph{Mobius ladder graph} that is obtained by introducing a 'twist' in the \mbox{\texttt{\mdseries\slshape n}}th prism graph, similar to the construction of a Mobius strip. The Mobius
ladder graph is isomorphic to the circulant graph \texttt{Ci(2\mbox{\texttt{\mdseries\slshape n}}, [1, \mbox{\texttt{\mdseries\slshape n}}])}. The Mobius ladders are cubic, symmetric, Hamiltonian,
vertex\texttt{\symbol{45}}transitive, and graceful. They are also
non\texttt{\symbol{45}}planar and apex, meaning removing a single vertex
produces a planar graph.

 See \href{https://mathworld.wolfram.com/MoebiusLadder.html} {\texttt{https://mathworld.wolfram.com/MoebiusLadder.html}} for further details.

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := MobiusLadderGraph(7);|
  <immutable symmetric digraph with 14 vertices, 42 edges>
  !gapprompt@gap>| !gapinput@IsHamiltonianDigraph(D);|
  true
  !gapprompt@gap>| !gapinput@IsVertexTransitive(D);|
  true
  !gapprompt@gap>| !gapinput@IsPlanarDigraph(D);|
  false
  !gapprompt@gap>| !gapinput@D2 := DigraphRemoveVertex(D, 1);|
  <immutable digraph with 13 vertices, 36 edges>
  !gapprompt@gap>| !gapinput@IsPlanarDigraph(D2);|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{MycielskiGraph}}
\logpage{[ 3, 5, 33 ]}\nobreak
\hyperdef{L}{X825943547FD7A687}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{MycielskiGraph({\mdseries\slshape [filt, ]n})\index{MycielskiGraph@\texttt{MycielskiGraph}}
\label{MycielskiGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is an integer greater than 1, then this operation returns the \mbox{\texttt{\mdseries\slshape n}}th \emph{Mycielski graph}. The Mycielskian of a triangle\texttt{\symbol{45}}free graph is a
construction that adds vertices and edges to produce a new graph that is still
triangle\texttt{\symbol{45}}free but has a larger chromatic number. The
Mycielski graphs are a series of graphs with this construction repeated,
starting with the complete graph on two vertices. The graph has \texttt{3 * 2\texttt{\symbol{94}}(\mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}2) \texttt{\symbol{45}} 1} vertices, with the number of edges being \texttt{(18 \texttt{\symbol{45}} 27 * 2 \texttt{\symbol{94}} \mbox{\texttt{\mdseries\slshape n}} + 14 * 3 \texttt{\symbol{94}} \mbox{\texttt{\mdseries\slshape n}}) / 36}.

 The Mycielski graph has chromatic number equal to \mbox{\texttt{\mdseries\slshape n}}, clique number equal to $2$, and is Hamiltonian. The graph is in fact the graph with chromatic number \mbox{\texttt{\mdseries\slshape n}} with the least possible vertices.

 See \href{https://mathworld.wolfram.com/MycielskiGraph.html} {\texttt{https://mathworld.wolfram.com/MycielskiGraph.html}} for further details.

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := MycielskiGraph(4);|
  <immutable Hamiltonian symmetric digraph with 11 vertices, 40 edges>
  !gapprompt@gap>| !gapinput@ChromaticNumber(D);|
  4
  !gapprompt@gap>| !gapinput@CliqueNumber(D);|
  2
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{OddGraph}}
\logpage{[ 3, 5, 34 ]}\nobreak
\hyperdef{L}{X7904BB2982014ADA}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{OddGraph({\mdseries\slshape [filt, ]n})\index{OddGraph@\texttt{OddGraph}}
\label{OddGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is an integer greater than 0, then this operation returns the \mbox{\texttt{\mdseries\slshape n}}th \emph{odd graph}. The odd graph has vertices labelled with the \texttt{\mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}1}\texttt{\symbol{45}}subsets of a \texttt{2\mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}1}\texttt{\symbol{45}}set, with two vertices adjacent if and only if their
subsets are disjoint. The \mbox{\texttt{\mdseries\slshape n}}th odd graph is the \texttt{(2\mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}1, \mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}1)}\texttt{\symbol{45}}th Kneser graph. The graph has \texttt{Binomial(2\mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}1, \mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}1)} vertices and \texttt{\mbox{\texttt{\mdseries\slshape n}} * Binomial(2\mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}1, \mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}1) / 2} edges.

 The odd graph is regular and distance transitive (and therefore distance
regular). They have chromatic number equal to 3, and all Odd graphs with \mbox{\texttt{\mdseries\slshape n}} greater than 3 are Hamiltonian. They are also vertex and edge transitive.

 See \href{https://mathworld.wolfram.com/OddGraph.html} {\texttt{https://mathworld.wolfram.com/OddGraph.html}} for further details.

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := OddGraph(4);|
  <immutable edge- and vertex-transitive symmetric digraph with 35 vertijava.lang.NullPointerException
  ces, 140 edges>
  !gapprompt@gap>| !gapinput@IsIsomorphicDigraph(D, KneserGraph(7, 3));|
  true
  !gapprompt@gap>| !gapinput@ChromaticNumber(D);|
  3
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{PathGraph}}
\logpage{[ 3, 5, 35 ]}\nobreak
\hyperdef{L}{X815055168405B7F0}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{PathGraph({\mdseries\slshape [filt, ]n})\index{PathGraph@\texttt{PathGraph}}
\label{PathGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is a non\texttt{\symbol{45}}negative integer then this operation returns the \mbox{\texttt{\mdseries\slshape n}}th \emph{path graph}, consisting of the path on \mbox{\texttt{\mdseries\slshape n}} vertices. This is the symmetric closure of the \texttt{ChainDigraph} (\ref{ChainDigraph}). The path graph has \mbox{\texttt{\mdseries\slshape n}} vertices and \texttt{\mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}1} edges. The path graph is an undirected tree.

 See \href{https://mathworld.wolfram.com/PathGraph.html} {\texttt{https://mathworld.wolfram.com/PathGraph.html}} for further details.

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := PathGraph(12);|
  <immutable undirected tree with 12 vertices>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{PermutationStarGraph}}
\logpage{[ 3, 5, 36 ]}\nobreak
\hyperdef{L}{X7A38DFC47AAE4A96}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{PermutationStarGraph({\mdseries\slshape [filt, ]n, k})\index{PermutationStarGraph@\texttt{PermutationStarGraph}}
\label{PermutationStarGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is an integer at greater than 0 and \mbox{\texttt{\mdseries\slshape k}} is an integer greater than 1, and \mbox{\texttt{\mdseries\slshape k}} less than or equal to \mbox{\texttt{\mdseries\slshape n}}, then this operation returns the \texttt{(\mbox{\texttt{\mdseries\slshape n}}, \mbox{\texttt{\mdseries\slshape k}})}\texttt{\symbol{45}}th \emph{permutation star graph}. The vertices of the graph are given by the \mbox{\texttt{\mdseries\slshape k}}\texttt{\symbol{45}}length ordered subsets of an \mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}set, with two vertices being adjacent if one is labelled \texttt{p1 p2 p3 ... pi ... p\mbox{\texttt{\mdseries\slshape k}}}, and the other is either labelled \texttt{pi p2 p3 ... p1 ... p\mbox{\texttt{\mdseries\slshape k}}}, or labelled \texttt{x p2 p3 ... pi ... p\mbox{\texttt{\mdseries\slshape k}}} where \texttt{x} is in \texttt{[1..\mbox{\texttt{\mdseries\slshape n}}]} and is not equal to \texttt{p1}. The graph has \texttt{\mbox{\texttt{\mdseries\slshape n}}! / (\mbox{\texttt{\mdseries\slshape n}} \texttt{\symbol{45}} \mbox{\texttt{\mdseries\slshape k}})!} vertices.

 The permutation star graph is regular and vertex transitive. It has diameter \texttt{2\mbox{\texttt{\mdseries\slshape k}} \texttt{\symbol{45}} 1} if \mbox{\texttt{\mdseries\slshape k}} less than or equal to \texttt{Int(\mbox{\texttt{\mdseries\slshape n}} / 2)}, and diameter \texttt{Int((\mbox{\texttt{\mdseries\slshape n}} \texttt{\symbol{45}} 1) / 2) + \mbox{\texttt{\mdseries\slshape k}}} if \texttt{\mbox{\texttt{\mdseries\slshape k}} {\textgreater}= Int(\mbox{\texttt{\mdseries\slshape n}} / 2) + 1}.

 See \href{https://mathworld.wolfram.com/PermutationStarGraph.html} {\texttt{https://mathworld.wolfram.com/PermutationStarGraph.html}} for further details.

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := PermutationStarGraph(6, 2);|
  <immutable vertex-transitive symmetric digraph with 30 vertices, 150 ejava.lang.NullPointerException
  dges>
  !gapprompt@gap>| !gapinput@DigraphDiameter(D);|
  3
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{PetersenGraph}}
\logpage{[ 3, 5, 37 ]}\nobreak
\hyperdef{L}{X823F43217A6C375D}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{PetersenGraph({\mdseries\slshape [filt]})\index{PetersenGraph@\texttt{PetersenGraph}}
\label{PetersenGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 From \href{https://en.wikipedia.org/wiki/Petersen_graph} {\texttt{https://en.wikipedia.org/wiki/Petersen{\textunderscore}graph}}:

 ``The Petersen graph is an undirected graph with 10 vertices and 15 edges. It is
a small graph that serves as a useful example and counterexample for many
problems in graph theory. The Petersen graph is named after Julius Petersen,
who in 1898 constructed it to be the smallest bridgeless cubic graph with no
three\texttt{\symbol{45}}edge\texttt{\symbol{45}}coloring.''

 See also \texttt{GeneralisedPetersenGraph} (\ref{GeneralisedPetersenGraph}). 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@ChromaticNumber(PetersenGraph());|
  3
  !gapprompt@gap>| !gapinput@PetersenGraph(IsMutableDigraph);|
  <mutable digraph with 10 vertices, 30 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{GeneralisedPetersenGraph}}
\logpage{[ 3, 5, 38 ]}\nobreak
\hyperdef{L}{X7B5441F386BD105E}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{GeneralisedPetersenGraph({\mdseries\slshape [filt, ]n, k})\index{GeneralisedPetersenGraph@\texttt{GeneralisedPetersenGraph}}
\label{GeneralisedPetersenGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is a positive integer and \mbox{\texttt{\mdseries\slshape k}} is a non\texttt{\symbol{45}}negative integer less than \texttt{\mbox{\texttt{\mdseries\slshape n}} / 2}, then this operation returns the \emph{generalised Petersen graph} $GPG(\mbox{\texttt{\mdseries\slshape n}}, k)$. 

 From \href{https://en.wikipedia.org/wiki/Generalized_Petersen_graph} {\texttt{https://en.wikipedia.org/wiki/Generalized{\textunderscore}Petersen{\textunderscore}graph}}: 

 ``The generalized Petersen graphs are a family of cubic graphs formed by
connecting the vertices of a regular polygon to the corresponding vertices of
a star polygon. They include the Petersen graph and generalize one of the ways
of constructing the Petersen graph. The generalized Petersen graph family was
introduced in 1950 by H. S. M. Coxeter and was given its name in 1969 by Mark
Watkins.'' 

 See also \texttt{PetersenGraph} (\ref{PetersenGraph}). 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@GeneralisedPetersenGraph(7, 2);|
  <immutable symmetric digraph with 14 vertices, 42 edges>
  !gapprompt@gap>| !gapinput@GeneralisedPetersenGraph(40, 1);|
  <immutable symmetric digraph with 80 vertices, 240 edges>
  !gapprompt@gap>| !gapinput@D := GeneralisedPetersenGraph(5, 2);|
  <immutable symmetric digraph with 10 vertices, 30 edges>
  !gapprompt@gap>| !gapinput@IsIsomorphicDigraph(D, PetersenGraph());|
  true
  !gapprompt@gap>| !gapinput@GeneralisedPetersenGraph(IsMutableDigraph, 9, 4);|
  <mutable digraph with 18 vertices, 54 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{PrismGraph}}
\logpage{[ 3, 5, 39 ]}\nobreak
\hyperdef{L}{X85425DC5847E6D20}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{PrismGraph({\mdseries\slshape [filt, ]n})\index{PrismGraph@\texttt{PrismGraph}}
\label{PrismGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is a positive integer at least 3, then this operation returns the \emph{prism graph} that is the skeleton of the \mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}prism. It has \texttt{2\mbox{\texttt{\mdseries\slshape n}}} vertices and \texttt{3\mbox{\texttt{\mdseries\slshape n}}} undirected edges. The prism graph is a symmetric digraph. The \mbox{\texttt{\mdseries\slshape n}}th prism graph is isomorphic to the graph Cartesian product of the second path
graph and the \mbox{\texttt{\mdseries\slshape n}}th cycle graph, isomorphic to the generalised Petersen graph \texttt{GP(\mbox{\texttt{\mdseries\slshape n}},1)}. If \mbox{\texttt{\mdseries\slshape n}} is odd then the prism graph is isomorphic to the Circulant graph \texttt{Ci(2\mbox{\texttt{\mdseries\slshape n}}, [2,\mbox{\texttt{\mdseries\slshape n}}])}. The prism graph is Hamiltonian.

 See \href{https://mathworld.wolfram.com/PrismGraph.html} {\texttt{https://mathworld.wolfram.com/PrismGraph.html}} for further details.

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := PrismGraph(4);|
  <immutable symmetric digraph with 8 vertices, 24 edges>
  !gapprompt@gap>| !gapinput@IsHamiltonianDigraph(D);|
  true
  !gapprompt@gap>| !gapinput@D := PrismGraph(5);|
  <immutable symmetric digraph with 10 vertices, 30 edges>
  !gapprompt@gap>| !gapinput@IsIsomorphicDigraph(D, CirculantGraph(10, [2, 5]));|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{StackedPrismGraph}}
\logpage{[ 3, 5, 40 ]}\nobreak
\hyperdef{L}{X817982877B48D5BD}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{StackedPrismGraph({\mdseries\slshape [filt, ]n, k})\index{StackedPrismGraph@\texttt{StackedPrismGraph}}
\label{StackedPrismGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is an integer at least 3 and \mbox{\texttt{\mdseries\slshape k}} is a positive integer then this operation returns the \texttt{(\mbox{\texttt{\mdseries\slshape n}},\mbox{\texttt{\mdseries\slshape k}})}\texttt{\symbol{45}}th \emph{stacked prism graph}. The graph is \mbox{\texttt{\mdseries\slshape k}} concentric \mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}Cycle graphs connected by spokes. The stacked prism is the
graph Cartesian product of the \mbox{\texttt{\mdseries\slshape n}}th cycle graph and the \mbox{\texttt{\mdseries\slshape k}}th path graph. The graph has \texttt{\mbox{\texttt{\mdseries\slshape n}}\mbox{\texttt{\mdseries\slshape k}}} vertices and \texttt{\mbox{\texttt{\mdseries\slshape n}}(2\mbox{\texttt{\mdseries\slshape k}} \texttt{\symbol{45}} 1)} undirected edges. If \mbox{\texttt{\mdseries\slshape k}} is 1 then the graph is the \mbox{\texttt{\mdseries\slshape n}}th cycle graph, if \mbox{\texttt{\mdseries\slshape k}} is 2 then the graph is the prism graph. 

 See \href{https://mathworld.wolfram.com/StackedPrismGraph.html} {\texttt{https://mathworld.wolfram.com/StackedPrismGraph.html}} for further details.

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := StackedPrismGraph(5, 2);|
  <immutable symmetric digraph with 10 vertices, 30 edges>
  !gapprompt@gap>| !gapinput@IsIsomorphicDigraph(D, PrismGraph(5));|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{QueensGraph}}
\logpage{[ 3, 5, 41 ]}\nobreak
\hyperdef{L}{X785C3F1F7D690151}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{QueensGraph({\mdseries\slshape [filt, ]m, n})\index{QueensGraph@\texttt{QueensGraph}}
\label{QueensGraph}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{QueenGraph({\mdseries\slshape [filt, ]m, n})\index{QueenGraph@\texttt{QueenGraph}}
\label{QueenGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape m}} and \mbox{\texttt{\mdseries\slshape n}} are positive integers, then this operation returns the \emph{queen's graph} of an \mbox{\texttt{\mdseries\slshape m}} by \mbox{\texttt{\mdseries\slshape n}} chessboard, as a symmetric digraph. 

 The queen's graph represents all possible moves of the queen chess piece
across a chessboard. An \mbox{\texttt{\mdseries\slshape m}} by \mbox{\texttt{\mdseries\slshape n}} chessboard is a grid of \mbox{\texttt{\mdseries\slshape m}} columns ("files") an\mbox{\texttt{\mdseries\slshape n}} rows ("ranks") that intersect in squares. Orthogonally adjacent squares are
alternately colored light and dark, with the square in the first rank and file
being dark.

 The \texttt{\mbox{\texttt{\mdseries\slshape m}} * \mbox{\texttt{\mdseries\slshape n}}} vertices of the queen's graph can be placed onto the \texttt{\mbox{\texttt{\mdseries\slshape m}} * \mbox{\texttt{\mdseries\slshape n}}} squares of an \mbox{\texttt{\mdseries\slshape m}} by \mbox{\texttt{\mdseries\slshape n}} chessboard, such that two vertices are adjacent in the digraph if and only if
the queen can move between the corresponding squares in a single turn. A legal
queen's move is defined as one which moves the queen to an (orthogonally or
diagonally) adjacent square, or to a square which can be reached through a
series of such moves, with all of the small moves being in the same direction. 

 Note that the \texttt{QueensGraph} is the \texttt{DigraphEdgeUnion} (\ref{DigraphEdgeUnion:for a list of digraphs}) of the \texttt{RooksGraph} (\ref{RooksGraph}) and the \texttt{BishopsGraph} (\ref{BishopsGraph}) of the same dimensions. 

 The chosen correspondence between vertices and chess squares is given by \texttt{DigraphVertexLabels} (\ref{DigraphVertexLabels}). In more detail, the vertices of the digraph are labelled by elements of the
Cartesian product \texttt{[1..\mbox{\texttt{\mdseries\slshape m}}] x [1..\mbox{\texttt{\mdseries\slshape n}}]}, where the first entry indexes the column (file) of the square in the
chessboard, and the second entry indexes the row (rank) of the square. (Note
that the files are traditionally indexed by the lowercase letters of the
alphabet). The vertices are sorted in ascending order, first by row (second
component) and then column (first component). If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@QueensGraph(2, 5);|
  <immutable connected symmetric digraph with 10 vertices, 66 edges>
  !gapprompt@gap>| !gapinput@D := QueensGraph(4, 3);|
  <immutable connected symmetric digraph with 12 vertices, 92 edges>
  !gapprompt@gap>| !gapinput@IsRegularDigraph(D);|
  false
  !gapprompt@gap>| !gapinput@QueensGraph(6, 9) =|
  !gapprompt@>| !gapinput@   DigraphEdgeUnion(RooksGraph(6, 9), BishopsGraph(6, 9));|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{RooksGraph}}
\logpage{[ 3, 5, 42 ]}\nobreak
\hyperdef{L}{X7A6DD11881874F51}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{RooksGraph({\mdseries\slshape [filt, ]m, n})\index{RooksGraph@\texttt{RooksGraph}}
\label{RooksGraph}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{RookGraph({\mdseries\slshape [filt, ]m, n})\index{RookGraph@\texttt{RookGraph}}
\label{RookGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape m}} and \mbox{\texttt{\mdseries\slshape n}} are positive integers, then this operation returns the \emph{rook's graph} of an \mbox{\texttt{\mdseries\slshape m}} by \mbox{\texttt{\mdseries\slshape n}} chessboard, as a symmetric digraph

 A rook's graph represents all possible moves of the rook chess piece across a
chessboard. An \mbox{\texttt{\mdseries\slshape m}} by \mbox{\texttt{\mdseries\slshape n}} chessboard is a grid of \mbox{\texttt{\mdseries\slshape m}} columns ("files") and \mbox{\texttt{\mdseries\slshape n}} rows ("ranks") that intersect in squares. Orthogonally adjacent squares are
alternately colored light and dark, with the square in the first rank and file
being dark.

 The \texttt{\mbox{\texttt{\mdseries\slshape m}} * \mbox{\texttt{\mdseries\slshape n}}} vertices of the rook's graph can be placed onto the \texttt{\mbox{\texttt{\mdseries\slshape m}} * \mbox{\texttt{\mdseries\slshape n}}} squares of an \mbox{\texttt{\mdseries\slshape m}} by \mbox{\texttt{\mdseries\slshape n}} chessboard, such that two vertices are adjacent in the digraph if and only if
a rook can move between the corresponding squares in a single turn. A legal
rook's move is defined as one which moves the rook to an orthogonally adjacent
square, or to a square which can be reached through a series of such moves,
with all of the small moves being in the same direction. 

 The chosen correspondence between vertices and chess squares is given by \texttt{DigraphVertexLabels} (\ref{DigraphVertexLabels}). In more detail, the vertices of the digraph are labelled by elements of the
Cartesian product \texttt{[1..\mbox{\texttt{\mdseries\slshape m}}] x [1..\mbox{\texttt{\mdseries\slshape n}}]}, where the first entry indexes the column (file) of the square in the
chessboard, and the second entry indexes the row (rank) of the square. (Note
that the files are traditionally indexed by the lowercase letters of the
alphabet). The vertices are sorted in ascending order, first by row (second
component) and then column (first component). See \href{https://en.wikipedia.org/wiki/Rook's_graph} {Wikipedia} for further information. See also \texttt{DigraphCartesianProduct} (\ref{DigraphCartesianProduct:for a list of digraphs}) and \texttt{LineDigraph} (\ref{LineDigraph}). 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := RooksGraph(7, 4);|
  <immutable connected regular symmetric digraph with 28 vertices, 252 ejava.lang.NullPointerException
  dges>
  !gapprompt@gap>| !gapinput@RooksGraph(1, 8);|
  <immutable connected regular symmetric digraph with 8 vertices, 56 edgjava.lang.NullPointerException
  es>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{SquareGridGraph}}
\logpage{[ 3, 5, 43 ]}\nobreak
\hyperdef{L}{X8404987F849D7CF2}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{SquareGridGraph({\mdseries\slshape [filt, ]n, k})\index{SquareGridGraph@\texttt{SquareGridGraph}}
\label{SquareGridGraph}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{GridGraph({\mdseries\slshape [filt, ]n, k})\index{GridGraph@\texttt{GridGraph}}
\label{GridGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} and \mbox{\texttt{\mdseries\slshape k}} are positive integers, then this operation returns a square grid graph of
dimension \mbox{\texttt{\mdseries\slshape n}} by \mbox{\texttt{\mdseries\slshape k}}. 

 A \emph{square grid graph} of dimension \mbox{\texttt{\mdseries\slshape n}} by \mbox{\texttt{\mdseries\slshape k}} is the \texttt{DigraphCartesianProduct} (\ref{DigraphCartesianProduct:for a positive number of digraphs}) of the symmetric closures of the chain digraphs with \mbox{\texttt{\mdseries\slshape n}} and \mbox{\texttt{\mdseries\slshape k}} vertices; see \texttt{DigraphSymmetricClosure} (\ref{DigraphSymmetricClosure}) and \texttt{ChainDigraph} (\ref{ChainDigraph}). 

 In particular, the \texttt{\mbox{\texttt{\mdseries\slshape n}} * \mbox{\texttt{\mdseries\slshape k}}} vertices can be arranged into an \mbox{\texttt{\mdseries\slshape n}} by \mbox{\texttt{\mdseries\slshape k}} grid such that two vertices are adjacent in the digraph if and only if they
are orthogonally adjacent in the grid. The correspondence between vertices and
grid positions is given by \texttt{DigraphVertexLabels} (\ref{DigraphVertexLabels}). 

 See \href{https://en.wikipedia.org/wiki/Lattice_graph} {\texttt{https://en.wikipedia.org/wiki/Lattice{\textunderscore}graph}} for more information. 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@SquareGridGraph(5, 5);|
  <immutable planar connected bipartite symmetric digraph with bicomponejava.lang.NullPointerException
  nt sizes 13 and 12>
  !gapprompt@gap>| !gapinput@GridGraph(IsMutable, 3, 4);|
  <mutable digraph with 12 vertices, 34 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{TriangularGridGraph}}
\logpage{[ 3, 5, 44 ]}\nobreak
\hyperdef{L}{X8234361278E8816F}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{TriangularGridGraph({\mdseries\slshape [filt, ]n, k})\index{TriangularGridGraph@\texttt{TriangularGridGraph}}
\label{TriangularGridGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} and \mbox{\texttt{\mdseries\slshape k}} are positive integers, then this operation returns a triangular grid graph of
dimension \mbox{\texttt{\mdseries\slshape n}} by \mbox{\texttt{\mdseries\slshape k}}. 

 A \emph{triangular grid graph} of dimension \mbox{\texttt{\mdseries\slshape n}} by \mbox{\texttt{\mdseries\slshape k}} is a symmetric digraph constructed from the \texttt{SquareGridGraph} (\ref{SquareGridGraph}) of the same dimensions, where additionally two vertices are adjacent in the
digraph if they are diagonally adjacent in the grid, on a particular one of
the diagonals. The correspondence between vertices and grid positions is given
by \texttt{DigraphVertexLabels} (\ref{DigraphVertexLabels}). More specifically, the particular diagonal is the one such that, the
vertices corresponding to the grid positions \texttt{[2,1]} and \texttt{[1,2]} are adjacent (if they exist), but those corresponding to \texttt{[1,1]} and \texttt{[2,2]} are not. 

 See \href{https://en.wikipedia.org/wiki/Lattice_graph#Other_kinds} {\texttt{https://en.wikipedia.org/wiki/Lattice{\textunderscore}graph\#Other{\textunderscore}kinds}} for more information. 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@TriangularGridGraph(3, 3);|
  <immutable planar connected symmetric digraph with 9 vertices, 32 edgejava.lang.NullPointerException
  s>
  !gapprompt@gap>| !gapinput@TriangularGridGraph(IsMutable, 3, 3);|
  <mutable digraph with 9 vertices, 32 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{StarGraph}}
\logpage{[ 3, 5, 45 ]}\nobreak
\hyperdef{L}{X78F78C077CBAE1EC}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{StarGraph({\mdseries\slshape [filt, ]k})\index{StarGraph@\texttt{StarGraph}}
\label{StarGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape k}} is a positive integer, then this operation returns the \emph{star graph} with \mbox{\texttt{\mdseries\slshape k}} vertices, which is the undirected tree in which vertex \texttt{1} is adjacent to all other vertices. If \mbox{\texttt{\mdseries\slshape k}} is at least \texttt{2}, then this is the complete bipartite digraph with bicomponents \texttt{[1]} and \texttt{[2 .. \mbox{\texttt{\mdseries\slshape k}}]}. 

 See \texttt{IsUndirectedTree} (\ref{IsUndirectedTree}), \texttt{IsCompleteBipartiteDigraph} (\ref{IsCompleteBipartiteDigraph}), and \texttt{DigraphBicomponents} (\ref{DigraphBicomponents}). 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@StarGraph(IsMutable, 10);|
  <mutable digraph with 10 vertices, 18 edges>
  !gapprompt@gap>| !gapinput@StarGraph(5);|
  <immutable complete bipartite digraph with bicomponent sizes 1 and 4>
  !gapprompt@gap>| !gapinput@IsSymmetricDigraph(StarGraph(3));|
  true
  !gapprompt@gap>| !gapinput@IsUndirectedTree(StarGraph(3));|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{TadpoleGraph}}
\logpage{[ 3, 5, 46 ]}\nobreak
\hyperdef{L}{X81D59C4D809F4AD3}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{TadpoleGraph({\mdseries\slshape [filt, ]m, n})\index{TadpoleGraph@\texttt{TadpoleGraph}}
\label{TadpoleGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 The \emph{tadpole graph} is the symmetric closure of the disjoint union of the cycle digraph on \texttt{[1..\mbox{\texttt{\mdseries\slshape m}}]} (the 'head' of the tadpole) and the chain digraph on \texttt{[\mbox{\texttt{\mdseries\slshape m}}+1..\mbox{\texttt{\mdseries\slshape m}}+\mbox{\texttt{\mdseries\slshape n}}]} (the 'tail' of the tadpole), along with the additional edges \texttt{[1, \mbox{\texttt{\mdseries\slshape m}}+1]} and \texttt{[1, \mbox{\texttt{\mdseries\slshape m}}+1]} which connect the 'head' and the 'tail'. For more details on the tadpole graph
please refer to \href{https://en.wikipedia.org/wiki/Tadpole_graph} {\texttt{https://en.wikipedia.org/wiki/Tadpole{\textunderscore}graph}}.

 See \texttt{DigraphSymmetricClosure} (\ref{DigraphSymmetricClosure}), \texttt{DigraphDisjointUnion} (\ref{DigraphDisjointUnion:for a list of digraphs}), \texttt{CycleDigraph} (\ref{CycleDigraph}), and \texttt{ChainDigraph} (\ref{ChainDigraph}). 

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@TadpoleGraph(10, 15);|
  <immutable symmetric digraph with 25 vertices, 50 edges>
  !gapprompt@gap>| !gapinput@TadpoleGraph(IsMutableDigraph, 5, 6);|
  <mutable digraph with 11 vertices, 22 edges>
  !gapprompt@gap>| !gapinput@IsSymmetricDigraph(TadpoleGraph(3, 5));|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{WalshHadamardGraph}}
\logpage{[ 3, 5, 47 ]}\nobreak
\hyperdef{L}{X7BFA33067F83F8B0}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{WalshHadamardGraph({\mdseries\slshape [filt, ]n})\index{WalshHadamardGraph@\texttt{WalshHadamardGraph}}
\label{WalshHadamardGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is a positive integer at least 1, then this operation returns the \emph{Hadamard graph} constructed from the \mbox{\texttt{\mdseries\slshape n}}th Hadamard matrix (of dimension \texttt{2\texttt{\symbol{94}}\mbox{\texttt{\mdseries\slshape n}}}) as constructed by Joseph Walsh. A Hadamard matrix is a square matrix with
entries either $1$ or $-1$, such that all the rows are mutually orthogonal. The \mbox{\texttt{\mdseries\slshape n}}th Walsh Hadamard graph is a graph on \texttt{4\mbox{\texttt{\mdseries\slshape n}}} matrices split into four categories $r_i+, r_i-, c_i+, c_i-$. If $h_ij$ are the elements of the \mbox{\texttt{\mdseries\slshape n}}th Walsh matrix, then if $h_ij = 1$ then $(r_i+, c_j+)$ and $(r_i-, c_j-)$ are edges, if $h_ij = -1$ then $(r_i+, c_j-)$ and $(r_i-, c_j+)$ are edges. Walsh Hadamard graphs are distance transitive and distance regular.

 See \href{https://mathworld.wolfram.com/HadamardGraph.html} {\texttt{https://mathworld.wolfram.com/HadamardGraph.html}} for further details.

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := WalshHadamardGraph(5);|
  <immutable symmetric digraph with 64 vertices, 1024 edges>
  !gapprompt@gap>| !gapinput@IsDistanceRegularDigraph(D);|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{WebGraph}}
\logpage{[ 3, 5, 48 ]}\nobreak
\hyperdef{L}{X84F3B70A82EEE780}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{WebGraph({\mdseries\slshape [filt, ]n})\index{WebGraph@\texttt{WebGraph}}
\label{WebGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is an integer at least 3 then this operation returns the \mbox{\texttt{\mdseries\slshape n}}th \emph{web graph}. The web graph is the \texttt{(\mbox{\texttt{\mdseries\slshape n}},3)}\texttt{\symbol{45}}th stacked prism graph with the edges of the outer cycle
removed. The graph has \texttt{3\mbox{\texttt{\mdseries\slshape n}}} vertices and \texttt{4\mbox{\texttt{\mdseries\slshape n}}} undirected edges.

 See \href{https://mathworld.wolfram.com/WebGraph.html} {\texttt{https://mathworld.wolfram.com/WebGraph.html}} for further details.

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := WebGraph(5);|
  <immutable symmetric digraph with 15 vertices, 40 edges>
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{WheelGraph}}
\logpage{[ 3, 5, 49 ]}\nobreak
\hyperdef{L}{X817EA60D828A765E}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{WheelGraph({\mdseries\slshape [filt, ]n})\index{WheelGraph@\texttt{WheelGraph}}
\label{WheelGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} is a positive integer at least 4, then this operation returns the \mbox{\texttt{\mdseries\slshape n}}th \emph{wheel graph}. The Wheel graph is formed from an \texttt{\mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}1} cycle graph with a single additional vertex adjacent to all vertices of the
cycle. The graph has \mbox{\texttt{\mdseries\slshape n}} vertices and \texttt{2(\mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}1)} edges. Wheel graphs are the skeletons of \texttt{\mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}1} pyramids, and are self\texttt{\symbol{45}}dual. If \mbox{\texttt{\mdseries\slshape n}} is odd, then the chromatic number of the wheel graph is 3 and the Wheel graph
is perfect, and it is 4 otherwise. The wheel graph is also Hamiltonian and
planar.

 See \href{https://mathworld.wolfram.com/WheelGraph.html} {\texttt{https://mathworld.wolfram.com/WheelGraph.html}} for further details.

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := WheelGraph(8);;|
  !gapprompt@gap>| !gapinput@ChromaticNumber(D);|
  4
  !gapprompt@gap>| !gapinput@IsHamiltonianDigraph(D);|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{WindmillGraph}}
\logpage{[ 3, 5, 50 ]}\nobreak
\hyperdef{L}{X7BE44CA27AA5F8DB}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{WindmillGraph({\mdseries\slshape [filt, ]n, m})\index{WindmillGraph@\texttt{WindmillGraph}}
\label{WindmillGraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A digraph.



 If \mbox{\texttt{\mdseries\slshape n}} and \mbox{\texttt{\mdseries\slshape m}} are integers greater than 1 then this operation returns the \texttt{(\mbox{\texttt{\mdseries\slshape n}}, \mbox{\texttt{\mdseries\slshape m}})}\texttt{\symbol{45}}th \emph{windmill graph}. The windmill graph is formed from \mbox{\texttt{\mdseries\slshape m}} copies of the complete graph on \mbox{\texttt{\mdseries\slshape n}} vertices with one shared vertex. The graph has \texttt{\mbox{\texttt{\mdseries\slshape m}}(\mbox{\texttt{\mdseries\slshape n}} \texttt{\symbol{45}} 1) + 1} vertices and \texttt{\mbox{\texttt{\mdseries\slshape m}} * \mbox{\texttt{\mdseries\slshape n}} * (\mbox{\texttt{\mdseries\slshape n}} \texttt{\symbol{45}} 1) / 2} undirected edges. The windmill graph has chromatic number \mbox{\texttt{\mdseries\slshape n}} and diameter 2.

 See \href{https://mathworld.wolfram.com/WindmillGraph.html} {\texttt{https://mathworld.wolfram.com/WindmillGraph.html}} for further details.

 If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is present, then this should specify the category or representation the
digraph being created will belong to. For example, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsMutableDigraph} (\ref{IsMutableDigraph}), then the digraph being created will be mutable, if \mbox{\texttt{\mdseries\slshape filt}} is \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}), then the digraph will be immutable. If the optional first argument \mbox{\texttt{\mdseries\slshape filt}} is not present, then \texttt{IsImmutableDigraph} (\ref{IsImmutableDigraph}) is used by default.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := WindmillGraph(4, 3);|
  <immutable symmetric digraph with 10 vertices, 36 edges>
  !gapprompt@gap>| !gapinput@ChromaticNumber(D);|
  4
\end{Verbatim}
 }

 }

 }

 
\chapter{\textcolor{Chapter }{Operators}}\label{Operators}
\logpage{[ 4, 0, 0 ]}
\hyperdef{L}{X7AD6F77E7D95C996}{}
{
 
\section{\textcolor{Chapter }{Operators for digraphs}}\logpage{[ 4, 1, 0 ]}
\hyperdef{L}{X84E0B5B88358C96B}{}
{
 
\begin{description}
\item[{\texttt{\mbox{\texttt{\mdseries\slshape digraph1}} = \mbox{\texttt{\mdseries\slshape digraph2}}}}]  \index{=@\texttt{=} (for digraphs)} returns \texttt{true} if \mbox{\texttt{\mdseries\slshape digraph1}} and \mbox{\texttt{\mdseries\slshape digraph2}} have the same vertices, and \texttt{DigraphEdges(\mbox{\texttt{\mdseries\slshape digraph1}}) = DigraphEdges(\mbox{\texttt{\mdseries\slshape digraph2}})}, up to some re\texttt{\symbol{45}}ordering of the edge lists. 

 Note that this operator does not compare the vertex labels of \mbox{\texttt{\mdseries\slshape digraph1}} and \mbox{\texttt{\mdseries\slshape digraph2}}. 
\item[{\texttt{\mbox{\texttt{\mdseries\slshape digraph1}} {\textless\mbox{\texttt{\mdseries\slshape digraph2}}}}]  \index{<@\texttt{{\textless}} (for digraphs)} This operator returns \texttt{true} if one of the following holds: 
\begin{itemize}
\item  The number $n_1$ of vertices in \mbox{\texttt{\mdseries\slshape digraph1}} is less than the number $n_2$ of vertices in \mbox{\texttt{\mdseries\slshape digraph2}}; 
\item  $n_1 = n_2$, and the number $m_1$ of edges in \mbox{\texttt{\mdseries\slshape digraph1}} is less than the number $m_2$ of edges in \mbox{\texttt{\mdseries\slshape digraph2}}; 
\item  $n_1 = n_2$, $m_1 = m_2$, and \texttt{DigraphEdges(\mbox{\texttt{\mdseries\slshape digraph1}})} is less than \texttt{DigraphEdges(\mbox{\texttt{\mdseries\slshape digraph2}})} after having both of these sets have been sorted with respect to the
lexicographical order. 
\end{itemize}
 
\end{description}
 

\subsection{\textcolor{Chapter }{IsSubdigraph}}
\logpage{[ 4, 1, 1 ]}\nobreak
\hyperdef{L}{X829B911D7EFD2D85}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{IsSubdigraph({\mdseries\slshape super, sub})\index{IsSubdigraph@\texttt{IsSubdigraph}}
\label{IsSubdigraph}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
\texttt{true} or \texttt{false}.



 If \mbox{\texttt{\mdseries\slshape super}} and \mbox{\texttt{\mdseries\slshape sub}} are digraphs, then this operation returns \texttt{true} if \mbox{\texttt{\mdseries\slshape sub}} is a subdigraph of \mbox{\texttt{\mdseries\slshape super}}, and \texttt{false} if it is not. 

 A digraph \mbox{\texttt{\mdseries\slshape sub}} is a \emph{subdigraph} of a digraph \mbox{\texttt{\mdseries\slshape super}} if \mbox{\texttt{\mdseries\slshape sub}} and \mbox{\texttt{\mdseries\slshape super}} share the same number of vertices, and the collection of edges of \mbox{\texttt{\mdseries\slshape super}} (including repeats) contains the collection of edges of \mbox{\texttt{\mdseries\slshape sub}} (including repeats). 

 In other words, \mbox{\texttt{\mdseries\slshape sub}} is a subdigraph of \mbox{\texttt{\mdseries\slshape super}} if and only if \texttt{DigraphNrVertices(\mbox{\texttt{\mdseries\slshape sub}}) = DigraphNrVertices(\mbox{\texttt{\mdseries\slshape super}})}, and for each pair of vertices \texttt{i} and \texttt{j}, there are at least as many edges of the form \texttt{[i, j]} in \mbox{\texttt{\mdseries\slshape super}} as there are in \mbox{\texttt{\mdseries\slshape sub}}. 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@g := Digraph([[2, 3], [1], [2, 3]]);|
  <immutable digraph with 3 vertices, 5 edges>
  !gapprompt@gap>| !gapinput@h := Digraph([[2, 3], [], [2]]);|
  <immutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@IsSubdigraph(g, h);|
  true
  !gapprompt@gap>| !gapinput@IsSubdigraph(h, g);|
  false
  !gapprompt@gap>| !gapinput@IsSubdigraph(CompleteDigraph(4), CycleDigraph(4));|
  true
  !gapprompt@gap>| !gapinput@IsSubdigraph(CycleDigraph(4), ChainDigraph(4));|
  true
  !gapprompt@gap>| !gapinput@g := Digraph([[2, 2], [1]]);|
  <immutable multidigraph with 2 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@h := Digraph([[2], [1]]);|
  <immutable digraph with 2 vertices, 2 edges>
  !gapprompt@gap>| !gapinput@IsSubdigraph(g, h);|
  true
  !gapprompt@gap>| !gapinput@IsSubdigraph(h, g);|
  false
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{IsUndirectedSpanningTree}}
\logpage{[ 4, 1, 2 ]}\nobreak
\hyperdef{L}{X833C3299787E2309}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{IsUndirectedSpanningTree({\mdseries\slshape super, sub})\index{IsUndirectedSpanningTree@\texttt{IsUndirectedSpanningTree}}
\label{IsUndirectedSpanningTree}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{IsUndirectedSpanningForest({\mdseries\slshape super, sub})\index{IsUndirectedSpanningForest@\texttt{IsUndirectedSpanningForest}}
\label{IsUndirectedSpanningForest}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
\texttt{true} or \texttt{false}.



 The operation \texttt{IsUndirectedSpanningTree} returns \texttt{true} if the digraph \mbox{\texttt{\mdseries\slshape sub}} is an undirected spanning tree of the digraph \mbox{\texttt{\mdseries\slshape super}}, and the operation \texttt{IsUndirectedSpanningForest} returns \texttt{true} if the digraph \mbox{\texttt{\mdseries\slshape sub}} is an undirected spanning forest of the digraph \mbox{\texttt{\mdseries\slshape super}}. 

 An \emph{undirected spanning tree} of a digraph \mbox{\texttt{\mdseries\slshape super}} is a subdigraph of \mbox{\texttt{\mdseries\slshape super}} that is an undirected tree (see \texttt{IsSubdigraph} (\ref{IsSubdigraph}) and \texttt{IsUndirectedTree} (\ref{IsUndirectedTree})). Note that a digraph whose \texttt{MaximalSymmetricSubdigraph} (\ref{MaximalSymmetricSubdigraph}) is not connected has no undirected spanning trees (see \texttt{IsConnectedDigraph} (\ref{IsConnectedDigraph})). 

 An \emph{undirected spanning forest} of a digraph \mbox{\texttt{\mdseries\slshape super}} is a subdigraph of \mbox{\texttt{\mdseries\slshape super}} that is an undirected forest (se\texttt{IsSubdigraph} (\ref{IsSubdigraph}) and \texttt{IsUndirectedForest} (\ref{IsUndirectedForest})), and is not contained in any larger such subdigraph of \mbox{\texttt{\mdseries\slshape super}}. Equivalently, an undirected spanning forest is a subdigraph of \mbox{\texttt{\mdseries\slshape super}} whose connected components coincide with those of the \texttt{MaximalSymmetricSubdigraph} (\ref{MaximalSymmetricSubdigraph}) of \mbox{\texttt{\mdseries\slshape super}} (see \texttt{DigraphConnectedComponents} (\ref{DigraphConnectedComponents})). 

 Note that an undirected spanning tree is an undirected spanning forest that is
connected. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := CompleteDigraph(4);|
  <immutable complete digraph with 4 vertices>
  !gapprompt@gap>| !gapinput@tree := Digraph([[3], [4], [1, 4], [2, 3]]);|
  <immutable digraph with 4 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@IsSubdigraph(D, tree) and IsUndirectedTree(tree);|
  true
  !gapprompt@gap>| !gapinput@IsUndirectedSpanningTree(D, tree);|
  true
  !gapprompt@gap>| !gapinput@forest := EmptyDigraph(4);|
  <immutable empty digraph with 4 vertices>
  !gapprompt@gap>| !gapinput@IsSubdigraph(D, forest) and IsUndirectedForest(forest);|
  true
  !gapprompt@gap>| !gapinput@IsUndirectedSpanningForest(D, forest);|
  false
  !gapprompt@gap>| !gapinput@IsSubdigraph(tree, forest);|
  true
  !gapprompt@gap>| !gapinput@D := DigraphDisjointUnion(CycleDigraph(2), CycleDigraph(2));|
  <immutable digraph with 4 vertices, 4 edges>
  !gapprompt@gap>| !gapinput@IsUndirectedTree(D);|
  false
  !gapprompt@gap>| !gapinput@IsUndirectedForest(D) and IsUndirectedSpanningForest(D, D);|
  true
\end{Verbatim}
 }

 }

 }

 
\chapter{\textcolor{Chapter }{Attributes and operations}}\label{Attributes and operations}
\logpage{[ 5, 0, 0 ]}
\hyperdef{L}{X8739F6CD78C90B14}{}
{
 
\section{\textcolor{Chapter }{Vertices and edges}}\logpage{[ 5, 1, 0 ]}
\hyperdef{L}{X7E814B6478F7D015}{}
{
 

\subsection{\textcolor{Chapter }{DigraphVertices}}
\logpage{[ 5, 1, 1 ]}\nobreak
\hyperdef{L}{X7C45F7D878D896AC}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphVertices({\mdseries\slshape digraph})\index{DigraphVertices@\texttt{DigraphVertices}}
\label{DigraphVertices}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A list of positive integers.



 Returns the vertices of the digraph \mbox{\texttt{\mdseries\slshape digraph}}. 

 Note that the vertices of a digraph are always the range of positive integers
from \texttt{1} to the number of vertices of the graph, \texttt{DigraphNrVertices} (\ref{DigraphNrVertices}). Arbitrary \emph{labels} can be assigned to the vertices of a digraph; see \texttt{DigraphVertexLabels} (\ref{DigraphVertexLabels}) for more information about this
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gr := Digraph(["a""b""c"],|
  !gapprompt@>| !gapinput@                 ["a""b""b"],|
  !gapprompt@>| !gapinput@                 ["b""c""a"]);|
  <immutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphVertices(gr);|
  [ 1 .. 3 ]
  !gapprompt@gap>| !gapinput@gr := Digraph([1, 2, 3, 4, 5, 7],|
  !gapprompt@>| !gapinput@                 [1, 2, 2, 4, 4],|
  !gapprompt@>| !gapinput@                 [2, 7, 5, 3, 7]);|
  <immutable digraph with 6 vertices, 5 edges>
  !gapprompt@gap>| !gapinput@DigraphVertices(gr);|
  [ 1 .. 6 ]
  !gapprompt@gap>| !gapinput@DigraphVertices(RandomDigraph(100));|
  [ 1 .. 100 ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphVertices(D);|
  [ 1 .. 3 ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphNrVertices}}
\logpage{[ 5, 1, 2 ]}\nobreak
\hyperdef{L}{X7C6F19B57CB2E882}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphNrVertices({\mdseries\slshape digraph})\index{DigraphNrVertices@\texttt{DigraphNrVertices}}
\label{DigraphNrVertices}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
An non\texttt{\symbol{45}}negative integer.



 Returns the number of vertices of the digraph \mbox{\texttt{\mdseries\slshape digraph}}. 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gr := Digraph(["a""b""c"],|
  !gapprompt@>| !gapinput@                 ["a""b""b"],|
  !gapprompt@>| !gapinput@                 ["b""c""a"]);|
  <immutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphNrVertices(gr);|
  3
  !gapprompt@gap>| !gapinput@gr := Digraph([1, 2, 3, 4, 5, 7],|
  !gapprompt@>| !gapinput@                 [1, 2, 2, 4, 4],|
  !gapprompt@>| !gapinput@                 [2, 7, 5, 3, 7]);|
  <immutable digraph with 6 vertices, 5 edges>
  !gapprompt@gap>| !gapinput@DigraphNrVertices(gr);|
  6
  !gapprompt@gap>| !gapinput@DigraphNrVertices(RandomDigraph(100));|
  100
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphNrVertices(D);|
  3
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphEdges}}
\logpage{[ 5, 1, 3 ]}\nobreak
\hyperdef{L}{X7D1C6A4D7ECEC317}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphEdges({\mdseries\slshape digraph})\index{DigraphEdges@\texttt{DigraphEdges}}
\label{DigraphEdges}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A list of lists of two positive integers.



 Returns a list of edges of the digraph \mbox{\texttt{\mdseries\slshape digraph}}, where each edge is a pair of elements of \texttt{DigraphVertices} (\ref{DigraphVertices}) of the form \texttt{[source,range]}. 

  The entries of \texttt{DigraphEdges(}\mbox{\texttt{\mdseries\slshape digraph}}\texttt{)} are in one\texttt{\symbol{45}}to\texttt{\symbol{45}}one correspondence with
the edges of \mbox{\texttt{\mdseries\slshape digraph}}. Hence \texttt{DigraphEdges(}\mbox{\texttt{\mdseries\slshape digraph}}\texttt{)} is duplicate\texttt{\symbol{45}}free if and only if \mbox{\texttt{\mdseries\slshape digraph}} contains no multiple edges. 

 The entries of \texttt{DigraphEdges} are guaranteed to be sorted by their first component (i.e. by the source of
each edge), but they are not necessarily then sorted by the second component. 
\begin{Verbatim}[commandchars=!|B,fontsize=\small,frame=single,label=Example]
  !gapprompt|gap>B !gapinput|gr := DigraphFromDiSparse6String(".DaXbOe?EAM@G~");B
  <immutable multidigraph with 5 vertices, 16 edges>
  !gapprompt|gap>B !gapinput|edges := ShallowCopy(DigraphEdges(gr));; Sort(edges);B
  !gapprompt|gap>B !gapinput|edges;B
  [ [ 1, 1 ], [ 1, 3 ], [ 1, 3 ], [ 1, 4 ], [ 1, 5 ], [ 2, 1 ], 
    [ 2, 2 ], [ 2, 3 ], [ 2, 5 ], [ 3, 2 ], [ 3, 4 ], [ 3, 5 ], 
    [ 4, 2 ], [ 4, 4 ], [ 4, 5 ], [ 5, 1 ] ]
  !gapprompt|gap>B !gapinput|D := CycleDigraph(IsMutableDigraph, 3);B
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt|gap>B !gapinput|DigraphEdges(D);B
  [ [ 1, 2 ], [ 2, 3 ], [ 3, 1 ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphNrEdges}}
\logpage{[ 5, 1, 4 ]}\nobreak
\hyperdef{L}{X85E1CFDD7E164AD0}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphNrEdges({\mdseries\slshape digraph})\index{DigraphNrEdges@\texttt{DigraphNrEdges}}
\label{DigraphNrEdges}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
An integer.



 Returns the number of edges of the digraph \mbox{\texttt{\mdseries\slshape digraph}}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gr := Digraph([|
  !gapprompt@>| !gapinput@[1, 3, 4, 5], [1, 2, 3, 5], [2, 4, 5], [2, 4, 5], [1]]);;|
  !gapprompt@gap>| !gapinput@DigraphNrEdges(gr);|
  15
  !gapprompt@gap>| !gapinput@gr := Digraph(["a""b""c"],|
  !gapprompt@>| !gapinput@                 ["a""b""b"],|
  !gapprompt@>| !gapinput@                 ["b""a""a"]);|
  <immutable multidigraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphNrEdges(gr);|
  3
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphNrEdges(D);|
  3
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphNrAdjacencies}}
\logpage{[ 5, 1, 5 ]}\nobreak
\hyperdef{L}{X7BD5D255809C859E}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphNrAdjacencies({\mdseries\slshape digraph})\index{DigraphNrAdjacencies@\texttt{DigraphNrAdjacencies}}
\label{DigraphNrAdjacencies}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
An integer.



 Returns the number of sets $\{u, v\}$ of vertices of the digraph \mbox{\texttt{\mdseries\slshape digraph}}, such that either $(u, v)$ or $(v, u)$ is an edge. The following equality holds for any digraph \texttt{D} with no multiple edges: \texttt{DigraphNrAdjacencies(D) * 2 \texttt{\symbol{45}} DigraphNrLoops(D) =
DigraphNrEdges(DigraphSymmetricClosure(D))}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gr := Digraph([|
  !gapprompt@>| !gapinput@[1, 3, 4, 5], [1, 2, 3, 5], [2, 4, 5], [2, 4, 5], [1]]);;|
  !gapprompt@gap>| !gapinput@DigraphNrAdjacencies(gr);|
  13
  !gapprompt@gap>| !gapinput@DigraphNrAdjacencies(gr) * 2 - DigraphNrLoops(gr) =|
  !gapprompt@>| !gapinput@DigraphNrEdges(DigraphSymmetricClosure(gr));|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphNrAdjacenciesWithoutLoops}}
\logpage{[ 5, 1, 6 ]}\nobreak
\hyperdef{L}{X7E53E728795BB862}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphNrAdjacenciesWithoutLoops({\mdseries\slshape digraph})\index{DigraphNrAdjacenciesWithoutLoops@\texttt{DigraphNrAdjacenciesWithoutLoops}}
\label{DigraphNrAdjacenciesWithoutLoops}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
An integer.



 Returns the number of sets $\{u, v\}$ of vertices of the digraph \mbox{\texttt{\mdseries\slshape digraph}}, such that $u \neq v$ and either $(u, v)$ or $(v, u)$ is an edge. The following equality holds for any digraph \texttt{D} with no multiple edges: \texttt{DigraphNrAdjacenciesWithoutLoops(D) * 2 + DigraphNrLoops(D) =
DigraphNrEdges(DigraphSymmetricClosure(D))}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gr := Digraph([|
  !gapprompt@>| !gapinput@[1, 3, 4, 5], [1, 2, 3, 5], [2, 4, 5], [2, 4, 5], [1]]);;|
  !gapprompt@gap>| !gapinput@DigraphNrAdjacenciesWithoutLoops(gr);|
  10
  !gapprompt@gap>| !gapinput@DigraphNrAdjacenciesWithoutLoops(gr) * 2 + DigraphNrLoops(gr) =|
  !gapprompt@>| !gapinput@DigraphNrEdges(DigraphSymmetricClosure(gr));|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphNrLoops}}
\logpage{[ 5, 1, 7 ]}\nobreak
\hyperdef{L}{X7BDABAF07917462B}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphNrLoops({\mdseries\slshape digraph})\index{DigraphNrLoops@\texttt{DigraphNrLoops}}
\label{DigraphNrLoops}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
An integer.



 This function returns the number of loops of the digraph \mbox{\texttt{\mdseries\slshape digraph}}. See \texttt{DigraphHasLoops} (\ref{DigraphHasLoops}). 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[2, 3], [1, 4], [3, 3, 5], [], [2, 5]]);|
  <immutable multidigraph with 5 vertices, 9 edges>
  !gapprompt@gap>| !gapinput@DigraphNrLoops(D);|
  3
  !gapprompt@gap>| !gapinput@D := EmptyDigraph(5);|
  <immutable empty digraph with 5 vertices>
  !gapprompt@gap>| !gapinput@DigraphNrLoops(D);|
  0
  !gapprompt@gap>| !gapinput@D := CompleteDigraph(5);|
  <immutable complete digraph with 5 vertices>
  !gapprompt@gap>| !gapinput@DigraphNrLoops(D);|
  0
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphSinks}}
\logpage{[ 5, 1, 8 ]}\nobreak
\hyperdef{L}{X85D5E08280914EE4}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphSinks({\mdseries\slshape digraph})\index{DigraphSinks@\texttt{DigraphSinks}}
\label{DigraphSinks}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A list of vertices.



 This function returns a list of the sinks of the digraph \mbox{\texttt{\mdseries\slshape digraph}}. A sink of a digraph is a vertex with out\texttt{\symbol{45}}degree zero. See \texttt{OutDegreeOfVertex} (\ref{OutDegreeOfVertex}). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gr := Digraph([[3, 5, 2, 2], [3], [], [5, 2, 5, 3], []]);|
  <immutable multidigraph with 5 vertices, 9 edges>
  !gapprompt@gap>| !gapinput@DigraphSinks(gr);|
  [ 3, 5 ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphSinks(D);|
  [  ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphSources}}
\logpage{[ 5, 1, 9 ]}\nobreak
\hyperdef{L}{X7F5C6268839BE98C}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphSources({\mdseries\slshape digraph})\index{DigraphSources@\texttt{DigraphSources}}
\label{DigraphSources}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A list of vertices.



 This function returns an immutable list of the sources of the digraph \mbox{\texttt{\mdseries\slshape digraph}}. A source of a digraph is a vertex with in\texttt{\symbol{45}}degree zero.
See \texttt{InDegreeOfVertex} (\ref{InDegreeOfVertex}). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gr := Digraph([[3, 5, 2, 2], [3], [], [5, 2, 5, 3], []]);|
  <immutable multidigraph with 5 vertices, 9 edges>
  !gapprompt@gap>| !gapinput@DigraphSources(gr);|
  [ 1, 4 ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphSources(D);|
  [  ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphTopologicalSort}}
\logpage{[ 5, 1, 10 ]}\nobreak
\hyperdef{L}{X785C30378064CF47}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphTopologicalSort({\mdseries\slshape digraph})\index{DigraphTopologicalSort@\texttt{DigraphTopologicalSort}}
\label{DigraphTopologicalSort}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A list of positive integers, or \texttt{fail}.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph whose only directed cycles are loops, then \texttt{DigraphTopologicalSort} returns the vertices of \mbox{\texttt{\mdseries\slshape digraph}} ordered so that every edge's source appears no earlier in the list than its
range. If the digraph \mbox{\texttt{\mdseries\slshape digraph}} contains directed cycles of length greater than $1$, then this operation returns \texttt{fail}. 

 See Section \ref{Definitions} for the definition of a directed cycle, and the definition of a loop. 

 The method used for this attribute has complexity $O(m+n)$ where $m$ is the number of edges (counting multiple edges as one) and $n$ is the number of vertices in the digraph. 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([|
  !gapprompt@>| !gapinput@[2, 3], [], [4, 6], [5], [], [7, 8, 9], [], [], []]);|
  <immutable digraph with 9 vertices, 8 edges>
  !gapprompt@gap>| !gapinput@DigraphTopologicalSort(D);|
  [ 2, 5, 4, 7, 8, 9, 6, 3, 1 ]
  !gapprompt@gap>| !gapinput@D := Digraph(IsMutableDigraph, [[2, 3], [3], [4], []]);|
  <mutable digraph with 4 vertices, 4 edges>
  !gapprompt@gap>| !gapinput@DigraphTopologicalSort(D);|
  [ 4, 3, 2, 1 ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphVertexLabel}}
\logpage{[ 5, 1, 11 ]}\nobreak
\hyperdef{L}{X7CA91E4B7904F793}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphVertexLabel({\mdseries\slshape digraph, i})\index{DigraphVertexLabel@\texttt{DigraphVertexLabel}}
\label{DigraphVertexLabel}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{SetDigraphVertexLabel({\mdseries\slshape digraph, i, obj})\index{SetDigraphVertexLabel@\texttt{SetDigraphVertexLabel}}
\label{SetDigraphVertexLabel}
}\hfill{\scriptsize (operation)}}\\


 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph, then the first operation returns the label of the vertex \mbox{\texttt{\mdseries\slshape i}}. The second operation can be used to set the label of the vertex \mbox{\texttt{\mdseries\slshape i}} in \mbox{\texttt{\mdseries\slshape digraph}} to the arbitrary \textsf{GAP} object \mbox{\texttt{\mdseries\slshape obj}}. 

 The label of a vertex can be changed an arbitrary number of times. If no label
has been set for the vertex \mbox{\texttt{\mdseries\slshape i}}, then the default value is \mbox{\texttt{\mdseries\slshape i}}. 

 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph created from a record with a component \texttt{DigraphVertices}, then the labels of the vertices are set to the value of this component.

 Induced subdigraphs, and some other operations which create new digraphs from
old ones, inherit their labels from their parents. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := DigraphFromDigraph6String("&DHUEe_");|
  <immutable digraph with 5 vertices, 11 edges>
  !gapprompt@gap>| !gapinput@DigraphVertexLabel(D, 3);|
  3
  !gapprompt@gap>| !gapinput@D := Digraph(["a""b""c"], [], []);|
  <immutable empty digraph with 3 vertices>
  !gapprompt@gap>| !gapinput@DigraphVertexLabel(D, 2);|
  "b"
  !gapprompt@gap>| !gapinput@SetDigraphVertexLabel(D, 2, "d");|
  !gapprompt@gap>| !gapinput@DigraphVertexLabel(D, 2);|
  "d"
  !gapprompt@gap>| !gapinput@D := InducedSubdigraph(D, [1, 2]);|
  <immutable empty digraph with 2 vertices>
  !gapprompt@gap>| !gapinput@DigraphVertexLabel(D, 2);|
  "d"
  !gapprompt@gap>| !gapinput@D := Digraph(IsMutableDigraph, ["e""f""g"], [], []);|
  <mutable empty digraph with 3 vertices>
  !gapprompt@gap>| !gapinput@DigraphVertexLabel(D, 1);|
  "e"
  !gapprompt@gap>| !gapinput@SetDigraphVertexLabel(D, 1, "h");|
  !gapprompt@gap>| !gapinput@DigraphVertexLabel(D, 1);|
  "h"
  !gapprompt@gap>| !gapinput@InducedSubdigraph(D, [1, 2]);|
  <mutable empty digraph with 2 vertices>
  !gapprompt@gap>| !gapinput@DigraphVertexLabel(D, 1);|
  "h"
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphVertexLabels}}
\logpage{[ 5, 1, 12 ]}\nobreak
\hyperdef{L}{X7E51F2FE87140B32}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphVertexLabels({\mdseries\slshape digraph})\index{DigraphVertexLabels@\texttt{DigraphVertexLabels}}
\label{DigraphVertexLabels}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{SetDigraphVertexLabels({\mdseries\slshape digraph, list})\index{SetDigraphVertexLabels@\texttt{SetDigraphVertexLabels}}
\label{SetDigraphVertexLabels}
}\hfill{\scriptsize (operation)}}\\


 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph, then \texttt{DigraphVertexLabels} returns a copy of the labels of the vertices in \mbox{\texttt{\mdseries\slshape digraph}}. \texttt{SetDigraphVertexLabels} can be used to set the labels of the vertices in \mbox{\texttt{\mdseries\slshape digraph}} to the list of arbitrary \textsf{GAP} objects \mbox{\texttt{\mdseries\slshape list}}, which must be of the same length as the number of vertices of \mbox{\texttt{\mdseries\slshape digraph}}. 

 If the list \mbox{\texttt{\mdseries\slshape list}} is immutable, then the vertex labels are set to a mutable copy of \mbox{\texttt{\mdseries\slshape list}}. Otherwise, the labels are set to exactly \mbox{\texttt{\mdseries\slshape list}}. 

 The label of a vertex can be changed an arbitrary number of times. If no label
has been set for the vertex \mbox{\texttt{\mdseries\slshape i}}, then the default value is \mbox{\texttt{\mdseries\slshape i}}. 

 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph created from a record with a component \texttt{DigraphVertices}, then the labels of the vertices are set to the value of this component. As
in the above, if the component is immutable then the digraph's vertex labels
are set to a mutable copy of \texttt{DigraphVertices}. Otherwise, they are set to exactly \texttt{DigraphVertices}. 

 Induced subdigraphs, and other operations which create new digraphs from old
ones, inherit their labels from their parents. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := DigraphFromDigraph6String("&DHUEe_");|
  <immutable digraph with 5 vertices, 11 edges>
  !gapprompt@gap>| !gapinput@DigraphVertexLabels(D);|
  [ 1 .. 5 ]
  !gapprompt@gap>| !gapinput@D := Digraph(["a""b""c"], [], []);|
  <immutable empty digraph with 3 vertices>
  !gapprompt@gap>| !gapinput@DigraphVertexLabels(D);|
  [ "a""b""c" ]
  !gapprompt@gap>| !gapinput@SetDigraphVertexLabel(D, 2, "d");|
  !gapprompt@gap>| !gapinput@DigraphVertexLabels(D);|
  [ "a""d""c" ]
  !gapprompt@gap>| !gapinput@D := InducedSubdigraph(D, [1, 3]);|
  <immutable empty digraph with 2 vertices>
  !gapprompt@gap>| !gapinput@DigraphVertexLabels(D);|
  [ "a""c" ]
  !gapprompt@gap>| !gapinput@D := Digraph(IsMutableDigraph, ["e""f""g"], [], []);|
  <mutable empty digraph with 3 vertices>
  !gapprompt@gap>| !gapinput@SetDigraphVertexLabels(D, ["h""i""j"]);|
  !gapprompt@gap>| !gapinput@DigraphVertexLabels(D);|
  [ "h""i""j" ]
  !gapprompt@gap>| !gapinput@InducedSubdigraph(D, [1, 3]);|
  <mutable empty digraph with 2 vertices>
  !gapprompt@gap>| !gapinput@DigraphVertexLabels(D);|
  [ "h""j" ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphEdgeLabel}}
\logpage{[ 5, 1, 13 ]}\nobreak
\hyperdef{L}{X79FAEACC7F438C2F}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphEdgeLabel({\mdseries\slshape digraph, i, j})\index{DigraphEdgeLabel@\texttt{DigraphEdgeLabel}}
\label{DigraphEdgeLabel}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{SetDigraphEdgeLabel({\mdseries\slshape digraph, i, j, obj})\index{SetDigraphEdgeLabel@\texttt{SetDigraphEdgeLabel}}
\label{SetDigraphEdgeLabel}
}\hfill{\scriptsize (operation)}}\\


 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph without multiple edges, then the first operation returns the
label of the edge from vertex \mbox{\texttt{\mdseries\slshape i}} to vertex \mbox{\texttt{\mdseries\slshape j}}. The second operation can be used to set the label of the edge between vertex \mbox{\texttt{\mdseries\slshape i}} and vertex \mbox{\texttt{\mdseries\slshape j}} to the arbitrary \textsf{GAP} object \mbox{\texttt{\mdseries\slshape obj}}. 

 The label of an edge can be changed an arbitrary number of times. If no label
has been set for the edge, then the default value is \mbox{\texttt{\mdseries\slshape 1}}. 

 Induced subdigraphs, and some other operations which create new digraphs from
old ones, inherit their edge labels from their parents. See also \texttt{DigraphEdgeLabels} (\ref{DigraphEdgeLabels}). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := DigraphFromDigraph6String("&DHUEe_");|
  <immutable digraph with 5 vertices, 11 edges>
  !gapprompt@gap>| !gapinput@DigraphEdgeLabel(D, 3, 1);|
  1
  !gapprompt@gap>| !gapinput@SetDigraphEdgeLabel(D, 2, 5, [42]);|
  !gapprompt@gap>| !gapinput@DigraphEdgeLabel(D, 2, 5);|
  [ 42 ]
  !gapprompt@gap>| !gapinput@D := InducedSubdigraph(D, [2, 5]);|
  <immutable digraph with 2 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphEdgeLabel(D, 1, 2);|
  [ 42 ]
  !gapprompt@gap>| !gapinput@D := ChainDigraph(IsMutableDigraph, 5);|
  <mutable digraph with 5 vertices, 4 edges>
  !gapprompt@gap>| !gapinput@DigraphEdgeLabel(D, 2, 3);|
  1
  !gapprompt@gap>| !gapinput@SetDigraphEdgeLabel(D, 4, 5, [1729]);|
  !gapprompt@gap>| !gapinput@DigraphEdgeLabel(D, 4, 5);|
  [ 1729 ]
  !gapprompt@gap>| !gapinput@InducedSubdigraph(D, [4, 5]);|
  <mutable digraph with 2 vertices, 1 edge>
  !gapprompt@gap>| !gapinput@DigraphEdgeLabel(D, 1, 2);|
  [ 1729 ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphEdgeLabels}}
\logpage{[ 5, 1, 14 ]}\nobreak
\hyperdef{L}{X7C24851087D4A8FB}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphEdgeLabels({\mdseries\slshape digraph})\index{DigraphEdgeLabels@\texttt{DigraphEdgeLabels}}
\label{DigraphEdgeLabels}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{SetDigraphEdgeLabels({\mdseries\slshape digraph, labels})\index{SetDigraphEdgeLabels@\texttt{SetDigraphEdgeLabels}!for a digraph and a list of lists}
\label{SetDigraphEdgeLabels:for a digraph and a list of lists}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{SetDigraphEdgeLabels({\mdseries\slshape digraph, func})\index{SetDigraphEdgeLabels@\texttt{SetDigraphEdgeLabels}!for a digraph and a function}
\label{SetDigraphEdgeLabels:for a digraph and a function}
}\hfill{\scriptsize (operation)}}\\


 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph without multiple edges, then \texttt{DigraphEdgeLabels} returns a copy of the labels of the edges in \mbox{\texttt{\mdseries\slshape digraph}} as a list of lists \texttt{labels} such that \texttt{labels[i][j]} is the label on the edge from vertex \texttt{i} to vertex \texttt{OutNeighbours(digraph)[i][j]}. \texttt{SetDigraphEdgeLabels} can be used to set the labels of the edges in \mbox{\texttt{\mdseries\slshape digraph}} without multiple edges to the list \mbox{\texttt{\mdseries\slshape labels}} of lists of arbitrary \textsf{GAP} objects such that \texttt{list[i][j]} is the label on the edge from vertex \texttt{i} to the vertex \texttt{OutNeighbours(digraph{\textgreater}[i][j]}. Alternatively \texttt{SetDigraphEdgeLabels} can be called with binary functio\mbox{\texttt{\mdseries\slshape func}} that as its second argument that when passed two vertices \texttt{i} and \texttt{j} returns the label for the edge between vertex \texttt{i} and vertex \texttt{j}. 

 The label of an edge can be changed an arbitrary number of times. If no label
has been set for an edge, then the default value is \texttt{1}. 

 Induced subdigraphs, and some other operations which create new digraphs from
old ones, inherit their labels from their parents. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := DigraphFromDigraph6String("&DHUEe_");|
  <immutable digraph with 5 vertices, 11 edges>
  !gapprompt@gap>| !gapinput@DigraphEdgeLabels(D);|
  [ [ 1 ], [ 1, 1, 1 ], [ 1 ], [ 1, 1, 1 ], [ 1, 1, 1 ] ]
  !gapprompt@gap>| !gapinput@SetDigraphEdgeLabel(D, 2, 1, "d");|
  !gapprompt@gap>| !gapinput@DigraphEdgeLabels(D);|
  [ [ 1 ], [ "d", 1, 1 ], [ 1 ], [ 1, 1, 1 ], [ 1, 1, 1 ] ]
  !gapprompt@gap>| !gapinput@D := InducedSubdigraph(D, [1, 2, 3]);|
  <immutable digraph with 3 vertices, 4 edges>
  !gapprompt@gap>| !gapinput@DigraphEdgeLabels(D);|
  [ [ 1 ], [ "d", 1 ], [ 1 ] ]
  !gapprompt@gap>| !gapinput@OutNeighbours(D);|
  [ [ 3 ], [ 1, 3 ], [ 1 ] ]
  !gapprompt@gap>| !gapinput@D := CompleteBipartiteDigraph(IsMutableDigraph, 2, 3);|
  <mutable digraph with 5 vertices, 12 edges>
  !gapprompt@gap>| !gapinput@DigraphEdgeLabels(D);|
  [ [ 1, 1, 1 ], [ 1, 1, 1 ], [ 1, 1 ], [ 1, 1 ], [ 1, 1 ] ]
  !gapprompt@gap>| !gapinput@SetDigraphEdgeLabel(D, 2, 4, "a");|
  !gapprompt@gap>| !gapinput@DigraphEdgeLabels(D);|
  [ [ 1, 1, 1 ], [ 1, "a", 1 ], [ 1, 1 ], [ 1, 1 ], [ 1, 1 ] ]
  !gapprompt@gap>| !gapinput@InducedSubdigraph(D, [1, 2, 3, 4]);|
  <mutable digraph with 4 vertices, 8 edges>
  !gapprompt@gap>| !gapinput@DigraphEdgeLabels(D);|
  [ [ 1, 1 ], [ 1, "a" ], [ 1, 1 ], [ 1, 1 ] ]
  !gapprompt@gap>| !gapinput@OutNeighbors(D);|
  [ [ 3, 4 ], [ 3, 4 ], [ 1, 2 ], [ 1, 2 ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphInEdges}}
\logpage{[ 5, 1, 15 ]}\nobreak
\hyperdef{L}{X7EFAF01B7A155157}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphInEdges({\mdseries\slshape digraph, vertex})\index{DigraphInEdges@\texttt{DigraphInEdges}}
\label{DigraphInEdges}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A list of edges.



 \texttt{DigraphInEdges} returns the list of all edges of \mbox{\texttt{\mdseries\slshape digraph}} which have \mbox{\texttt{\mdseries\slshape vertex}} as their range. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[2, 2], [3, 3], [4, 4], [1, 1]]);|
  <immutable multidigraph with 4 vertices, 8 edges>
  !gapprompt@gap>| !gapinput@DigraphInEdges(D, 2);|
  [ [ 1, 2 ], [ 1, 2 ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphOutEdges}}
\logpage{[ 5, 1, 16 ]}\nobreak
\hyperdef{L}{X7BECFE6687ECD028}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphOutEdges({\mdseries\slshape digraph, vertex})\index{DigraphOutEdges@\texttt{DigraphOutEdges}}
\label{DigraphOutEdges}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A list of edges.



 \texttt{DigraphOutEdges} returns the list of all edges of \mbox{\texttt{\mdseries\slshape digraph}} which have \mbox{\texttt{\mdseries\slshape vertex}} as their source. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[2, 2], [3, 3], [4, 4], [1, 1]]);|
  <immutable multidigraph with 4 vertices, 8 edges>
  !gapprompt@gap>| !gapinput@DigraphOutEdges(D, 2);|
  [ [ 2, 3 ], [ 2, 3 ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{IsDigraphEdge (for digraph and list)}}
\logpage{[ 5, 1, 17 ]}\nobreak
\hyperdef{L}{X7BB8ED88835F07B4}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{IsDigraphEdge({\mdseries\slshape digraph, list})\index{IsDigraphEdge@\texttt{IsDigraphEdge}!for digraph and list}
\label{IsDigraphEdge:for digraph and list}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{IsDigraphEdge({\mdseries\slshape digraph, u, v})\index{IsDigraphEdge@\texttt{IsDigraphEdge}!for digraph and two pos ints}
\label{IsDigraphEdge:for digraph and two pos ints}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
\texttt{true} or \texttt{false}.



 In the first form, this function returns \texttt{true} if and only if the list \mbox{\texttt{\mdseries\slshape list}} specifies an edge in the digraph \mbox{\texttt{\mdseries\slshape digraph}}. Specifically, this operation returns \texttt{true} if \mbox{\texttt{\mdseries\slshape list}} is a pair of positive integers where \mbox{\texttt{\mdseries\slshape list}}\texttt{[1]} is the source and \mbox{\texttt{\mdseries\slshape list}}\texttt{[2]} is the range of an edge in \mbox{\texttt{\mdseries\slshape digraph}}, and \texttt{false} otherwise. 

 The second form simply returns \texttt{true} if \texttt{[\mbox{\texttt{\mdseries\slshape u}}, \mbox{\texttt{\mdseries\slshape v}}]} is an edge in \mbox{\texttt{\mdseries\slshape digraph}}, and \texttt{false} otherwise. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[2, 2], [6], [], [3], [], [1]]);|
  <immutable multidigraph with 6 vertices, 5 edges>
  !gapprompt@gap>| !gapinput@IsDigraphEdge(D, [1, 1]);|
  false
  !gapprompt@gap>| !gapinput@IsDigraphEdge(D, [1, 2]);|
  true
  !gapprompt@gap>| !gapinput@IsDigraphEdge(D, [1, 8]);|
  false
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{IsMatching}}
\logpage{[ 5, 1, 18 ]}\nobreak
\hyperdef{L}{X848FED0B7B4ACD1F}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{IsMatching({\mdseries\slshape digraph, list})\index{IsMatching@\texttt{IsMatching}}
\label{IsMatching}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{IsMaximalMatching({\mdseries\slshape digraph, list})\index{IsMaximalMatching@\texttt{IsMaximalMatching}}
\label{IsMaximalMatching}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{IsMaximumMatching({\mdseries\slshape digraph, list})\index{IsMaximumMatching@\texttt{IsMaximumMatching}}
\label{IsMaximumMatching}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{IsPerfectMatching({\mdseries\slshape digraph, list})\index{IsPerfectMatching@\texttt{IsPerfectMatching}}
\label{IsPerfectMatching}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
\texttt{true} or \texttt{false}.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph and \mbox{\texttt{\mdseries\slshape list}} is a list of pairs of vertices of \mbox{\texttt{\mdseries\slshape digraph}}, then \texttt{IsMatching} returns \texttt{true} if \mbox{\texttt{\mdseries\slshape list}} is a matching of \mbox{\texttt{\mdseries\slshape digraph}}. The operation \texttt{IsMaximalMatching} returns \texttt{true} if \mbox{\texttt{\mdseries\slshape list}} is a maximal matching, \texttt{IsMaximumMatching} returns \texttt{true} if \mbox{\texttt{\mdseries\slshape list}} is a maximum matching and \texttt{IsPerfectMatching} returns \texttt{true} if \mbox{\texttt{\mdseries\slshape list}} is a perfect, matching of \mbox{\texttt{\mdseries\slshape digraph}}, respectively. Otherwise, each of these operations return \texttt{false}

 A \emph{matching} \texttt{M} of a digraph \mbox{\texttt{\mdseries\slshape digraph}} is a subset of the edges of \mbox{\texttt{\mdseries\slshape digraph}}, i.e. \texttt{DigraphEdges(\mbox{\texttt{\mdseries\slshape digraph}})}, such that no pair of distinct edges in \texttt{M} are incident to the same vertex of \mbox{\texttt{\mdseries\slshape digraph}}. Note that this definition allows a matching to contain loops. See \texttt{DigraphHasLoops} (\ref{DigraphHasLoops}). The matching \texttt{M} is \emph{maximal} if it is contained in no larger matching of the digraph, is \emph{maximum} if it has the greatest cardinality among all matchings and is \emph{perfect} if every vertex of the digraph is incident to an edge in the matching. Every
maximum or perfect matching is maximal. Note, however, that not every perfect
matching of digraphs with loops is maximum. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[1, 2], [1, 2], [2, 3, 4], [3, 5], [1]]);|
  <immutable digraph with 5 vertices, 10 edges>
  !gapprompt@gap>| !gapinput@IsMatching(D, [[2, 1], [3, 2]]);|
  false
  !gapprompt@gap>| !gapinput@edges := [[3, 2]];;|
  !gapprompt@gap>| !gapinput@IsMatching(D, edges);|
  true
  !gapprompt@gap>| !gapinput@IsMaximalMatching(D, edges);|
  false
  !gapprompt@gap>| !gapinput@edges := [[2, 1], [3, 4]];;|
  !gapprompt@gap>| !gapinput@IsMaximalMatching(D, edges);|
  true
  !gapprompt@gap>| !gapinput@IsPerfectMatching(D, edges);|
  false
  !gapprompt@gap>| !gapinput@edges := [[1, 2], [3, 3], [4, 5]];;|
  !gapprompt@gap>| !gapinput@IsPerfectMatching(D, edges);|
  true
  !gapprompt@gap>| !gapinput@IsMaximumMatching(D, edges);|
  false
  !gapprompt@gap>| !gapinput@edges := [[1, 1], [2, 2], [3, 3], [4, 5]];;|
  !gapprompt@gap>| !gapinput@IsMaximumMatching(D, edges);|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphMaximalMatching}}
\logpage{[ 5, 1, 19 ]}\nobreak
\hyperdef{L}{X7B7A67277B1C9A02}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphMaximalMatching({\mdseries\slshape digraph})\index{DigraphMaximalMatching@\texttt{DigraphMaximalMatching}}
\label{DigraphMaximalMatching}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A list of pairs of vertices.



 This function returns a maximal matching of the digraph \mbox{\texttt{\mdseries\slshape digraph}}. 

 For the definition of a maximal matching, see \texttt{IsMaximalMatching} (\ref{IsMaximalMatching}). 
\begin{Verbatim}[commandchars=!BE,fontsize=\small,frame=single,label=Example]
  !gappromptBgap>E !gapinputBD := DigraphFromDiSparse6String(".IeAoXCJU@|SHAe?d");E
  <immutable digraph with 10 vertices, 13 edges>
  !gappromptBgap>E !gapinputBM := DigraphMaximalMatching(D);; IsMaximalMatching(D, M);E
  true
  !gappromptBgap>E !gapinputBD := RandomDigraph(100);;E
  !gappromptBgap>E !gapinputBIsMaximalMatching(D, DigraphMaximalMatching(D));E
  true
  !gappromptBgap>E !gapinputBD := GeneralisedPetersenGraph(IsMutableDigraph, 9, 2);E
  <mutable digraph with 18 vertices, 54 edges>
  !gappromptBgap>E !gapinputBIsMaximalMatching(D, DigraphMaximalMatching(D));E
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphMaximumMatching}}
\logpage{[ 5, 1, 20 ]}\nobreak
\hyperdef{L}{X78E9847A858788D1}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphMaximumMatching({\mdseries\slshape digraph})\index{DigraphMaximumMatching@\texttt{DigraphMaximumMatching}}
\label{DigraphMaximumMatching}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A list of pairs of vertices.



 This function returns a maximum matching of the digraph \mbox{\texttt{\mdseries\slshape digraph}}. 

 For the definition of a maximum matching, see \texttt{IsMaximumMatching} (\ref{IsMaximumMatching}). If \mbox{\texttt{\mdseries\slshape digraph}} is bipartite (see \texttt{IsBipartiteDigraph} (\ref{IsBipartiteDigraph})), then the algorithm used has complexity \texttt{O(m*sqrt(n))}. Otherwise for general graphs the complexity is \texttt{O(m*n*log(n))}. Her\texttt{n} is the number of vertices and \texttt{m} is the number of edges. 
\begin{Verbatim}[commandchars=!|B,fontsize=\small,frame=single,label=Example]
  !gapprompt|gap>B !gapinput|D := DigraphFromDigraph6String("&I@EA_A?AdDp[_c??OO");B
  <immutable digraph with 10 vertices, 23 edges>
  !gapprompt|gap>B !gapinput|M := DigraphMaximumMatching(D);; IsMaximalMatching(D, M);B
  true
  !gapprompt|gap>B !gapinput|Length(M);B
  5
  !gapprompt|gap>B !gapinput|D := Digraph([[5, 6, 7, 8], [6, 7, 8], [7, 8], [8], B
  !gapprompt|>B !gapinput|                 [], [], [], []]);;B
  !gapprompt|gap>B !gapinput|M := DigraphMaximumMatching(D);B
  [ [ 1, 5 ], [ 2, 6 ], [ 3, 7 ], [ 4, 8 ] ]
  !gapprompt|gap>B !gapinput|D := GeneralisedPetersenGraph(IsMutableDigraph, 9, 2);B
  <mutable digraph with 18 vertices, 54 edges>
  !gapprompt|gap>B !gapinput|M := DigraphMaximumMatching(D);;B
  !gapprompt|gap>B !gapinput|IsMaximalMatching(D, M);B
  true
  !gapprompt|gap>B !gapinput|Length(M);B
  9
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{Neighbours and degree}}\logpage{[ 5, 2, 0 ]}
\hyperdef{L}{X7D7CE8328187D0DF}{}
{
 

\subsection{\textcolor{Chapter }{AdjacencyMatrix}}
\logpage{[ 5, 2, 1 ]}\nobreak
\hyperdef{L}{X7DC2CD70830BEE60}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{AdjacencyMatrix({\mdseries\slshape digraph})\index{AdjacencyMatrix@\texttt{AdjacencyMatrix}}
\label{AdjacencyMatrix}
}\hfill{\scriptsize (attribute)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{AdjacencyMatrixMutableCopy({\mdseries\slshape digraph})\index{AdjacencyMatrixMutableCopy@\texttt{AdjacencyMatrixMutableCopy}}
\label{AdjacencyMatrixMutableCopy}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A square matrix of non\texttt{\symbol{45}}negative integers.



 This function returns the adjacency matrix \texttt{mat} of the digraph \mbox{\texttt{\mdseries\slshape digraph}}.  The value of the matrix entry \texttt{mat[i][j]} is the number of edges in \mbox{\texttt{\mdseries\slshape digraph}} with source \texttt{i} and range \texttt{j}. If \mbox{\texttt{\mdseries\slshape digraph}} has no vertices, then the empty list is returned. 

 The function \texttt{AdjacencyMatrix} returns an immutable list of lists, whereas the function \texttt{AdjacencyMatrixMutableCopy} returns a copy of \texttt{AdjacencyMatrix} that is a mutable list of mutable lists. 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gr := Digraph([|
  !gapprompt@>| !gapinput@[2, 2, 2], [1, 3, 6, 8, 9, 10], [4, 6, 8],|
  !gapprompt@>| !gapinput@[1, 2, 3, 9], [3, 3], [3, 5, 6, 10], [1, 2, 7],|
  !gapprompt@>| !gapinput@[1, 2, 3, 10, 5, 6, 10], [1, 3, 4, 5, 8, 10],|
  !gapprompt@>| !gapinput@[2, 3, 4, 6, 7, 10]]);|
  <immutable multidigraph with 10 vertices, 44 edges>
  !gapprompt@gap>| !gapinput@mat := AdjacencyMatrix(gr);;|
  !gapprompt@gap>| !gapinput@Display(mat);|
  [ [  0,  3,  0,  0,  0,  0,  0,  0,  0,  0 ],
    [  1,  0,  1,  0,  0,  1,  0,  1,  1,  1 ],
    [  0,  0,  0,  1,  0,  1,  0,  1,  0,  0 ],
    [  1,  1,  1,  0,  0,  0,  0,  0,  1,  0 ],
    [  0,  0,  2,  0,  0,  0,  0,  0,  0,  0 ],
    [  0,  0,  1,  0,  1,  1,  0,  0,  0,  1 ],
    [  1,  1,  0,  0,  0,  0,  1,  0,  0,  0 ],
    [  1,  1,  1,  0,  1,  1,  0,  0,  0,  2 ],
    [  1,  0,  1,  1,  1,  0,  0,  1,  0,  1 ],
    [  0,  1,  1,  1,  0,  1,  1,  0,  0,  1 ] ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@Display(AdjacencyMatrix(D));|
  [ [  0,  1,  0 ],
    [  0,  0,  1 ],
    [  1,  0,  0 ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{CharacteristicPolynomial}}
\logpage{[ 5, 2, 2 ]}\nobreak
\hyperdef{L}{X87FA0A727CDB060B}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{CharacteristicPolynomial({\mdseries\slshape digraph})\index{CharacteristicPolynomial@\texttt{CharacteristicPolynomial}}
\label{CharacteristicPolynomial}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A polynomial with integer coefficients.



 This function returns the characteristic polynomial of the digraph \mbox{\texttt{\mdseries\slshape digraph}}. That is it returns the characteristic polynomial of the adjacency matrix of
the digraph \mbox{\texttt{\mdseries\slshape digraph}} 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([|
  !gapprompt@>| !gapinput@[2, 2, 2], [1, 3, 6, 8, 9, 10], [4, 6, 8],|
  !gapprompt@>| !gapinput@[1, 2, 3, 9], [3, 3], [3, 5, 6, 10], [1, 2, 7],|
  !gapprompt@>| !gapinput@[1, 2, 3, 10, 5, 6, 10], [1, 3, 4, 5, 8, 10],|
  !gapprompt@>| !gapinput@[2, 3, 4, 6, 7, 10]]);|
  <immutable multidigraph with 10 vertices, 44 edges>
  !gapprompt@gap>| !gapinput@CharacteristicPolynomial(D);|
  x_1^10-3*x_1^9-7*x_1^8-x_1^7+14*x_1^6+x_1^5-26*x_1^4+51*x_1^3-10*x_1^2java.lang.NullPointerException
  +18*x_1-30
  !gapprompt@gap>| !gapinput@D := CompleteDigraph(5);|
  <immutable complete digraph with 5 vertices>
  !gapprompt@gap>| !gapinput@CharacteristicPolynomial(D);|
  x_1^5-10*x_1^3-20*x_1^2-15*x_1-4
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@CharacteristicPolynomial(D);|
  x_1^3-1
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{BooleanAdjacencyMatrix}}
\logpage{[ 5, 2, 3 ]}\nobreak
\hyperdef{L}{X8507DC4F794780C1}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{BooleanAdjacencyMatrix({\mdseries\slshape digraph})\index{BooleanAdjacencyMatrix@\texttt{BooleanAdjacencyMatrix}}
\label{BooleanAdjacencyMatrix}
}\hfill{\scriptsize (attribute)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{BooleanAdjacencyMatrixMutableCopy({\mdseries\slshape digraph})\index{BooleanAdjacencyMatrixMutableCopy@\texttt{BooleanAdjacencyMatrixMutableCopy}}
\label{BooleanAdjacencyMatrixMutableCopy}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A square matrix of booleans.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph with a positive number of vertice\texttt{n}, then \texttt{BooleanAdjacencyMatrix(}\mbox{\texttt{\mdseries\slshape digraph}}\texttt{)} returns the boolean adjacency matrix \texttt{mat} of \mbox{\texttt{\mdseries\slshape digraph}}.  The value of the matrix entry \texttt{mat[j][i]} is \texttt{true} if and only if there exists an edge in \mbox{\texttt{\mdseries\slshape digraph}} with source \texttt{j} and range \texttt{i}. If \mbox{\texttt{\mdseries\slshape digraph}} has no vertices, then the empty list is returned. 

  Note that the boolean adjacency matrix loses information about multiple edges. 

 The attribute \texttt{BooleanAdjacencyMatrix} returns an immutable list of immutable lists, whereas the function \texttt{BooleanAdjacencyMatrixMutableCopy} returns a copy of the \texttt{BooleanAdjacencyMatrix} that is a mutable list of mutable lists. 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gr := Digraph([[3, 4], [2, 3], [1, 2, 4], [4]]);|
  <immutable digraph with 4 vertices, 8 edges>
  !gapprompt@gap>| !gapinput@PrintArray(BooleanAdjacencyMatrix(gr));|
  [ [  false,  false,   true,   true ],
    [  false,   true,   true,  false ],
    [   true,   true,  false,   true ],
    [  false,  false,  false,   true ] ]
  !gapprompt@gap>| !gapinput@gr := CycleDigraph(4);;|
  !gapprompt@gap>| !gapinput@PrintArray(BooleanAdjacencyMatrix(gr));|
  [ [  false,   true,  false,  false ],
    [  false,  false,   true,  false ],
    [  false,  false,  false,   true ],
    [   true,  false,  false,  false ] ]
  !gapprompt@gap>| !gapinput@BooleanAdjacencyMatrix(EmptyDigraph(0));|
  [  ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@PrintArray(BooleanAdjacencyMatrix(D));|
  [ [  false,   true,  false ],
    [  false,  false,   true ],
    [   true,  false,  false ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphAdjacencyFunction}}
\logpage{[ 5, 2, 4 ]}\nobreak
\hyperdef{L}{X7AFCE34A7A04D5C1}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphAdjacencyFunction({\mdseries\slshape digraph})\index{DigraphAdjacencyFunction@\texttt{DigraphAdjacencyFunction}}
\label{DigraphAdjacencyFunction}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A function.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph, then \texttt{DigraphAdjacencyFunction} returns a function which takes two integer parameters \texttt{x, y} and returns \texttt{true} if there exists an edge from vertex \texttt{x} to vertex \texttt{y} in \mbox{\texttt{\mdseries\slshape digraph}} and \texttt{false} if not. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@digraph := Digraph([[1, 2], [3], []]);|
  <immutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@foo := DigraphAdjacencyFunction(digraph);|
  function( u, v ) ... end
  !gapprompt@gap>| !gapinput@foo(1, 1);|
  true
  !gapprompt@gap>| !gapinput@foo(1, 2);|
  true
  !gapprompt@gap>| !gapinput@foo(1, 3);|
  false
  !gapprompt@gap>| !gapinput@foo(3, 1);|
  false
  !gapprompt@gap>| !gapinput@gr := Digraph(["a""b""c"],|
  !gapprompt@>| !gapinput@                 ["a""b""b"],|
  !gapprompt@>| !gapinput@                 ["b""a""a"]);|
  <immutable multidigraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@foo := DigraphAdjacencyFunction(gr);|
  function( u, v ) ... end
  !gapprompt@gap>| !gapinput@foo(1, 2);|
  true
  !gapprompt@gap>| !gapinput@foo(3, 2);|
  false
  !gapprompt@gap>| !gapinput@foo(3, 1);|
  false
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@foo := DigraphAdjacencyFunction(D);|
  function( u, v ) ... end
  !gapprompt@gap>| !gapinput@foo(1, 2);|
  true
  !gapprompt@gap>| !gapinput@foo(2, 1);|
  false
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphRange}}
\logpage{[ 5, 2, 5 ]}\nobreak
\hyperdef{L}{X7FDEBF3279759961}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphRange({\mdseries\slshape digraph})\index{DigraphRange@\texttt{DigraphRange}}
\label{DigraphRange}
}\hfill{\scriptsize (attribute)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphSource({\mdseries\slshape digraph})\index{DigraphSource@\texttt{DigraphSource}}
\label{DigraphSource}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A list of positive integers.



 \texttt{DigraphRange} and \texttt{DigraphSource} return the range and source of the digrap\mbox{\texttt{\mdseries\slshape digraph}}. More precisely, position \texttt{i} in \texttt{DigraphSource(\mbox{\texttt{\mdseries\slshape digraph}})} and \texttt{DigraphRange(\mbox{\texttt{\mdseries\slshape digraph}})} give, respectively, the source and range of the \texttt{i}th edge of \mbox{\texttt{\mdseries\slshape digraph}}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gr := Digraph([|
  !gapprompt@>| !gapinput@[2, 1, 3, 5], [1, 3, 4], [2, 3], [2], [1, 2, 3, 4]]);|
  <immutable digraph with 5 vertices, 14 edges>
  !gapprompt@gap>| !gapinput@DigraphSource(gr);|
  [ 1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 5, 5, 5, 5 ]
  !gapprompt@gap>| !gapinput@DigraphRange(gr);|
  [ 2, 1, 3, 5, 1, 3, 4, 2, 3, 2, 1, 2, 3, 4 ]
  !gapprompt@gap>| !gapinput@DigraphEdges(gr);|
  [ [ 1, 2 ], [ 1, 1 ], [ 1, 3 ], [ 1, 5 ], [ 2, 1 ], [ 2, 3 ], 
    [ 2, 4 ], [ 3, 2 ], [ 3, 3 ], [ 4, 2 ], [ 5, 1 ], [ 5, 2 ], 
    [ 5, 3 ], [ 5, 4 ] ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphRange(D);|
  [ 2, 3, 1 ]
  !gapprompt@gap>| !gapinput@DigraphSource(D);|
  [ 1, 2, 3 ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{OutNeighbours}}
\logpage{[ 5, 2, 6 ]}\nobreak
\hyperdef{L}{X7E9880767AE68E00}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{OutNeighbours({\mdseries\slshape digraph})\index{OutNeighbours@\texttt{OutNeighbours}}
\label{OutNeighbours}
}\hfill{\scriptsize (attribute)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{OutNeighbors({\mdseries\slshape digraph})\index{OutNeighbors@\texttt{OutNeighbors}}
\label{OutNeighbors}
}\hfill{\scriptsize (attribute)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{OutNeighboursMutableCopy({\mdseries\slshape digraph})\index{OutNeighboursMutableCopy@\texttt{OutNeighboursMutableCopy}}
\label{OutNeighboursMutableCopy}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{OutNeighborsMutableCopy({\mdseries\slshape digraph})\index{OutNeighborsMutableCopy@\texttt{OutNeighborsMutableCopy}}
\label{OutNeighborsMutableCopy}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
The adjacencies of a digraph.



 \texttt{OutNeighbours} returns the list \texttt{out} of out\texttt{\symbol{45}}neighbours of each vertex of the digraph \mbox{\texttt{\mdseries\slshape digraph}}.  More specifically, a vertex \texttt{j} appears in \texttt{out[i]} each time there exists the edge \texttt{[i, j]} in \mbox{\texttt{\mdseries\slshape digraph}}. 

 The function \texttt{OutNeighbours} returns an immutable list of lists, whereas the functio\texttt{OutNeighboursMutableCopy} returns a copy of \texttt{OutNeighbours} which is a mutable list of mutable lists. 

 Note that the entries of \texttt{out} are not guaranteed to be sorted in any particular order. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gr := Digraph(["a""b""c"],|
  !gapprompt@>| !gapinput@                 ["a""b""b"],|
  !gapprompt@>| !gapinput@                 ["b""a""c"]);|
  <immutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@OutNeighbours(gr);|
  [ [ 2 ], [ 1, 3 ], [  ] ]
  !gapprompt@gap>| !gapinput@gr := Digraph([[1, 2, 3], [2, 1], [3]]);|
  <immutable digraph with 3 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@OutNeighbours(gr);|
  [ [ 1, 2, 3 ], [ 2, 1 ], [ 3 ] ]
  !gapprompt@gap>| !gapinput@gr := DigraphByAdjacencyMatrix([|
  !gapprompt@>| !gapinput@ [1, 2, 1],|
  !gapprompt@>| !gapinput@ [1, 1, 0],|
  !gapprompt@>| !gapinput@ [0, 0, 1]]);|
  <immutable multidigraph with 3 vertices, 7 edges>
  !gapprompt@gap>| !gapinput@OutNeighbours(gr);|
  [ [ 1, 2, 2, 3 ], [ 1, 2 ], [ 3 ] ]
  !gapprompt@gap>| !gapinput@OutNeighboursMutableCopy(gr);|
  [ [ 1, 2, 2, 3 ], [ 1, 2 ], [ 3 ] ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@OutNeighbours(D);|
  [ [ 2 ], [ 3 ], [ 1 ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{InNeighbours}}
\logpage{[ 5, 2, 7 ]}\nobreak
\hyperdef{L}{X85C7AA5A81DA6E11}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{InNeighbours({\mdseries\slshape digraph})\index{InNeighbours@\texttt{InNeighbours}}
\label{InNeighbours}
}\hfill{\scriptsize (attribute)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{InNeighbors({\mdseries\slshape digraph})\index{InNeighbors@\texttt{InNeighbors}}
\label{InNeighbors}
}\hfill{\scriptsize (attribute)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{InNeighboursMutableCopy({\mdseries\slshape digraph})\index{InNeighboursMutableCopy@\texttt{InNeighboursMutableCopy}}
\label{InNeighboursMutableCopy}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{InNeighborsMutableCopy({\mdseries\slshape digraph})\index{InNeighborsMutableCopy@\texttt{InNeighborsMutableCopy}}
\label{InNeighborsMutableCopy}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A list of lists of vertices.



 \texttt{InNeighbours} returns the list \texttt{inn} of in\texttt{\symbol{45}}neighbours of each vertex of the digraph \mbox{\texttt{\mdseries\slshape digraph}}.  More specifically, a vertex \texttt{j} appears in \texttt{inn[i]} each time there exists an edge \texttt{[j,i]} in \mbox{\texttt{\mdseries\slshape digraph}}. 

 The function \texttt{InNeighbours} returns an immutable list of lists, whereas the function \texttt{InNeighboursMutableCopy} returns a copy of \texttt{InNeighbours} which is a mutable list of mutable lists. 

 Note that the entries of \texttt{inn} are not necessarily sorted into ascending order, particularly if \mbox{\texttt{\mdseries\slshape digraph}} was constructed via \texttt{DigraphByInNeighbours} (\ref{DigraphByInNeighbours}). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gr := Digraph(["a""b""c"],|
  !gapprompt@>| !gapinput@                 ["a""b""b"],|
  !gapprompt@>| !gapinput@                 ["b""a""c"]);|
  <immutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@InNeighbours(gr);|
  [ [ 2 ], [ 1 ], [ 2 ] ]
  !gapprompt@gap>| !gapinput@gr := Digraph([[1, 2, 3], [2, 1], [3]]);|
  <immutable digraph with 3 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@InNeighbours(gr);|
  [ [ 1, 2 ], [ 1, 2 ], [ 1, 3 ] ]
  !gapprompt@gap>| !gapinput@gr := DigraphByAdjacencyMatrix([|
  !gapprompt@>| !gapinput@ [1, 2, 1],|
  !gapprompt@>| !gapinput@ [1, 1, 0],|
  !gapprompt@>| !gapinput@ [0, 0, 1]]);|
  <immutable multidigraph with 3 vertices, 7 edges>
  !gapprompt@gap>| !gapinput@InNeighbours(gr);|
  [ [ 1, 2 ], [ 1, 1, 2 ], [ 1, 3 ] ]
  !gapprompt@gap>| !gapinput@InNeighboursMutableCopy(gr);|
  [ [ 1, 2 ], [ 1, 1, 2 ], [ 1, 3 ] ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@InNeighbours(D);|
  [ [ 3 ], [ 1 ], [ 2 ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{OutDegrees}}
\logpage{[ 5, 2, 8 ]}\nobreak
\hyperdef{L}{X7F5ACE807D1BC2E2}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{OutDegrees({\mdseries\slshape digraph})\index{OutDegrees@\texttt{OutDegrees}}
\label{OutDegrees}
}\hfill{\scriptsize (attribute)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{OutDegreeSequence({\mdseries\slshape digraph})\index{OutDegreeSequence@\texttt{OutDegreeSequence}}
\label{OutDegreeSequence}
}\hfill{\scriptsize (attribute)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{OutDegreeSet({\mdseries\slshape digraph})\index{OutDegreeSet@\texttt{OutDegreeSet}}
\label{OutDegreeSet}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A list of non\texttt{\symbol{45}}negative integers.



 Given a digraph \mbox{\texttt{\mdseries\slshape digraph}} with $n$ vertices, the function \texttt{OutDegrees} returns an immutable list \texttt{out} of length $n$, such that for a vertex \texttt{i} in \mbox{\texttt{\mdseries\slshape digraph}}, the value of \texttt{out[i]} is the out\texttt{\symbol{45}}degree of vertex \texttt{i}. See \texttt{OutDegreeOfVertex} (\ref{OutDegreeOfVertex}). 

 The function \texttt{OutDegreeSequence} returns the same list, after it has been sorted into
non\texttt{\symbol{45}}increasing order. 

 The function \texttt{OutDegreeSet} returns the same list, sorted into increasing order with duplicate entries
removed. 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[1, 3, 2, 2], [], [2, 1], []]);|
  <immutable multidigraph with 4 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@OutDegrees(D);|
  [ 4, 0, 2, 0 ]
  !gapprompt@gap>| !gapinput@OutDegreeSequence(D);|
  [ 4, 2, 0, 0 ]
  !gapprompt@gap>| !gapinput@OutDegreeSet(D);|
  [ 0, 2, 4 ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@OutDegrees(D);|
  [ 1, 1, 1 ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{InDegrees}}
\logpage{[ 5, 2, 9 ]}\nobreak
\hyperdef{L}{X7ADDFBFD7A365775}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{InDegrees({\mdseries\slshape digraph})\index{InDegrees@\texttt{InDegrees}}
\label{InDegrees}
}\hfill{\scriptsize (attribute)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{InDegreeSequence({\mdseries\slshape digraph})\index{InDegreeSequence@\texttt{InDegreeSequence}}
\label{InDegreeSequence}
}\hfill{\scriptsize (attribute)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{InDegreeSet({\mdseries\slshape digraph})\index{InDegreeSet@\texttt{InDegreeSet}}
\label{InDegreeSet}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A list of non\texttt{\symbol{45}}negative integers.



 Given a digraph \mbox{\texttt{\mdseries\slshape digraph}} with $n$ vertices, the function \texttt{InDegrees} returns an immutable list \texttt{inn} of length $n$, such that for a verte\texttt{i} in \mbox{\texttt{\mdseries\slshape digraph}}, the value of \texttt{inn[i]} is the in\texttt{\symbol{45}}degree of vertex \texttt{i}. See \texttt{InDegreeOfVertex} (\ref{InDegreeOfVertex}). 

 The function \texttt{InDegreeSequence} returns the same list, after it has been sorted into
non\texttt{\symbol{45}}increasing order. 

 The function \texttt{InDegreeSet} returns the same list, sorted into increasing order with duplicate entries
removed. 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[1, 3, 2, 2, 4], [], [2, 1, 4], []]);|
  <immutable multidigraph with 4 vertices, 8 edges>
  !gapprompt@gap>| !gapinput@InDegrees(D);|
  [ 2, 3, 1, 2 ]
  !gapprompt@gap>| !gapinput@InDegreeSequence(D);|
  [ 3, 2, 2, 1 ]
  !gapprompt@gap>| !gapinput@InDegreeSet(D);|
  [ 1, 2, 3 ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@InDegrees(D);|
  [ 1, 1, 1 ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{OutDegreeOfVertex}}
\logpage{[ 5, 2, 10 ]}\nobreak
\hyperdef{L}{X7A09EB648070276D}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{OutDegreeOfVertex({\mdseries\slshape digraph, vertex})\index{OutDegreeOfVertex@\texttt{OutDegreeOfVertex}}
\label{OutDegreeOfVertex}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
The non\texttt{\symbol{45}}negative integer.



 This operation returns the out\texttt{\symbol{45}}degree of the vertex \mbox{\texttt{\mdseries\slshape vertex}} in the digraph \mbox{\texttt{\mdseries\slshape digraph}}. The out\texttt{\symbol{45}}degree of \mbox{\texttt{\mdseries\slshape vertex}} is the number of edges in \mbox{\texttt{\mdseries\slshape digraph}} whose source is \mbox{\texttt{\mdseries\slshape vertex}}. 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([|
  !gapprompt@>| !gapinput@[2, 2, 1], [1, 4], [2, 2, 4, 2], [1, 1, 2, 2, 1, 2, 2]]);|
  <immutable multidigraph with 4 vertices, 16 edges>
  !gapprompt@gap>| !gapinput@OutDegreeOfVertex(D, 1);|
  3
  !gapprompt@gap>| !gapinput@OutDegreeOfVertex(D, 2);|
  2
  !gapprompt@gap>| !gapinput@OutDegreeOfVertex(D, 3);|
  4
  !gapprompt@gap>| !gapinput@OutDegreeOfVertex(D, 4);|
  7
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{OutNeighboursOfVertex}}
\logpage{[ 5, 2, 11 ]}\nobreak
\hyperdef{L}{X83315B0186850806}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{OutNeighboursOfVertex({\mdseries\slshape digraph, vertex})\index{OutNeighboursOfVertex@\texttt{OutNeighboursOfVertex}}
\label{OutNeighboursOfVertex}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{OutNeighborsOfVertex({\mdseries\slshape digraph, vertex})\index{OutNeighborsOfVertex@\texttt{OutNeighborsOfVertex}}
\label{OutNeighborsOfVertex}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A list of vertices.



 This operation returns the list \texttt{out} of vertices of the digraph \mbox{\texttt{\mdseries\slshape digraph}}. A vertex \texttt{i} appears in the list \texttt{out} each time there exists an edge with source \mbox{\texttt{\mdseries\slshape vertex}} and range \texttt{i} in \mbox{\texttt{\mdseries\slshape digraph}}; in particular, this means that \texttt{out} may contain duplicates.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([|
  !gapprompt@>| !gapinput@[2, 2, 3], [1, 3, 4], [2, 2, 3], [1, 1, 2, 2, 1, 2, 2]]);|
  <immutable multidigraph with 4 vertices, 16 edges>
  !gapprompt@gap>| !gapinput@OutNeighboursOfVertex(D, 1);|
  [ 2, 2, 3 ]
  !gapprompt@gap>| !gapinput@OutNeighboursOfVertex(D, 3);|
  [ 2, 2, 3 ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{InDegreeOfVertex}}
\logpage{[ 5, 2, 12 ]}\nobreak
\hyperdef{L}{X7C9CD0527CB9E6EF}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{InDegreeOfVertex({\mdseries\slshape digraph, vertex})\index{InDegreeOfVertex@\texttt{InDegreeOfVertex}}
\label{InDegreeOfVertex}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A non\texttt{\symbol{45}}negative integer.



 This operation returns the in\texttt{\symbol{45}}degree of the vertex \mbox{\texttt{\mdseries\slshape vertex}} in the digraph \mbox{\texttt{\mdseries\slshape digraph}}. The in\texttt{\symbol{45}}degree of \mbox{\texttt{\mdseries\slshape vertex}} is the number of edges in \mbox{\texttt{\mdseries\slshape digraph}} whose range is \mbox{\texttt{\mdseries\slshape vertex}}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([|
  !gapprompt@>| !gapinput@[2, 2, 1], [1, 4], [2, 2, 4, 2], [1, 1, 2, 2, 1, 2, 2]]);|
  <immutable multidigraph with 4 vertices, 16 edges>
  !gapprompt@gap>| !gapinput@InDegreeOfVertex(D, 1);|
  5
  !gapprompt@gap>| !gapinput@InDegreeOfVertex(D, 2);|
  9
  !gapprompt@gap>| !gapinput@InDegreeOfVertex(D, 3);|
  0
  !gapprompt@gap>| !gapinput@InDegreeOfVertex(D, 4);|
  2
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{InNeighboursOfVertex}}
\logpage{[ 5, 2, 13 ]}\nobreak
\hyperdef{L}{X7C0DA18B8291F302}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{InNeighboursOfVertex({\mdseries\slshape digraph, vertex})\index{InNeighboursOfVertex@\texttt{InNeighboursOfVertex}}
\label{InNeighboursOfVertex}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{InNeighborsOfVertex({\mdseries\slshape digraph, vertex})\index{InNeighborsOfVertex@\texttt{InNeighborsOfVertex}}
\label{InNeighborsOfVertex}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A list of positive vertices.



 This operation returns the list \texttt{inn} of vertices of the digraph \mbox{\texttt{\mdseries\slshape digraph}}. A vertex \texttt{i} appears in the list \texttt{inn} each time there exists an edge with source \texttt{i} and range \mbox{\texttt{\mdseries\slshape vertex}} in \mbox{\texttt{\mdseries\slshape digraph}}; in particular, this means that \texttt{inn} may contain duplicates. 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([|
  !gapprompt@>| !gapinput@[2, 2, 3], [1, 3, 4], [2, 2, 3], [1, 1, 2, 2, 1, 2, 2]]);|
  <immutable multidigraph with 4 vertices, 16 edges>
  !gapprompt@gap>| !gapinput@InNeighboursOfVertex(D, 1);|
  [ 2, 4, 4, 4 ]
  !gapprompt@gap>| !gapinput@InNeighboursOfVertex(D, 2);|
  [ 1, 1, 3, 3, 4, 4, 4, 4 ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphLoops}}
\logpage{[ 5, 2, 14 ]}\nobreak
\hyperdef{L}{X83271F607BD809CF}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphLoops({\mdseries\slshape digraph})\index{DigraphLoops@\texttt{DigraphLoops}}
\label{DigraphLoops}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A list of vertices.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph, then \texttt{DigraphLoops} returns the list consisting of the \texttt{DigraphVertices} (\ref{DigraphVertices}) of \mbox{\texttt{\mdseries\slshape digraph}} at which there is a loop. See \texttt{DigraphHasLoops} (\ref{DigraphHasLoops}). 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[2], [3], []]);|
  <immutable digraph with 3 vertices, 2 edges>
  !gapprompt@gap>| !gapinput@DigraphHasLoops(D);|
  false
  !gapprompt@gap>| !gapinput@DigraphLoops(D);|
  [  ]
  !gapprompt@gap>| !gapinput@D := Digraph([[3, 5], [1], [2, 4, 3], [4], [2, 1]]);|
  <immutable digraph with 5 vertices, 9 edges>
  !gapprompt@gap>| !gapinput@DigraphLoops(D);|
  [ 3, 4 ]
  !gapprompt@gap>| !gapinput@D := Digraph(IsMutableDigraph, [[1], [1]]);|
  <mutable digraph with 2 vertices, 2 edges>
  !gapprompt@gap>| !gapinput@DigraphLoops(D);|
  [ 1 ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DegreeMatrix}}
\logpage{[ 5, 2, 15 ]}\nobreak
\hyperdef{L}{X7BEAE1C78267F54D}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DegreeMatrix({\mdseries\slshape digraph})\index{DegreeMatrix@\texttt{DegreeMatrix}}
\label{DegreeMatrix}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A square matrix of non\texttt{\symbol{45}}negative integers.



 Returns the out\texttt{\symbol{45}}degree matrix \texttt{mat} of the digraph \mbox{\texttt{\mdseries\slshape digraph}}. The value of the \texttt{i}th diagonal matrix entry is the out\texttt{\symbol{45}}degree of the vertex \texttt{i} in \mbox{\texttt{\mdseries\slshape digraph}}. All off\texttt{\symbol{45}}diagonal entries are \texttt{0}. If \mbox{\texttt{\mdseries\slshape digraph}} has no vertices, then the empty list is returned. 

 See \texttt{OutDegrees} (\ref{OutDegrees}) for more information. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[1, 2, 3], [4], [1, 3, 4], []]);|
  <immutable digraph with 4 vertices, 7 edges>
  !gapprompt@gap>| !gapinput@PrintArray(DegreeMatrix(D));|
  [ [  3,  0,  0,  0 ],
    [  0,  1,  0,  0 ],
    [  0,  0,  3,  0 ],
    [  0,  0,  0,  0 ] ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(5);;|
  !gapprompt@gap>| !gapinput@PrintArray(DegreeMatrix(D));|
  [ [  1,  0,  0,  0,  0 ],
    [  0,  1,  0,  0,  0 ],
    [  0,  0,  1,  0,  0 ],
    [  0,  0,  0,  1,  0 ],
    [  0,  0,  0,  0,  1 ] ]
  !gapprompt@gap>| !gapinput@DegreeMatrix(EmptyDigraph(0));|
  [  ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@Display(DegreeMatrix(D));|
  [ [  1,  0,  0 ],
    [  0,  1,  0 ],
    [  0,  0,  1 ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{LaplacianMatrix}}
\logpage{[ 5, 2, 16 ]}\nobreak
\hyperdef{L}{X865390B08331936B}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{LaplacianMatrix({\mdseries\slshape digraph})\index{LaplacianMatrix@\texttt{LaplacianMatrix}}
\label{LaplacianMatrix}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A square matrix of integers.



 Returns the out\texttt{\symbol{45}}degree Laplacian matrix \texttt{mat} of the digraph \mbox{\texttt{\mdseries\slshape digraph}}. The out\texttt{\symbol{45}}degree Laplacian matrix is defined as \texttt{DegreeMatrix(digraph) \texttt{\symbol{45}} AdjacencyMatrix(digraph)}. If \mbox{\texttt{\mdseries\slshape digraph}} has no vertices, then the empty list is returned. 

 See \texttt{DegreeMatrix} (\ref{DegreeMatrix}) and \texttt{AdjacencyMatrix} (\ref{AdjacencyMatrix}) for more information. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gr := Digraph([[1, 2, 3], [4], [1, 3, 4], []]);|
  <immutable digraph with 4 vertices, 7 edges>
  !gapprompt@gap>| !gapinput@PrintArray(LaplacianMatrix(gr));|
  [ [   2,  -1,  -1,   0 ],
    [   0,   1,   0,  -1 ],
    [  -1,   0,   2,  -1 ],
    [   0,   0,   0,   0 ] ]
  !gapprompt@gap>| !gapinput@LaplacianMatrix(EmptyDigraph(0));|
  [  ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@Display(LaplacianMatrix(D));|
  [ [   1,  -1,   0 ],
    [   0,   1,  -1 ],
    [  -1,   0,   1 ] ]
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{Orders}}\logpage{[ 5, 3, 0 ]}
\hyperdef{L}{X86424F167BD4F629}{}
{
 

\subsection{\textcolor{Chapter }{PartialOrderDigraphMeetOfVertices}}
\logpage{[ 5, 3, 1 ]}\nobreak
\hyperdef{L}{X7DDB33B686B3A2C6}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{PartialOrderDigraphMeetOfVertices({\mdseries\slshape digraph, u, v})\index{PartialOrderDigraphMeetOfVertices@\texttt{PartialOrderDigraphMeetOfVertices}}
\label{PartialOrderDigraphMeetOfVertices}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{PartialOrderDigraphJoinOfVertices({\mdseries\slshape digraph, u, v})\index{PartialOrderDigraphJoinOfVertices@\texttt{PartialOrderDigraphJoinOfVertices}}
\label{PartialOrderDigraphJoinOfVertices}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A positive integer or \texttt{fail}



 If the first argument is a partial order digraph \texttt{IsPartialOrderDigraph} (\ref{IsPartialOrderDigraph}) then these operations return the meet, or the join, of the two input vertices.
If the meet (or join) is does not exist then \texttt{fail} is returned. The meet (or join) is guaranteed to exist when the first argument
satisfies \texttt{IsMeetSemilatticeDigraph} (\ref{IsMeetSemilatticeDigraph}) (or \texttt{IsJoinSemilatticeDigraph} (\ref{IsJoinSemilatticeDigraph})) \texttt{\symbol{45}} see the documentation for these properties for the
definition of the meet (or the join). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[1], [1, 2], [1, 3], [1, 2, 3, 4]]);|
  <immutable digraph with 4 vertices, 9 edges>
  !gapprompt@gap>| !gapinput@PartialOrderDigraphMeetOfVertices(D, 2, 3);|
  4
  !gapprompt@gap>| !gapinput@PartialOrderDigraphJoinOfVertices(D, 2, 3);|
  1
  !gapprompt@gap>| !gapinput@PartialOrderDigraphMeetOfVertices(D, 1, 2);|
  2
  !gapprompt@gap>| !gapinput@PartialOrderDigraphJoinOfVertices(D, 3, 4);|
  3
  !gapprompt@gap>| !gapinput@D := Digraph([[1], [2], [1, 2, 3], [1, 2, 4]]);|
  <immutable digraph with 4 vertices, 8 edges>
  !gapprompt@gap>| !gapinput@PartialOrderDigraphMeetOfVertices(D, 3, 4);|
  fail
  !gapprompt@gap>| !gapinput@PartialOrderDigraphJoinOfVertices(D, 3, 4);|
  fail
  !gapprompt@gap>| !gapinput@PartialOrderDigraphMeetOfVertices(D, 1, 2);|
  fail
  !gapprompt@gap>| !gapinput@PartialOrderDigraphJoinOfVertices(D, 1, 2);|
  fail
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{NonUpperSemimodularPair}}
\logpage{[ 5, 3, 2 ]}\nobreak
\hyperdef{L}{X824B9896798530F6}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{NonUpperSemimodularPair({\mdseries\slshape D})\index{NonUpperSemimodularPair@\texttt{NonUpperSemimodularPair}}
\label{NonUpperSemimodularPair}
}\hfill{\scriptsize (attribute)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{NonLowerSemimodularPair({\mdseries\slshape D})\index{NonLowerSemimodularPair@\texttt{NonLowerSemimodularPair}}
\label{NonLowerSemimodularPair}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A pair of vertices or \texttt{fail}.



 \texttt{NonUpperSemimodularPair} returns a pair of vertices in the digraph \mbox{\texttt{\mdseries\slshape D}} that witnesses the fact that \mbox{\texttt{\mdseries\slshape D}} does not represent an upper semimodular lattice, if such a pair exists. 

 If the digraph \mbox{\texttt{\mdseries\slshape D}} does not satisfy \texttt{IsLatticeDigraph} (\ref{IsLatticeDigraph}), then an error is given. Otherwise if the digraph \mbox{\texttt{\mdseries\slshape D}} does satisfy \texttt{IsLatticeDigraph} (\ref{IsLatticeDigraph}), then either a non\texttt{\symbol{45}}upper semimodular pair of vertices is
returned, or \texttt{fail} is returned if no such pair exists (meaning that \mbox{\texttt{\mdseries\slshape D}} is an upper semimodular lattice. 

 \texttt{NonLowerSemimodularPair} behaves in the analogous way to \texttt{NonUpperSemimodularPair} with respect to lower semimodularity. 

 See \texttt{IsUpperSemimodularDigraph} (\ref{IsUpperSemimodularDigraph}) and \texttt{IsLowerSemimodularDigraph} (\ref{IsLowerSemimodularDigraph}) for the definition of upper semimodularity of a lattice. 
\begin{Verbatim}[commandchars=!|E,fontsize=\small,frame=single,label=Example]
  !gapprompt|gap>E !gapinput|D := DigraphFromDigraph6String(E
  !gapprompt|>E !gapinput|"&M~~sc`lYUZO__KIBboC_@h?U_?_GL?A_?c");E
  <immutable digraph with 14 vertices, 66 edges>
  !gapprompt|gap>E !gapinput|NonLowerSemimodularPair(D);E
  [ 10, 9 ]
  !gapprompt|gap>E !gapinput|NonUpperSemimodularPair(D);E
  fail
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{Reachability and connectivity}}\logpage{[ 5, 4, 0 ]}
\hyperdef{L}{X8537F4088400DC48}{}
{
 

\subsection{\textcolor{Chapter }{DigraphDiameter}}
\logpage{[ 5, 4, 1 ]}\nobreak
\hyperdef{L}{X7F16B9EB8398459C}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphDiameter({\mdseries\slshape digraph})\index{DigraphDiameter@\texttt{DigraphDiameter}}
\label{DigraphDiameter}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
An integer or \texttt{fail}.



 This function returns the diameter of the digraph \mbox{\texttt{\mdseries\slshape digraph}}. 

 If a digraph \mbox{\texttt{\mdseries\slshape digraph}} is strongly connected and has at least 1 vertex, then the \emph{diameter} is the maximum shortest distance between any pair of distinct vertices.
Otherwise then the diameter of \mbox{\texttt{\mdseries\slshape digraph}} is undefined, and this function returns the value \texttt{fail}. 

 See \texttt{DigraphShortestDistances} (\ref{DigraphShortestDistances}). 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[2], [3], [4, 5], [5], [1, 2, 3, 4, 5]]);|
  <immutable digraph with 5 vertices, 10 edges>
  !gapprompt@gap>| !gapinput@DigraphDiameter(D);|
  3
  !gapprompt@gap>| !gapinput@D := ChainDigraph(2);|
  <immutable chain digraph with 2 vertices>
  !gapprompt@gap>| !gapinput@DigraphDiameter(D);|
  fail
  !gapprompt@gap>| !gapinput@IsStronglyConnectedDigraph(D);|
  false
  !gapprompt@gap>| !gapinput@D := GeneralisedPetersenGraph(IsMutableDigraph, 6, 2);|
  <mutable digraph with 12 vertices, 36 edges>
  !gapprompt@gap>| !gapinput@DigraphDiameter(D);|
  4
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphShortestDistance (for a digraph and two vertices)}}
\logpage{[ 5, 4, 2 ]}\nobreak
\hyperdef{L}{X8104A9D37BCD8A05}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphShortestDistance({\mdseries\slshape digraph, u, v})\index{DigraphShortestDistance@\texttt{DigraphShortestDistance}!for a digraph and two vertices}
\label{DigraphShortestDistance:for a digraph and two vertices}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphShortestDistance({\mdseries\slshape digraph, list})\index{DigraphShortestDistance@\texttt{DigraphShortestDistance}!for a digraph and a list}
\label{DigraphShortestDistance:for a digraph and a list}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphShortestDistance({\mdseries\slshape digraph, list1, list2})\index{DigraphShortestDistance@\texttt{DigraphShortestDistance}!for a digraph, a list, and a list}
\label{DigraphShortestDistance:for a digraph, a list, and a list}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
An integer or \texttt{fail}



 If there is a directed path in the digraph \mbox{\texttt{\mdseries\slshape digraph}} between vertex \mbox{\texttt{\mdseries\slshape u}} and vertex \mbox{\texttt{\mdseries\slshape v}}, then this operation returns the length of the shortest such directed path.
If no such directed path exists, then this operation returns \texttt{fail}. See Section \ref{Definitions} for the definition of a directed path. 

 If the second form is used, then \mbox{\texttt{\mdseries\slshape list}} should be a list of length two, containing two positive integers which
correspond to the vertices \mbox{\texttt{\mdseries\slshape u}} and \mbox{\texttt{\mdseries\slshape v}}. 

 Note that as usual, a vertex is considered to be at distance 0 from itself .

 If the third form is used, then \mbox{\texttt{\mdseries\slshape list1}} and \mbox{\texttt{\mdseries\slshape list2}} are both lists of vertices. The shortest directed path between \mbox{\texttt{\mdseries\slshape list1}} and \mbox{\texttt{\mdseries\slshape list2}} is then the length of the shortest directed path which starts with a vertex in \mbox{\texttt{\mdseries\slshape list1}} and terminates at a vertex in \mbox{\texttt{\mdseries\slshape list2}}, if such directed path exists. If \mbox{\texttt{\mdseries\slshape list1}} and \mbox{\texttt{\mdseries\slshape list2}} have non\texttt{\symbol{45}}empty intersection, the operation returns \texttt{0}.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[2], [3], [1, 4], [1, 3], [5]]);|
  <immutable digraph with 5 vertices, 7 edges>
  !gapprompt@gap>| !gapinput@DigraphShortestDistance(D, 1, 3);|
  2
  !gapprompt@gap>| !gapinput@DigraphShortestDistance(D, [3, 3]);|
  0
  !gapprompt@gap>| !gapinput@DigraphShortestDistance(D, 5, 2);|
  fail
  !gapprompt@gap>| !gapinput@DigraphShortestDistance(D, [1, 2], [4, 5]);|
  2
  !gapprompt@gap>| !gapinput@DigraphShortestDistance(D, [1, 3], [3, 5]);|
  0
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphShortestDistances}}
\logpage{[ 5, 4, 3 ]}\nobreak
\hyperdef{L}{X81F99BC67E9D050F}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphShortestDistances({\mdseries\slshape digraph})\index{DigraphShortestDistances@\texttt{DigraphShortestDistances}}
\label{DigraphShortestDistances}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A square matrix.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph with $n$ vertices, then this function returns an $n \times n$ matrix \texttt{mat}, where each entry is either a non\texttt{\symbol{45}}negative integer, or \texttt{fail}. If $n = 0$, then an empty list is returned. 

 If there is a directed path from vertex \texttt{i} to vertex \texttt{j}, then the value of \texttt{mat[i][j]} is the length of the shortest such directed path. If no such directed path
exists, then the value of \texttt{mat[i][j]} is \texttt{fail}. We use the convention that the distance from every vertex to itself is \texttt{0}, i.e. \texttt{mat[i][i] = 0} for all vertice\texttt{i}. 

 The method used in this function is a version of the
Floyd\texttt{\symbol{45}}Warshall algorithm, and has complexity $O(n^3)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[1, 2], [3], [1, 2], [4]]);|
  <immutable digraph with 4 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@mat := DigraphShortestDistances(D);;|
  !gapprompt@gap>| !gapinput@PrintArray(mat);|
  [ [     0,     1,     2,  fail ],
    [     2,     0,     1,  fail ],
    [     1,     1,     0,  fail ],
    [  fail,  fail,  fail,     0 ] ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphShortestDistances(D);|
  [ [ 0, 1, 2 ], [ 2, 0, 1 ], [ 1, 2, 0 ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphLongestDistanceFromVertex}}
\logpage{[ 5, 4, 4 ]}\nobreak
\hyperdef{L}{X8223718079D98A82}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphLongestDistanceFromVertex({\mdseries\slshape digraph, v})\index{DigraphLongestDistanceFromVertex@\texttt{DigraphLongestDistanceFromVertex}}
\label{DigraphLongestDistanceFromVertex}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
An integer, or \texttt{infinity}.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph and \mbox{\texttt{\mdseries\slshape v}} is a vertex in \mbox{\texttt{\mdseries\slshape digraph}}, then this operation returns the length of the longest directed walk in \mbox{\texttt{\mdseries\slshape digraph}} which begins at vertex \mbox{\texttt{\mdseries\slshape v}}. See Section \ref{Definitions} for the definitions of directed walk, directed cycle, and loop. 

 
\begin{itemize}
\item  If there exists a directed walk starting at vertex \mbox{\texttt{\mdseries\slshape v}} which traverses a loop or a directed cycle, then we consider there to be a
walk of infinite length from \mbox{\texttt{\mdseries\slshape v}} (realised by repeatedly traversing the loop/directed cycle), and so the result
is \texttt{infinity}. To disallow walks using loops, try using \texttt{DigraphRemoveLoops} (\ref{DigraphRemoveLoops}):

 \texttt{DigraphLongestDistanceFromVertex(DigraphRemoveLoops(\mbox{\texttt{\mdseries\slshape digraph}},\mbox{\texttt{\mdseries\slshape v}}))}. 
\item  Otherwise, if all directed walks starting at vertex \mbox{\texttt{\mdseries\slshape v}} have finite length, then the length of the longest such walk is returned. 
\end{itemize}
 Note that the result is \texttt{0} if and only if \mbox{\texttt{\mdseries\slshape v}} is a sink of \mbox{\texttt{\mdseries\slshape digraph}}. See \texttt{DigraphSinks} (\ref{DigraphSinks}). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[2], [3, 4], [], [5], [], [6]]);|
  <immutable digraph with 6 vertices, 5 edges>
  !gapprompt@gap>| !gapinput@DigraphLongestDistanceFromVertex(D, 1);|
  3
  !gapprompt@gap>| !gapinput@DigraphLongestDistanceFromVertex(D, 3);|
  0
  !gapprompt@gap>| !gapinput@3 in DigraphSinks(D);|
  true
  !gapprompt@gap>| !gapinput@DigraphLongestDistanceFromVertex(D, 6);|
  infinity
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphDistanceSet (for a digraph, a pos int, and an int)}}
\logpage{[ 5, 4, 5 ]}\nobreak
\hyperdef{L}{X7CB7DDCD84621D38}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphDistanceSet({\mdseries\slshape digraph, vertex, distance})\index{DigraphDistanceSet@\texttt{DigraphDistanceSet}!for a digraph, a pos int, and an int}
\label{DigraphDistanceSet:for a digraph, a pos int, and an int}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphDistanceSet({\mdseries\slshape digraph, vertex, distances})\index{DigraphDistanceSet@\texttt{DigraphDistanceSet}!for a digraph, a pos int, and a list}
\label{DigraphDistanceSet:for a digraph, a pos int, and a list}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A list of vertices



 This operation returns the list of all vertices in digraph \mbox{\texttt{\mdseries\slshape digraph}} such that the shortest distance to a vertex \mbox{\texttt{\mdseries\slshape vertex}} is \mbox{\texttt{\mdseries\slshape distance}} or is in the list \mbox{\texttt{\mdseries\slshape distances}}. 

 \mbox{\texttt{\mdseries\slshape digraph}} should be a digraph, \mbox{\texttt{\mdseries\slshape vertex}} should be a positive integer, \mbox{\texttt{\mdseries\slshape distance}} should be a non\texttt{\symbol{45}}negative integer, and \mbox{\texttt{\mdseries\slshape distances}} should be a list of non\texttt{\symbol{45}}negative integers. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[2], [3], [1, 4], [1, 3]]);|
  <immutable digraph with 4 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@DigraphDistanceSet(D, 2, [1, 2]);|
  [ 3, 1, 4 ]
  !gapprompt@gap>| !gapinput@DigraphDistanceSet(D, 3, 1);|
  [ 1, 4 ]
  !gapprompt@gap>| !gapinput@DigraphDistanceSet(D, 2, 0);|
  [ 2 ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphGirth}}
\logpage{[ 5, 4, 6 ]}\nobreak
\hyperdef{L}{X79A3DA4078CF3C90}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphGirth({\mdseries\slshape digraph})\index{DigraphGirth@\texttt{DigraphGirth}}
\label{DigraphGirth}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
An integer, or \texttt{infinity}.



 This attribute returns the \emph{girth} of the digraph \mbox{\texttt{\mdseries\slshape digraph}}. The \emph{girth} of a digraph is the length of its shortest simple circuit. See Section \ref{Definitions} for the definitions of simple circuit, directed cycle, and loop. 

 If \mbox{\texttt{\mdseries\slshape digraph}} has no directed cycles, then this function will return \texttt{infinity}. If \mbox{\texttt{\mdseries\slshape digraph}} contains a loop, then this function will return \texttt{1}. 

 In the worst case, the method used in this function is a version of the
Floyd\texttt{\symbol{45}}Warshall algorithm, and has complexity \texttt{O(\mbox{\texttt{\mdseries\slshape n}} \texttt{\symbol{94}} 3)}, where \mbox{\texttt{\mdseries\slshape n}} is the number of vertices in \mbox{\texttt{\mdseries\slshape digraph}}. If the digraph has known automorphisms [see \texttt{DigraphGroup} (\ref{DigraphGroup})], then the performance is likely to be better. 

 For symmetric digraphs, see also \texttt{DigraphUndirectedGirth} (\ref{DigraphUndirectedGirth}). 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[1], [1]]);|
  <immutable digraph with 2 vertices, 2 edges>
  !gapprompt@gap>| !gapinput@DigraphGirth(D);|
  1
  !gapprompt@gap>| !gapinput@D := Digraph([[2, 3], [3], [4], []]);|
  <immutable digraph with 4 vertices, 4 edges>
  !gapprompt@gap>| !gapinput@DigraphGirth(D);|
  infinity
  !gapprompt@gap>| !gapinput@D := Digraph([[2, 3], [3], [4], [1]]);|
  <immutable digraph with 4 vertices, 5 edges>
  !gapprompt@gap>| !gapinput@DigraphGirth(D);|
  3
  !gapprompt@gap>| !gapinput@D := GeneralisedPetersenGraph(IsMutableDigraph, 6, 2);|
  <mutable digraph with 12 vertices, 36 edges>
  !gapprompt@gap>| !gapinput@DigraphGirth(D);|
  2
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphOddGirth}}
\logpage{[ 5, 4, 7 ]}\nobreak
\hyperdef{L}{X8374B7357EC189C1}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphOddGirth({\mdseries\slshape digraph})\index{DigraphOddGirth@\texttt{DigraphOddGirth}}
\label{DigraphOddGirth}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
An integer, or \texttt{infinity}.



 This attribute returns the \emph{odd girth} of the digraph \mbox{\texttt{\mdseries\slshape digraph}}. The \emph{odd girth} of a digraph is the length of its shortest simple circuit of odd length. See
Section \ref{Definitions} for the definitions of simple circuit, directed cycle, and loop. 

 If \mbox{\texttt{\mdseries\slshape digraph}} has no directed cycles of odd length, then this function will return \texttt{infinity}, even if \mbox{\texttt{\mdseries\slshape digraph}} has a directed cycle of even length. If \mbox{\texttt{\mdseries\slshape digraph}} contains a loop, then this function will return \texttt{1}. 

 See also \texttt{DigraphGirth} (\ref{DigraphGirth}). 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[2], [3, 1], [1]]);|
  <immutable digraph with 3 vertices, 4 edges>
  !gapprompt@gap>| !gapinput@DigraphOddGirth(D);|
  3
  !gapprompt@gap>| !gapinput@D := CycleDigraph(4);|
  <immutable cycle digraph with 4 vertices>
  !gapprompt@gap>| !gapinput@DigraphOddGirth(D);|
  infinity
  !gapprompt@gap>| !gapinput@D := Digraph([[2], [3], [], [3], [4]]);|
  <immutable digraph with 5 vertices, 4 edges>
  !gapprompt@gap>| !gapinput@DigraphOddGirth(D);|
  infinity
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 4);|
  <mutable digraph with 4 vertices, 4 edges>
  !gapprompt@gap>| !gapinput@DigraphDisjointUnion(D, CycleDigraph(5));|
  <mutable digraph with 9 vertices, 9 edges>
  !gapprompt@gap>| !gapinput@DigraphOddGirth(D);|
  5
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphUndirectedGirth}}
\logpage{[ 5, 4, 8 ]}\nobreak
\hyperdef{L}{X84688B337BDDBB09}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphUndirectedGirth({\mdseries\slshape digraph})\index{DigraphUndirectedGirth@\texttt{DigraphUndirectedGirth}}
\label{DigraphUndirectedGirth}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
An integer or \texttt{infinity}.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a symmetric digraph, then this function returns the girth of \mbox{\texttt{\mdseries\slshape digraph}} when treated as an undirected graph (i.e. each pair of edges $[i, j]$ and $[j, i]$ is treated as a single edge between $i$ and $j$). 

 The \emph{girth} of an undirected graph is the length of its shortest simple cycle, i.e. the
shortest non\texttt{\symbol{45}}trivial path starting and ending at the same
vertex and passing through no vertex or edge more than once. 

 If \mbox{\texttt{\mdseries\slshape digraph}} has no cycles, then this function will return \texttt{infinity}. 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[2, 4], [1, 3], [2, 4], [1, 3]]);|
  <immutable digraph with 4 vertices, 8 edges>
  !gapprompt@gap>| !gapinput@DigraphUndirectedGirth(D);|
  4
  !gapprompt@gap>| !gapinput@D := Digraph([[2], [1, 3], [2]]);|
  <immutable digraph with 3 vertices, 4 edges>
  !gapprompt@gap>| !gapinput@DigraphUndirectedGirth(D);|
  infinity
  !gapprompt@gap>| !gapinput@D := Digraph([[1], [], [4], [3]]);|
  <immutable digraph with 4 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphUndirectedGirth(D);|
  1
  !gapprompt@gap>| !gapinput@D := GeneralisedPetersenGraph(IsMutableDigraph, 9, 2);|
  <mutable digraph with 18 vertices, 54 edges>
  !gapprompt@gap>| !gapinput@DigraphUndirectedGirth(D);|
  5
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphConnectedComponents}}
\logpage{[ 5, 4, 9 ]}\nobreak
\hyperdef{L}{X842FAD6A7B835977}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphConnectedComponents({\mdseries\slshape digraph})\index{DigraphConnectedComponents@\texttt{DigraphConnectedComponents}}
\label{DigraphConnectedComponents}
}\hfill{\scriptsize (attribute)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphNrConnectedComponents({\mdseries\slshape digraph})\index{DigraphNrConnectedComponents@\texttt{DigraphNrConnectedComponents}}
\label{DigraphNrConnectedComponents}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A record.



 This function returns the record \texttt{wcc} corresponding to the weakly connected components of the digraph \mbox{\texttt{\mdseries\slshape digraph}}. Two vertices of \mbox{\texttt{\mdseries\slshape digraph}} are in the same weakly connected component whenever they are equal, or there
exists a directed path (ignoring the orientation of edges) between them. More
formally, two vertices are in the same weakly connected component of \mbox{\texttt{\mdseries\slshape digraph}} if and only if they are in the same strongly connected component (see \texttt{DigraphStronglyConnectedComponents} (\ref{DigraphStronglyConnectedComponents})) of the \texttt{DigraphSymmetricClosure} (\ref{DigraphSymmetricClosure}) of \mbox{\texttt{\mdseries\slshape digraph}}. 

 The set of weakly connected components is a partition of the vertex set of \mbox{\texttt{\mdseries\slshape digraph}}. 

 The record \texttt{wcc} has 2 components: \texttt{comps} and \texttt{id}. The component \texttt{comps} is a list of the weakly connected components of \mbox{\texttt{\mdseries\slshape digraph}} (each of which is a list of vertices). The component \texttt{id} is a list such that the vertex \texttt{i} is an element of the weakly connected component \texttt{comps[id[i]]}. 

 The method used in this function has complexity $O(m+n)$, where $m$ is the number of edges and $n$ is the number of vertices in the digraph. 

 \texttt{DigraphNrConnectedComponents(\mbox{\texttt{\mdseries\slshape digraph}})} is simply a shortcut for \texttt{Length(DigraphConnectedComponents(\mbox{\texttt{\mdseries\slshape digraph}}).comps)}, and is no more efficient. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gr := Digraph([[2], [3, 1], []]);|
  <immutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphConnectedComponents(gr);|
  rec( comps := [ [ 1, 2, 3 ] ], id := [ 1, 1, 1 ] )
  !gapprompt@gap>| !gapinput@gr := Digraph([[1], [1, 2], []]);|
  <immutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphConnectedComponents(gr);|
  rec( comps := [ [ 1, 2 ], [ 3 ] ], id := [ 1, 1, 2 ] )
  !gapprompt@gap>| !gapinput@DigraphNrConnectedComponents(gr);|
  2
  !gapprompt@gap>| !gapinput@gr := EmptyDigraph(0);|
  <immutable empty digraph with 0 vertices>
  !gapprompt@gap>| !gapinput@DigraphConnectedComponents(gr);|
  rec( comps := [  ], id := [  ] )
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 2);|
  <mutable digraph with 2 vertices, 2 edges>
  !gapprompt@gap>| !gapinput@G := CycleDigraph(3);|
  <immutable cycle digraph with 3 vertices>
  !gapprompt@gap>| !gapinput@DigraphDisjointUnion(D, G);|
  <mutable digraph with 5 vertices, 5 edges>
  !gapprompt@gap>| !gapinput@DigraphConnectedComponents(D);|
  rec( comps := [ [ 1, 2 ], [ 3, 4, 5 ] ], id := [ 1, 1, 2, 2, 2 ] )
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphConnectedComponent}}
\logpage{[ 5, 4, 10 ]}\nobreak
\hyperdef{L}{X8484EC557810CD31}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphConnectedComponent({\mdseries\slshape digraph, vertex})\index{DigraphConnectedComponent@\texttt{DigraphConnectedComponent}}
\label{DigraphConnectedComponent}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A list of vertices.



 If \mbox{\texttt{\mdseries\slshape vertex}} is a vertex in the digraph \mbox{\texttt{\mdseries\slshape digraph}}, then this operation returns the connected component of \mbox{\texttt{\mdseries\slshape vertex}} in \mbox{\texttt{\mdseries\slshape digraph}}. See \texttt{DigraphConnectedComponents} (\ref{DigraphConnectedComponents}) for more information. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[3], [2], [1, 2], [4]]);|
  <immutable digraph with 4 vertices, 5 edges>
  !gapprompt@gap>| !gapinput@DigraphConnectedComponent(D, 3);|
  [ 1, 2, 3 ]
  !gapprompt@gap>| !gapinput@DigraphConnectedComponent(D, 2);|
  [ 1, 2, 3 ]
  !gapprompt@gap>| !gapinput@DigraphConnectedComponent(D, 4);|
  [ 4 ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphStronglyConnectedComponents}}
\logpage{[ 5, 4, 11 ]}\nobreak
\hyperdef{L}{X833ECD6B7A84944C}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphStronglyConnectedComponents({\mdseries\slshape digraph})\index{DigraphStronglyConnectedComponents@\texttt{DigraphStronglyConnectedComponents}}
\label{DigraphStronglyConnectedComponents}
}\hfill{\scriptsize (attribute)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphNrStronglyConnectedComponents({\mdseries\slshape digraph})\index{DigraphNrStronglyConnectedComponents@\texttt{Digraph}\-\texttt{Nr}\-\texttt{Strongly}\-\texttt{Connected}\-\texttt{Components}}
\label{DigraphNrStronglyConnectedComponents}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A record.



 This function returns the record \texttt{scc} corresponding to the strongly connected components of the digraph \mbox{\texttt{\mdseries\slshape digraph}}. Two vertices of \mbox{\texttt{\mdseries\slshape digraph}} are in the same strongly connected component whenever they are equal, or there
is a directed path from each vertex to the other. The set of strongly
connected components is a partition of the vertex set of \mbox{\texttt{\mdseries\slshape digraph}}. 

 The record \texttt{scc} has 2 components: \texttt{comps} and \texttt{id}. The component \texttt{comps} is a list of the strongly connected components of \mbox{\texttt{\mdseries\slshape digraph}} (each of which is a list of vertices). The component \texttt{id} is a list such that the vertex \texttt{i} is an element of the strongly connected component \texttt{comps[id[i]]}

 The method used in this function is a non\texttt{\symbol{45}}recursive version
of Gabow's Algorithm \cite{Gab00} and has complexity $O(m+n)$ where $m$ is the number of edges (counting multiple edges as one) and $n$ is the number of vertices in the digraph. 

 \texttt{DigraphNrStronglyConnectedComponents(\mbox{\texttt{\mdseries\slshape digraph}})} is simply a shortcut for \texttt{Length(DigraphStronglyConnectedComponents(\mbox{\texttt{\mdseries\slshape digraph}}).comps)}, and is no more efficient. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gr := Digraph([[2], [3, 1], []]);|
  <immutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphStronglyConnectedComponents(gr);|
  rec( comps := [ [ 3 ], [ 1, 2 ] ], id := [ 2, 2, 1 ] )
  !gapprompt@gap>| !gapinput@DigraphNrStronglyConnectedComponents(gr);|
  2
  !gapprompt@gap>| !gapinput@D := DigraphDisjointUnion(CycleDigraph(4), CycleDigraph(5));|
  <immutable digraph with 9 vertices, 9 edges>
  !gapprompt@gap>| !gapinput@DigraphStronglyConnectedComponents(D);|
  rec( comps := [ [ 1, 2, 3, 4 ], [ 5, 6, 7, 8, 9 ] ], 
    id := [ 1, 1, 1, 1, 2, 2, 2, 2, 2 ] )
  !gapprompt@gap>| !gapinput@DigraphNrStronglyConnectedComponents(D);|
  2
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 2);|
  <mutable digraph with 2 vertices, 2 edges>
  !gapprompt@gap>| !gapinput@G := CycleDigraph(3);|
  <immutable cycle digraph with 3 vertices>
  !gapprompt@gap>| !gapinput@DigraphDisjointUnion(D, G);|
  <mutable digraph with 5 vertices, 5 edges>
  !gapprompt@gap>| !gapinput@DigraphStronglyConnectedComponents(D);|
  rec( comps := [ [ 1, 2 ], [ 3, 4, 5 ] ], id := [ 1, 1, 2, 2, 2 ] )
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphStronglyConnectedComponent}}
\logpage{[ 5, 4, 12 ]}\nobreak
\hyperdef{L}{X7EFCB5017D662254}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphStronglyConnectedComponent({\mdseries\slshape digraph, vertex})\index{DigraphStronglyConnectedComponent@\texttt{DigraphStronglyConnectedComponent}}
\label{DigraphStronglyConnectedComponent}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A list of vertices.



 If \mbox{\texttt{\mdseries\slshape vertex}} is a vertex in the digraph \mbox{\texttt{\mdseries\slshape digraph}}, then this operation returns the strongly connected component of \mbox{\texttt{\mdseries\slshape vertex}} in \mbox{\texttt{\mdseries\slshape digraph}}. Se\texttt{DigraphStronglyConnectedComponents} (\ref{DigraphStronglyConnectedComponents}) for more information. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[3], [2], [1, 2], [3]]);|
  <immutable digraph with 4 vertices, 5 edges>
  !gapprompt@gap>| !gapinput@DigraphStronglyConnectedComponent(D, 3);|
  [ 1, 3 ]
  !gapprompt@gap>| !gapinput@DigraphStronglyConnectedComponent(D, 2);|
  [ 2 ]
  !gapprompt@gap>| !gapinput@DigraphStronglyConnectedComponent(D, 4);|
  [ 4 ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphBicomponents}}
\logpage{[ 5, 4, 13 ]}\nobreak
\hyperdef{L}{X7F1B5A2782F598B1}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphBicomponents({\mdseries\slshape digraph})\index{DigraphBicomponents@\texttt{DigraphBicomponents}}
\label{DigraphBicomponents}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A pair of lists of vertices, or \texttt{fail}.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a bipartite digraph, i.e. if it satisfies \texttt{IsBipartiteDigraph} (\ref{IsBipartiteDigraph}), then \texttt{DigraphBicomponents} returns a pair of bicomponents of \mbox{\texttt{\mdseries\slshape digraph}}. Otherwise, \texttt{DigraphBicomponents} returns \texttt{fail}.

 For a bipartite digraph, the vertices can be partitioned into two
non\texttt{\symbol{45}}empty sets such that the source and range of any edge
are in distinct sets. The parts of this partition are called \emph{bicomponents} of \mbox{\texttt{\mdseries\slshape digraph}}. Equivalently, a pair of bicomponents of \mbox{\texttt{\mdseries\slshape digraph}} consists of the color\texttt{\symbol{45}}classes of a
2\texttt{\symbol{45}}coloring of \mbox{\texttt{\mdseries\slshape digraph}}. 

 For a bipartite digraph with at least 3 vertices, there is a unique pair of
bicomponents of bipartite if and only if the digraph is connected. See \texttt{IsConnectedDigraph} (\ref{IsConnectedDigraph}) for more information. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(3);|
  <immutable cycle digraph with 3 vertices>
  !gapprompt@gap>| !gapinput@DigraphBicomponents(D);|
  fail
  !gapprompt@gap>| !gapinput@D := ChainDigraph(5);|
  <immutable chain digraph with 5 vertices>
  !gapprompt@gap>| !gapinput@DigraphBicomponents(D);|
  [ [ 1, 3, 5 ], [ 2, 4 ] ]
  !gapprompt@gap>| !gapinput@D := Digraph([[5], [1, 4], [5], [5], []]);|
  <immutable digraph with 5 vertices, 5 edges>
  !gapprompt@gap>| !gapinput@DigraphBicomponents(D);|
  [ [ 1, 3, 4 ], [ 2, 5 ] ]
  !gapprompt@gap>| !gapinput@D := CompleteBipartiteDigraph(IsMutableDigraph, 2, 3);|
  <mutable digraph with 5 vertices, 12 edges>
  !gapprompt@gap>| !gapinput@DigraphBicomponents(D);|
  [ [ 1, 2 ], [ 3, 4, 5 ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{ArticulationPoints}}
\logpage{[ 5, 4, 14 ]}\nobreak
\hyperdef{L}{X7DDE06E47E605DD7}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{ArticulationPoints({\mdseries\slshape digraph})\index{ArticulationPoints@\texttt{ArticulationPoints}}
\label{ArticulationPoints}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A list of vertices.



 A connected digraph is \emph{biconnected} if it is still connected (in the sense of \texttt{IsConnectedDigraph} (\ref{IsConnectedDigraph})) when any vertex is removed. If the digraph \mbox{\texttt{\mdseries\slshape digraph}} is not biconnected but is connected, then any verte\texttt{v} of \mbox{\texttt{\mdseries\slshape digraph}} whose removal makes the resulting digraph disconnected is called an \emph{articulation point}.

 \texttt{ArticulationPoints} returns a list of the articulation points of \mbox{\texttt{\mdseries\slshape digraph}}, if any, and, in particular, returns the empty list if \mbox{\texttt{\mdseries\slshape digraph}} is not connected. 

 Multiple edges are ignored by this method. 

 The method used in this operation has complexity $O(m+n)$ where $m$ is the number of edges and $n$ is the number of vertices in the digraph.

 If \mbox{\texttt{\mdseries\slshape D}} has a bridge (see \texttt{Bridges} (\ref{Bridges})), then a node incident to the bridge is an articulation point if and only if
it has degree at least $2$. It follows that if \mbox{\texttt{\mdseries\slshape D}} has a bridge and at least $3$ nodes, then at least one of the nodes incident to the bridge is an
articulation point. The converse does not hold, there are digraphs with
articulation points, but no bridges. 

 See also \texttt{IsBiconnectedDigraph} (\ref{IsBiconnectedDigraph}) and \texttt{IsBridgelessDigraph} (\ref{IsBridgelessDigraph}). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@ArticulationPoints(CycleDigraph(5));|
  [  ]
  !gapprompt@gap>| !gapinput@D := Digraph([[2, 7], [3, 5], [4], [2], [6], [1], []]);;|
  !gapprompt@gap>| !gapinput@ArticulationPoints(D);|
  [ 1, 2 ]
  !gapprompt@gap>| !gapinput@ArticulationPoints(ChainDigraph(5));|
  [ 2, 3, 4 ]
  !gapprompt@gap>| !gapinput@ArticulationPoints(NullDigraph(5));|
  [  ]
  !gapprompt@gap>| !gapinput@D := ChainDigraph(IsMutableDigraph, 4);|
  <mutable digraph with 4 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@ArticulationPoints(D);|
  [ 2, 3 ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{MinimalCyclicEdgeCut}}
\logpage{[ 5, 4, 15 ]}\nobreak
\hyperdef{L}{X803459AB86AB9BE2}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{MinimalCyclicEdgeCut({\mdseries\slshape digraph})\index{MinimalCyclicEdgeCut@\texttt{MinimalCyclicEdgeCut}}
\label{MinimalCyclicEdgeCut}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A list of edges or \texttt{fail}.



 A cyclic edge cut of \mbox{\texttt{\mdseries\slshape digraph}} is a set of edges such that deleting these edges results in at least two
connected components having a cycle. This method computes the cyclic edge cut
with minimal cardinality for cubic graphs with at least 8 vertices. The cyclic
edge cut is returned as a list of undirected edges.

 If the given digraph is not cubic, not connected, has less than 8 vertices or
does not have a cyclic edge cut, the method returns \texttt{fail}. Multiple edges of \mbox{\texttt{\mdseries\slshape digraph}} are ignored by this method and note that \mbox{\texttt{\mdseries\slshape digraph}} is identified as an undirected graph. 

 The method used in this method has complexity $O(n^2*log^2(n)) $ where $n$ is the number of vertices in the digraph.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@MinimalCyclicEdgeCut(HypercubeGraph(3));|
  [ [ 1, 5 ], [ 2, 6 ], [ 4, 8 ], [ 3, 7 ] ]
  !gapprompt@gap>| !gapinput@MinimalCyclicEdgeCut(CompleteDigraph(4));|
  fail
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{Bridges}}
\logpage{[ 5, 4, 16 ]}\nobreak
\hyperdef{L}{X84D5A125848BD800}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{Bridges({\mdseries\slshape D})\index{Bridges@\texttt{Bridges}}
\label{Bridges}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A (possibly empty) list of edges.



 A connected digraph is \emph{2\texttt{\symbol{45}}edge\texttt{\symbol{45}}connected} if it is still connected (in the sense of \texttt{IsConnectedDigraph} (\ref{IsConnectedDigraph})) when any edge is removed. If the digraph \mbox{\texttt{\mdseries\slshape D}} is not 2\texttt{\symbol{45}}edge\texttt{\symbol{45}}connected but is
connected, then any edge \texttt{[u, v]} of \mbox{\texttt{\mdseries\slshape D}} whose removal makes the resulting digraph disconnected is called a \emph{bridge}.

 \texttt{Bridges} returns a list of the bridges of \mbox{\texttt{\mdseries\slshape D}}, if any, and, in particular, returns the empty list if \mbox{\texttt{\mdseries\slshape D}} is not connected. 

 Multiple edges are ignored by this method. 

 The method used in this operation has complexity $O(m+n)$ where $m$ is the number of edges and $n$ is the number of vertices in the digraph. 

 If \mbox{\texttt{\mdseries\slshape D}} has a bridge, then a node incident to the bridge is an articulation point (see \texttt{ArticulationPoints} (\ref{ArticulationPoints})) if and only if it has degree at least $2$. It follows that if \mbox{\texttt{\mdseries\slshape D}} has a bridge and at least $3$ nodes, then at least one of the nodes incident to the bridge is an
articulation point. The converse does not hold, there are digraphs with
articulation points, but no bridges. 

 See also \texttt{IsBiconnectedDigraph} (\ref{IsBiconnectedDigraph}) and \texttt{IsBridgelessDigraph} (\ref{IsBridgelessDigraph}). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[2, 5], [1, 3, 4, 5], [2, 4], [2, 3], [1, 2]]);|
  <immutable digraph with 5 vertices, 12 edges>
  !gapprompt@gap>| !gapinput@Bridges(D);|
  [  ]
  !gapprompt@gap>| !gapinput@D := Digraph([[2], [3], [4], [2]]);|
  <immutable digraph with 4 vertices, 4 edges>
  !gapprompt@gap>| !gapinput@Bridges(D);|
  [ [ 1, 2 ] ]
  !gapprompt@gap>| !gapinput@Bridges(ChainDigraph(2));|
  [ [ 1, 2 ] ]
  !gapprompt@gap>| !gapinput@ArticulationPoints(ChainDigraph(2));|
  [  ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{StrongOrientation}}
\logpage{[ 5, 4, 17 ]}\nobreak
\hyperdef{L}{X865590147BD1C507}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{StrongOrientation({\mdseries\slshape D})\index{StrongOrientation@\texttt{StrongOrientation}}
\label{StrongOrientation}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{StrongOrientationAttr({\mdseries\slshape D})\index{StrongOrientationAttr@\texttt{StrongOrientationAttr}}
\label{StrongOrientationAttr}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A digraph or \texttt{fail}.



 A \emph{strong orientation} of a connected symmetric digraph \mbox{\texttt{\mdseries\slshape D}} (if it exists) is a strongly connected subdigraph \texttt{C} of \mbox{\texttt{\mdseries\slshape D}} such that for every edge \texttt{[u, v]} of \mbox{\texttt{\mdseries\slshape D}} either \texttt{[u, v]} or \texttt{[v, u]} is an edge of \texttt{C} but not both. Robbin's Theorem states that a digraph admits a strong
orientation if and only if it is bridgeless (see \texttt{IsBridgelessDigraph} (\ref{IsBridgelessDigraph})). 

 This operation returns a strong orientation of the digraph \mbox{\texttt{\mdseries\slshape D}} if \mbox{\texttt{\mdseries\slshape D}} is symmetric and \mbox{\texttt{\mdseries\slshape D}} admits a strong orientation. If \mbox{\texttt{\mdseries\slshape D}} is symmetric but does not admit a strong orientation, then \texttt{fail} is returned. If \mbox{\texttt{\mdseries\slshape D}} is not symmetric, then an error is given. 

 If \mbox{\texttt{\mdseries\slshape D}} is immutable, \texttt{StrongOrientation(\mbox{\texttt{\mdseries\slshape D}})} returns an immutable digraph, and if \mbox{\texttt{\mdseries\slshape D}} is mutable, then \texttt{StrongOrientation(\mbox{\texttt{\mdseries\slshape D}})} returns a mutable digraph. 

 The method used in this operation has complexity $O(m+n)$ where $m$ is the number of edges and $n$ is the number of vertices in the digraph. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@StrongOrientation(DigraphSymmetricClosure(CycleDigraph(5))) |
  !gapprompt@>| !gapinput@= CycleDigraph(5);|
  true
  !gapprompt@gap>| !gapinput@D := DigraphSymmetricClosure(Digraph(|
  !gapprompt@>| !gapinput@[[2, 7], [3, 5], [4], [2], [6], [1], []]));;|
  !gapprompt@gap>| !gapinput@IsBridgelessDigraph(D);|
  false
  !gapprompt@gap>| !gapinput@StrongOrientation(D);|
  fail
  !gapprompt@gap>| !gapinput@StrongOrientation(NullDigraph(0));|
  <immutable empty digraph with 0 vertices>
  !gapprompt@gap>| !gapinput@StrongOrientation(DigraphDisjointUnion(CompleteDigraph(3), |
  !gapprompt@>| !gapinput@                                          CompleteDigraph(3)));|
  fail
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphPeriod}}
\logpage{[ 5, 4, 18 ]}\nobreak
\hyperdef{L}{X853D0B0981A33433}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphPeriod({\mdseries\slshape digraph})\index{DigraphPeriod@\texttt{DigraphPeriod}}
\label{DigraphPeriod}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
An integer.



 This function returns the period of the digraph \mbox{\texttt{\mdseries\slshape digraph}}.

 If a digraph \mbox{\texttt{\mdseries\slshape digraph}} has at least one directed cycle, then the period is the greatest positive
integer which divides the lengths of all directed cycles of \mbox{\texttt{\mdseries\slshape digraph}}. If \mbox{\texttt{\mdseries\slshape digraph}} has no directed cycles, then this function returns $0$. See Section \ref{Definitions} for the definition of a directed cycle. 

 A digraph with a period of $1$ is said to be \emph{aperiodic}. See \texttt{IsAperiodicDigraph} (\ref{IsAperiodicDigraph}). 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[6], [1], [2], [3], [4, 4], [5]]);|
  <immutable multidigraph with 6 vertices, 7 edges>
  !gapprompt@gap>| !gapinput@DigraphPeriod(D);|
  6
  !gapprompt@gap>| !gapinput@D := Digraph([[2], [3, 5], [4], [5], [1, 2]]);|
  <immutable digraph with 5 vertices, 7 edges>
  !gapprompt@gap>| !gapinput@DigraphPeriod(D);|
  1
  !gapprompt@gap>| !gapinput@D := ChainDigraph(2);|
  <immutable chain digraph with 2 vertices>
  !gapprompt@gap>| !gapinput@DigraphPeriod(D);|
  0
  !gapprompt@gap>| !gapinput@IsAcyclicDigraph(D);|
  true
  !gapprompt@gap>| !gapinput@D := GeneralisedPetersenGraph(IsMutableDigraph, 5, 2);|
  <mutable digraph with 10 vertices, 30 edges>
  !gapprompt@gap>| !gapinput@DigraphPeriod(D);|
  1
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphFloydWarshall}}
\logpage{[ 5, 4, 19 ]}\nobreak
\hyperdef{L}{X864A31A8809F61C2}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphFloydWarshall({\mdseries\slshape digraph, func, nopath, edge})\index{DigraphFloydWarshall@\texttt{DigraphFloydWarshall}}
\label{DigraphFloydWarshall}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A matrix.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph with $n$ vertices, then this operation returns an $n \times n$ matrix \texttt{mat} containing the output of a generalised version of the
Floyd\texttt{\symbol{45}}Warshall algorithm, applied to \mbox{\texttt{\mdseries\slshape digraph}}. 

 The operation \texttt{DigraphFloydWarshall} is customised by the arguments \mbox{\texttt{\mdseries\slshape func}}, \mbox{\texttt{\mdseries\slshape nopath}}, and \mbox{\texttt{\mdseries\slshape edge}}. The arguments \mbox{\texttt{\mdseries\slshape nopath}} and \mbox{\texttt{\mdseries\slshape edge}} can be arbitrary \textsf{GAP} objects. The argument \mbox{\texttt{\mdseries\slshape func}} must be a function which accepts 4 arguments: the matrix \texttt{mat}, followed by 3 positive integers. The function \mbox{\texttt{\mdseries\slshape func}} is where the work to calculate the desired outcome must be performed. 

 This method initialises the matrix \texttt{mat} by setting entry \texttt{mat[i][j]} to equa\mbox{\texttt{\mdseries\slshape edge}} if there is an edge with source \texttt{i} and range \texttt{j}, and by setting entry \texttt{mat[i][j]} to equal \mbox{\texttt{\mdseries\slshape nopath}} otherwise. The final part of \texttt{DigraphFloydWarshall} then calls the function \mbox{\texttt{\mdseries\slshape func}} inside three nested for loops, over the vertices of \mbox{\texttt{\mdseries\slshape digraph}}: 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=]
  for i in DigraphsVertices(digraph) do
    for j in DigraphsVertices(digraph) do
      for k in DigraphsVertices(digraph) do
        func(mat, i, j, k);
      od;
    od;
  od;
\end{Verbatim}
 The matrix \texttt{mat} is then returned as the result. An example of using \texttt{DigraphFloydWarshall} to calculate the shortest (non\texttt{\symbol{45}}zero) distances between the
vertices of a digraph is shown below: 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := DigraphFromDigraph6String("&EAHQeDB");|
  <immutable digraph with 6 vertices, 12 edges>
  !gapprompt@gap>| !gapinput@func := function(mat, i, j, k)|
  !gapprompt@>| !gapinput@  if mat[i][k] <> -1 and mat[k][j] <> -1 then|
  !gapprompt@>| !gapinput@    if (mat[i][j] = -1) or (mat[i][j] > mat[i][k] + mat[k][j]) then|
  !gapprompt@>| !gapinput@      mat[i][j] := mat[i][k] + mat[k][j];|
  !gapprompt@>| !gapinput@    fi;|
  !gapprompt@>| !gapinput@  fi;|
  !gapprompt@>| !gapinput@end;|
  function( mat, i, j, k ) ... end
  !gapprompt@gap>| !gapinput@shortest_distances := DigraphFloydWarshall(D, func, -1, 1);;|
  !gapprompt@gap>| !gapinput@Display(shortest_distances);|
  [ [   3,  -1,  -1,   2,   1,   2 ],
    [   4,   2,   1,   3,   2,   1 ],
    [   3,   1,   2,   2,   1,   2 ],
    [   1,  -1,  -1,   1,   1,   2 ],
    [   2,  -1,  -1,   1,   2,   1 ],
    [   3,  -1,  -1,   2,   1,   1 ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{IsReachable}}
\logpage{[ 5, 4, 20 ]}\nobreak
\hyperdef{L}{X7FBAB09E7C0BE5CF}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{IsReachable({\mdseries\slshape digraph, u, v})\index{IsReachable@\texttt{IsReachable}}
\label{IsReachable}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
\texttt{true} or \texttt{false}.



 This operation returns \texttt{true} if there exists a non\texttt{\symbol{45}}trivial directed walk from vertex \mbox{\texttt{\mdseries\slshape u}} to vertex \mbox{\texttt{\mdseries\slshape v}} in the digraph \mbox{\texttt{\mdseries\slshape digraph}}, and \texttt{false} if there does not exist such a directed walk. See Section \ref{Definitions} for the definition of a non\texttt{\symbol{45}}trivial directed walk. 

 The method for \texttt{IsReachable} has worst case complexity of $O(m + n)$ where $m$ is the number of edges and $n$ the number of vertices in \mbox{\texttt{\mdseries\slshape digraph}}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[2], [3], [2, 3]]);|
  <immutable digraph with 3 vertices, 4 edges>
  !gapprompt@gap>| !gapinput@IsReachable(D, 1, 3);|
  true
  !gapprompt@gap>| !gapinput@IsReachable(D, 2, 1);|
  false
  !gapprompt@gap>| !gapinput@IsReachable(D, 3, 3);|
  true
  !gapprompt@gap>| !gapinput@IsReachable(D, 1, 1);|
  false
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{IsDigraphPath}}
\logpage{[ 5, 4, 21 ]}\nobreak
\hyperdef{L}{X7ECD22877AEA89CC}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{IsDigraphPath({\mdseries\slshape D, v, a})\index{IsDigraphPath@\texttt{IsDigraphPath}}
\label{IsDigraphPath}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{IsDigraphPath({\mdseries\slshape D, list})\index{IsDigraphPath@\texttt{IsDigraphPath}!for a digraph and list}
\label{IsDigraphPath:for a digraph and list}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
\texttt{true} or \texttt{false}.



 This function returns \texttt{true} if the arguments \mbox{\texttt{\mdseries\slshape v}} and \mbox{\texttt{\mdseries\slshape a }} describe a path in the digraph \mbox{\texttt{\mdseries\slshape D}}. A directed path (or directed cycle) of non\texttt{\symbol{45}}zero length \texttt{n\texttt{\symbol{45}}1}, $(v_1, e_1, v_2, e_2, ..., e_{n-1}, v_n)$, is represented by a pair of lists \texttt{[\mbox{\texttt{\mdseries\slshape v}}, \mbox{\texttt{\mdseries\slshape a}}]} as follows: 
\begin{itemize}
\item  \mbox{\texttt{\mdseries\slshape v}} is the list $[v_1, v_2, ..., v_n]$. 
\item  \mbox{\texttt{\mdseries\slshape a}} is the list of positive integers $[a_1, a_2, ..., a_{n-1}]$ where for each each $i < n$, $a_i$ is the position of $v_{i+1}$ in \texttt{OutNeighboursOfVertex(}\mbox{\texttt{\mdseries\slshape D}}\texttt{,}$v_i$\texttt{)} corresponding to the edge $e_i$. This can be useful if the position of a vertex in a list of
out\texttt{\symbol{45}}neighours is significant, for example in orbit
digraphs. 
\end{itemize}
 If the arguments to \texttt{IsDigraphPath} are a digraph \mbox{\texttt{\mdseries\slshape D}} and list \mbox{\texttt{\mdseries\slshape list}}, then this is equivalent to calling \texttt{IsDigraphPath(\mbox{\texttt{\mdseries\slshape D}}, \mbox{\texttt{\mdseries\slshape list}}[1], \mbox{\texttt{\mdseries\slshape list}}[2])}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph(IsMutableDigraph, Combinations([1 .. 5]), IsSubset);|
  <mutable digraph with 32 vertices, 243 edges>
  !gapprompt@gap>| !gapinput@DigraphReflexiveTransitiveReduction(D);|
  <mutable digraph with 32 vertices, 80 edges>
  !gapprompt@gap>| !gapinput@MakeImmutable(D);|
  <immutable digraph with 32 vertices, 80 edges>
  !gapprompt@gap>| !gapinput@IsDigraphPath(D, [32, 31, 33], [1, 1]);|
  false
  !gapprompt@gap>| !gapinput@IsDigraphPath(D, [1], []);|
  true
  !gapprompt@gap>| !gapinput@IsDigraphPath(D, [6, 9, 16, 17], [3, 3, 2]);|
  true
  !gapprompt@gap>| !gapinput@IsDigraphPath(D, DigraphPath(D, 6, 1));|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{VerticesReachableFrom (for a digraph and vertex)}}
\logpage{[ 5, 4, 22 ]}\nobreak
\hyperdef{L}{X7F255A2A84CB868C}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{VerticesReachableFrom({\mdseries\slshape digraph, root})\index{VerticesReachableFrom@\texttt{VerticesReachableFrom}!for a digraph and vertex}
\label{VerticesReachableFrom:for a digraph and vertex}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{VerticesReachableFrom({\mdseries\slshape digraph, list})\index{VerticesReachableFrom@\texttt{VerticesReachableFrom}!for a digraph and a list of vertices}
\label{VerticesReachableFrom:for a digraph and a list of vertices}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A list.



 This operation returns a list of the vertices \texttt{v}, for which there exists a non\texttt{\symbol{45}}trivial directed walk from
the vertex \mbox{\texttt{\mdseries\slshape root}}, or any of the list of vertices \mbox{\texttt{\mdseries\slshape list}}, to vertex \texttt{v} in the digraph \mbox{\texttt{\mdseries\slshape digraph}}. See Section \ref{Definitions} for the definition of a non\texttt{\symbol{45}}trivial directed walk. 

 The method for \texttt{VerticesReachableFrom} has worst case complexity of $O(m + n)$ where $m$ is the number of edges and $n$ the number of vertices in \mbox{\texttt{\mdseries\slshape digraph}}. 

 This function returns an error if \mbox{\texttt{\mdseries\slshape root}}, or any vertex in \mbox{\texttt{\mdseries\slshape list}}, is not a vertices of \mbox{\texttt{\mdseries\slshape digraph}}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := CompleteDigraph(5);|
  <immutable complete digraph with 5 vertices>
  !gapprompt@gap>| !gapinput@VerticesReachableFrom(D, 1);|
  [ 1, 2, 3, 4, 5 ]
  !gapprompt@gap>| !gapinput@VerticesReachableFrom(D, 3);|
  [ 1, 2, 3, 4, 5 ]
  !gapprompt@gap>| !gapinput@D := EmptyDigraph(5);|
  <immutable empty digraph with 5 vertices>
  !gapprompt@gap>| !gapinput@VerticesReachableFrom(D, 1);|
  [  ]
  !gapprompt@gap>| !gapinput@VerticesReachableFrom(D, 3);|
  [  ]
  !gapprompt@gap>| !gapinput@VerticesReachableFrom(D, [1, 2, 3, 4]);|
  [  ]
  !gapprompt@gap>| !gapinput@VerticesReachableFrom(D, [3, 4, 5]);|
  [  ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(4);|
  <immutable cycle digraph with 4 vertices>
  !gapprompt@gap>| !gapinput@VerticesReachableFrom(D, 1);|
  [ 1, 2, 3, 4 ]
  !gapprompt@gap>| !gapinput@VerticesReachableFrom(D, 3);|
  [ 1, 2, 3, 4 ]
  !gapprompt@gap>| !gapinput@D := ChainDigraph(5);|
  <immutable chain digraph with 5 vertices>
  !gapprompt@gap>| !gapinput@VerticesReachableFrom(D, 1);|
  [ 2, 3, 4, 5 ]
  !gapprompt@gap>| !gapinput@VerticesReachableFrom(D, 3);|
  [ 4, 5 ]
  !gapprompt@gap>| !gapinput@VerticesReachableFrom(D, 5);|
  [  ]
  !gapprompt@gap>| !gapinput@VerticesReachableFrom(D, [3, 4]);|
  [ 4, 5 ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphPath}}
\logpage{[ 5, 4, 23 ]}\nobreak
\hyperdef{L}{X8039170B82A32257}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphPath({\mdseries\slshape digraph, u, v})\index{DigraphPath@\texttt{DigraphPath}}
\label{DigraphPath}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A pair of lists, or \texttt{fail}.



 If there exists a non\texttt{\symbol{45}}trivial directed path (or a
non\texttt{\symbol{45}}trivial cycle, in the case that \mbox{\texttt{\mdseries\slshape u}} \texttt{=} \mbox{\texttt{\mdseries\slshape v}}) from vertex \mbox{\texttt{\mdseries\slshape u}} to vertex \mbox{\texttt{\mdseries\slshape v}} in the digraph \mbox{\texttt{\mdseries\slshape digraph}}, then this operation returns such a directed path (or directed cycle).
Otherwise, this operation returns \texttt{fail}. See Section \hyperref[Definitions]{`Definitions'} for the definition of a directed path and a directed cycle. 

 A directed path (or directed cycle) of non\texttt{\symbol{45}}zero length \texttt{n\texttt{\symbol{45}}1}, $(v_1, e_1, v_2, e_2, ..., e_{n-1}, v_n)$, is represented by a pair of lists \texttt{[v,a]} as follows: 
\begin{itemize}
\item  \texttt{v} is the list $[v_1, v_2, ..., v_n]$. 
\item  \texttt{a} is the list of positive integers $[a_1, a_2, ..., a_{n-1}]$ where for each each $i < n$, $a_i$ is the position of $v_{i+1}$ in \texttt{OutNeighboursOfVertex(}\mbox{\texttt{\mdseries\slshape digraph}}\texttt{,}$v_i$\texttt{)} corresponding to the edge $e_i$. This can be useful if the position of a vertex in a list of
out\texttt{\symbol{45}}neighours is significant, for example in orbit
digraphs. 
\end{itemize}
 The method for \texttt{DigraphPath} has worst case complexity of $O(m + n)$ where $m$ is the number of edges and $n$ the number of vertices in \mbox{\texttt{\mdseries\slshape digraph}}.

 See also \texttt{IsDigraphPath} (\ref{IsDigraphPath}). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[2], [3], [2, 3]]);|
  <immutable digraph with 3 vertices, 4 edges>
  !gapprompt@gap>| !gapinput@DigraphPath(D, 1, 3);|
  [ [ 1, 2, 3 ], [ 1, 1 ] ]
  !gapprompt@gap>| !gapinput@DigraphPath(D, 2, 1);|
  fail
  !gapprompt@gap>| !gapinput@DigraphPath(D, 3, 3);|
  [ [ 3, 3 ], [ 2 ] ]
  !gapprompt@gap>| !gapinput@DigraphPath(D, 1, 1);|
  fail
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphShortestPath}}
\logpage{[ 5, 4, 24 ]}\nobreak
\hyperdef{L}{X80E9D645843973A6}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphShortestPath({\mdseries\slshape digraph, u, v})\index{DigraphShortestPath@\texttt{DigraphShortestPath}}
\label{DigraphShortestPath}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A pair of lists, or \texttt{fail}.



 Returns a shortest directed path in the digraph \mbox{\texttt{\mdseries\slshape digraph}} from vertex \mbox{\texttt{\mdseries\slshape u}} to vertex \mbox{\texttt{\mdseries\slshape v}}, if such a path exists. If \texttt{\mbox{\texttt{\mdseries\slshape u}} = \mbox{\texttt{\mdseries\slshape v}}}, then the shortest non\texttt{\symbol{45}}trivial cycle is returned, again,
if it exists. Otherwise, this operation returns \texttt{fail}. See Section \hyperref[Definitions]{`Definitions'} for the definition of a directed path and a directed cycle. 

 See \texttt{DigraphPath} (\ref{DigraphPath}) for details on the output. The method for \texttt{DigraphShortestPath} has worst case complexity of $O(m + n)$ where $m$ is the number of edges and $n$ the number of vertices in \mbox{\texttt{\mdseries\slshape digraph}}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[1, 2], [3], [2, 4], [1], [2, 4]]);|
  <immutable digraph with 5 vertices, 8 edges>
  !gapprompt@gap>| !gapinput@DigraphShortestPath(D, 5, 1);|
  [ [ 5, 4, 1 ], [ 2, 1 ] ]
  !gapprompt@gap>| !gapinput@DigraphShortestPath(D, 3, 3);|
  [ [ 3, 2, 3 ], [ 1, 1 ] ]
  !gapprompt@gap>| !gapinput@DigraphShortestPath(D, 5, 5);|
  fail
  !gapprompt@gap>| !gapinput@DigraphShortestPath(D, 1, 1);|
  [ [ 1, 1 ], [ 1 ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphRandomWalk}}
\logpage{[ 5, 4, 25 ]}\nobreak
\hyperdef{L}{X7C45396C808308C4}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphRandomWalk({\mdseries\slshape digraph, v, t})\index{DigraphRandomWalk@\texttt{DigraphRandomWalk}}
\label{DigraphRandomWalk}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A pair of lists.



 Returns a directed path corresponding to a \emph{random walk} in the digraph \mbox{\texttt{\mdseries\slshape digraph}}, starting at vertex \mbox{\texttt{\mdseries\slshape v}} and having length no more than \mbox{\texttt{\mdseries\slshape t}}. 

 A random walk is defined as follows. The path begins at \mbox{\texttt{\mdseries\slshape v}}, and at each step it follows a random edge leaving the current vertex. It
continues through the digraph in this way until it has traversed \mbox{\texttt{\mdseries\slshape t}} edges, or until it reaches a vertex with no out\texttt{\symbol{45}}edges (a \emph{sink}) and therefore cannot continue. 

 The output has the same form as that of \texttt{DigraphPath} (\ref{DigraphPath}). 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[1, 2], [3], [2, 4], [1], [2, 4]]);                |
  <immutable digraph with 5 vertices, 8 edges>
  !gapprompt@gap>| !gapinput@DigraphRandomWalk(D, 1, 4);|
  [ [ 1, 2, 3, 2, 3 ], [ 2, 1, 1, 1 ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphAbsorptionProbabilities}}
\logpage{[ 5, 4, 26 ]}\nobreak
\hyperdef{L}{X787459247B2005E6}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphAbsorptionProbabilities({\mdseries\slshape digraph})\index{DigraphAbsorptionProbabilities@\texttt{DigraphAbsorptionProbabilities}}
\label{DigraphAbsorptionProbabilities}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A matrix of rational numbers.



 A random walk of infinite length through a finite digraph may pass through
several different strongly connected components (SCCs). However, with
probability 1 it must eventually reach an SCC which it can never leave,
because the SCC has no out\texttt{\symbol{45}}edges leading to other SCCs. We
may say that such an SCC has \emph{absorbed} the random walk, and we can calculate the probability of each SCC absorbing a
walk starting at a given vertex. 

 \texttt{DigraphAbsorptionProbabilities} returns an $m \times n$ matrix \texttt{mat}, where $m$ is the number of vertices in \texttt{digraph} and $n$ is the number of strongly connected components. Each entry \texttt{mat[i][j]} is a rational number representing the probability that an unbounded random
walk starting at vertex \texttt{i} will be absorbed by strongly connected component \texttt{j} {\textendash} that is, the probability that it will reach the component and
never leave. 

 Strongly connected components are indexed in the order given by \texttt{DigraphStronglyConnectedComponents} (\ref{DigraphStronglyConnectedComponents}). See also \texttt{DigraphRandomWalk} (\ref{DigraphRandomWalk}) and \texttt{DigraphAbsorptionExpectedSteps} (\ref{DigraphAbsorptionExpectedSteps}). 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gr := Digraph([[2, 3, 4], [3], [2], []]);|
  <immutable digraph with 4 vertices, 5 edges>
  !gapprompt@gap>| !gapinput@DigraphStronglyConnectedComponents(gr).comps;|
  [ [ 2, 3 ], [ 4 ], [ 1 ] ]
  !gapprompt@gap>| !gapinput@DigraphAbsorptionProbabilities(gr);|
  [ [ 2/3, 1/3, 0 ], [ 1, 0, 0 ], [ 1, 0, 0 ], [ 0, 1, 0 ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphAbsorptionExpectedSteps}}
\logpage{[ 5, 4, 27 ]}\nobreak
\hyperdef{L}{X7B0A62CF7F6F23E9}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphAbsorptionExpectedSteps({\mdseries\slshape digraph})\index{DigraphAbsorptionExpectedSteps@\texttt{DigraphAbsorptionExpectedSteps}}
\label{DigraphAbsorptionExpectedSteps}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A list of rational numbers.



 A random walk of unbounded length through a finite digraph may pass through
several different strongly connected components (SCCs). However, with
probability 1 it must eventually reach an SCC which it can never leave,
because the SCC has no out\texttt{\symbol{45}}edges leading to other SCCs.
When this happens, we say the walk has been \emph{absorbed}. 

 \texttt{DigraphAbsorptionExpectedSteps} returns a list \texttt{L} with length equal to thnumber of vertices of \mbox{\texttt{\mdseries\slshape digraph}}, where \texttt{L[v]} is the expected number of steps a random walk starting at vertex \texttt{v} should take before it is absorbed {\textendash} that is, the expected number
of steps to reach an SCC that it can never leave. 

 See also \texttt{DigraphRandomWalk} (\ref{DigraphRandomWalk}) and \texttt{DigraphAbsorptionProbabilities} (\ref{DigraphAbsorptionProbabilities}). 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gr := Digraph([[2], [3, 4], [], [2]]);|
  <immutable digraph with 4 vertices, 4 edges>
  !gapprompt@gap>| !gapinput@DigraphAbsorptionExpectedSteps(gr);|
  [ 4, 3, 0, 4 ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{Dominators}}
\logpage{[ 5, 4, 28 ]}\nobreak
\hyperdef{L}{X7FE79CB278CE6991}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{Dominators({\mdseries\slshape digraph, root})\index{Dominators@\texttt{Dominators}}
\label{Dominators}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A list of lists.



 \texttt{Dominators} takes a \mbox{\texttt{\mdseries\slshape digraph}} and a root \mbox{\texttt{\mdseries\slshape root}} and returns the dominators of each vertex with respect to the root. The output
is returned as a list of length \texttt{DigraphNrVertices(\mbox{\texttt{\mdseries\slshape Digraph}})}, whose \mbox{\texttt{\mdseries\slshape i}}th entry is a list with the dominators of vertex \mbox{\texttt{\mdseries\slshape i}} of the \mbox{\texttt{\mdseries\slshape digraph}}. If there is no path from the root to a specific vertex, the output will
contain a hole in the corresponding position. The \emph{dominators} of a vertex $u$ are the vertices that are contained in every path from the $root$ to $u$, not including $u$ itself. The method for this operation is an implementation of an algorithm by
Thomas Lengauer and Robert Endre Tarjan \cite{LT79}. The complexity of this algorithm is $O(mlog n)$ where $m$ is the number of edges and $n$ is the number of nodes in the subdigraph induced by the nodes in \mbox{\texttt{\mdseries\slshape digraph}} reachable from \mbox{\texttt{\mdseries\slshape root}}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[2], [3, 6], [2, 4], [1], [], [3]]);|
  <immutable digraph with 6 vertices, 7 edges>
  !gapprompt@gap>| !gapinput@Dominators(D, 1);|
  [ , [ 1 ], [ 2, 1 ], [ 3, 2, 1 ],, [ 2, 1 ] ]
  !gapprompt@gap>| !gapinput@Dominators(D, 2);|
  [ [ 4, 3, 2 ],, [ 2 ], [ 3, 2 ],, [ 2 ] ]
  !gapprompt@gap>| !gapinput@Dominators(D, 3);|
  [ [ 4, 3 ], [ 3 ],, [ 3 ],, [ 2, 3 ] ]
  !gapprompt@gap>| !gapinput@Dominators(D, 4);|
  [ [ 4 ], [ 1, 4 ], [ 2, 1, 4 ],,, [ 2, 1, 4 ] ]
  !gapprompt@gap>| !gapinput@Dominators(D, 5);|
  [  ]
  !gapprompt@gap>| !gapinput@Dominators(D, 6);|
  [ [ 4, 3, 6 ], [ 3, 6 ], [ 6 ], [ 3, 6 ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DominatorTree}}
\logpage{[ 5, 4, 29 ]}\nobreak
\hyperdef{L}{X7D66A0FB7F6100FB}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DominatorTree({\mdseries\slshape digraph, root})\index{DominatorTree@\texttt{DominatorTree}}
\label{DominatorTree}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A record.



 \texttt{DominatorTree} takes a \mbox{\texttt{\mdseries\slshape digraph}} and a \mbox{\texttt{\mdseries\slshape root}} vertex and returns a record with the following components: 
\begin{description}
\item[{idom}]  the immediate dominators of the vertices with respect to the root. 
\item[{preorder}]  the preorder values of the vertices defined by the depth first search executed
on the digraph. 
\end{description}
 The \emph{immediate dominator} of a vertex $u$ is the unique dominator of $u$ that is dominated by all other dominators of $u$. The algorithm is an implementation of the fast algorithm written by Thomas
Lengauer and Robert Endre Tarjan \cite{LT79}. The complexity of this algorithm is $O(mlog n)$ where $m$ is the number of edges and $n$ is the number of nodes in the subdigraph induced by the nodes in \mbox{\texttt{\mdseries\slshape digraph}} reachable from \mbox{\texttt{\mdseries\slshape root}}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[2, 3], [4, 6], [4, 5], [3, 5], [1, 6], [2, 3]]);|
  <immutable digraph with 6 vertices, 12 edges>
  !gapprompt@gap>| !gapinput@DominatorTree(D, 1);|
  rec( idom := [ fail, 1, 1, 1, 1, 1 ], 
    preorder := [ 1, 2, 4, 3, 5, 6 ] )
  !gapprompt@gap>| !gapinput@DominatorTree(D, 5);|
  rec( idom := [ 5, 5, 5, 5, fail, 5 ], 
    preorder := [ 5, 1, 2, 4, 3, 6 ] )
  !gapprompt@gap>| !gapinput@D := CompleteDigraph(5);|
  <immutable complete digraph with 5 vertices>
  !gapprompt@gap>| !gapinput@DominatorTree(D, 1);|
  rec( idom := [ fail, 1, 1, 1, 1 ], preorder := [ 1, 2, 3, 4, 5 ] )
  !gapprompt@gap>| !gapinput@DominatorTree(D, 2);|
  rec( idom := [ 2, fail, 2, 2, 2 ], preorder := [ 2, 1, 3, 4, 5 ] )
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{IteratorOfPaths}}
\logpage{[ 5, 4, 30 ]}\nobreak
\hyperdef{L}{X7C0416FE7A69CA2C}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{IteratorOfPaths({\mdseries\slshape digraph, u, v})\index{IteratorOfPaths@\texttt{IteratorOfPaths}}
\label{IteratorOfPaths}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
An iterator.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph or a list of adjacencies which defines a digraph
\texttt{\symbol{45}} see \texttt{OutNeighbours} (\ref{OutNeighbours}) \texttt{\symbol{45}} then this operation returns an iterator of the
non\texttt{\symbol{45}}trivial directed paths (or directed cycles, in the case
that \mbox{\texttt{\mdseries\slshape u}} \texttt{=} \mbox{\texttt{\mdseries\slshape v}}) in \mbox{\texttt{\mdseries\slshape digraph}} from the vertex \mbox{\texttt{\mdseries\slshape u}} to the vertex \mbox{\texttt{\mdseries\slshape v}}. 

 See \texttt{DigraphPath} (\ref{DigraphPath}) for more information about the representation of a directed path or directed
cycle which is used, and see  (\textbf{Reference: Iterators}) for more information about iterators. See Section \hyperref[Definitions]{`Definitions'} for the definition of a directed path and a directed cycle. 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[1, 4, 4, 2], [3, 5], [2, 3], [1, 2], [4]]);|
  <immutable multidigraph with 5 vertices, 11 edges>
  !gapprompt@gap>| !gapinput@iter := IteratorOfPaths(D, 1, 4);|
  <iterator>
  !gapprompt@gap>| !gapinput@NextIterator(iter);|
  [ [ 1, 4 ], [ 2 ] ]
  !gapprompt@gap>| !gapinput@NextIterator(iter);|
  [ [ 1, 4 ], [ 3 ] ]
  !gapprompt@gap>| !gapinput@NextIterator(iter);|
  [ [ 1, 2, 5, 4 ], [ 4, 2, 1 ] ]
  !gapprompt@gap>| !gapinput@IsDoneIterator(iter);|
  true
  !gapprompt@gap>| !gapinput@iter := IteratorOfPaths(D, 4, 3);|
  <iterator>
  !gapprompt@gap>| !gapinput@NextIterator(iter);|
  [ [ 4, 1, 2, 3 ], [ 1, 4, 1 ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphAllSimpleCircuits}}
\logpage{[ 5, 4, 31 ]}\nobreak
\hyperdef{L}{X7ECD16838704FAAA}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphAllSimpleCircuits({\mdseries\slshape digraph})\index{DigraphAllSimpleCircuits@\texttt{DigraphAllSimpleCircuits}}
\label{DigraphAllSimpleCircuits}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A list of lists of vertices.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph, then \texttt{DigraphAllSimpleCircuits} returns a list of the \emph{simple circuits} in \mbox{\texttt{\mdseries\slshape digraph}}. 

 See Section \ref{Definitions} for the definition of a simple circuit, and related notions. Note that a loop
is a simple circuit. 

 For a digraph without multiple edges, a simple circuit is uniquely determined
by its subsequence of vertices. However this is not the case for a
multidigraph. The attribute \texttt{DigraphAllSimpleCircuits} ignores multiple edges, and identifies a simple circuit using only its
subsequence of vertices. For example, although the simple circuits $(v, e, v)$ and $(v, e', v)$ (for distinct edges $e$ and $e'$) are mathematically distinct, \texttt{DigraphAllSimpleCircuits} considers them to be the same. 

 With this approach, a directed circuit of length \texttt{n} can be determined by a list of its first \texttt{n} vertices. Thus a simple circuit $(v_1, e_1, v_2, e_2, ..., e_{n-1}, v_n, e_{n+1}, v_1)$ can be represented as the list $[v_1, \ldots, v_n]$, or any cyclic permutation thereof. For each simple circuit of \mbox{\texttt{\mdseries\slshape digraph}}, \texttt{DigraphAllSimpleCircuits(\mbox{\texttt{\mdseries\slshape digraph}})} includes precisely one such list to represent the circuit. 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[], [3], [2, 4], [5, 4], [4]]);|
  <immutable digraph with 5 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@DigraphAllSimpleCircuits(D);|
  [ [ 4 ], [ 4, 5 ], [ 2, 3 ] ]
  !gapprompt@gap>| !gapinput@D := ChainDigraph(10);;|
  !gapprompt@gap>| !gapinput@DigraphAllSimpleCircuits(D);|
  [  ]
  !gapprompt@gap>| !gapinput@D := Digraph([[3], [1], [1]]);|
  <immutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphAllSimpleCircuits(D);|
  [ [ 1, 3 ] ]
  !gapprompt@gap>| !gapinput@D := Digraph([[1, 1]]);|
  <immutable multidigraph with 1 vertex, 2 edges>
  !gapprompt@gap>| !gapinput@DigraphAllSimpleCircuits(D);|
  [ [ 1 ] ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphAllSimpleCircuits(D);|
  [ [ 1, 2, 3 ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphLongestSimpleCircuit}}
\logpage{[ 5, 4, 32 ]}\nobreak
\hyperdef{L}{X7C735C4E86BDD5F6}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphLongestSimpleCircuit({\mdseries\slshape digraph})\index{DigraphLongestSimpleCircuit@\texttt{DigraphLongestSimpleCircuit}}
\label{DigraphLongestSimpleCircuit}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A list of vertices, or \texttt{fail}.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph, then \texttt{DigraphLongestSimpleCircuit} returns the longest \emph{simple circuit} in \mbox{\texttt{\mdseries\slshape digraph}}. See Section \ref{Definitions} for the definition of simple circuit, and the definition of length for a
simple circuit.

 This attribute computes \texttt{DigraphAllSimpleCircuits(}\mbox{\texttt{\mdseries\slshape digraph}}\texttt{)} to find all the simple circuits of \mbox{\texttt{\mdseries\slshape digraph}}, and returns one of maximal length. A simple circuit is represented as a list
of vertices, in the same way as described in \texttt{DigraphAllSimpleCircuits} (\ref{DigraphAllSimpleCircuits}).

 If \mbox{\texttt{\mdseries\slshape digraph}} has no simple circuits, then this attribute returns \texttt{fail}. If \mbox{\texttt{\mdseries\slshape digraph}} has multiple simple circuits of maximal length, then this attribute returns
one of them.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[], [3], [2, 4], [5, 4], [4]]);;|
  !gapprompt@gap>| !gapinput@DigraphLongestSimpleCircuit(D);|
  [ 4, 5 ]
  !gapprompt@gap>| !gapinput@D := ChainDigraph(10);;|
  !gapprompt@gap>| !gapinput@DigraphLongestSimpleCircuit(D);|
  fail
  !gapprompt@gap>| !gapinput@D := Digraph([[3], [1], [1, 4], [1, 1]]);;|
  !gapprompt@gap>| !gapinput@DigraphLongestSimpleCircuit(D);|
  [ 1, 3, 4 ]
  !gapprompt@gap>| !gapinput@D := GeneralisedPetersenGraph(IsMutableDigraph, 4, 1);|
  <mutable digraph with 8 vertices, 24 edges>
  !gapprompt@gap>| !gapinput@DigraphLongestSimpleCircuit(D);|
  [ 1, 2, 3, 4, 8, 7, 6, 5 ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphAllUndirectedSimpleCircuits}}
\logpage{[ 5, 4, 33 ]}\nobreak
\hyperdef{L}{X7F9EDAA8854FB538}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphAllUndirectedSimpleCircuits({\mdseries\slshape digraph})\index{DigraphAllUndirectedSimpleCircuits@\texttt{DigraphAllUndirectedSimpleCircuits}}
\label{DigraphAllUndirectedSimpleCircuits}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A list of lists of vertices.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph, then \texttt{DigraphAllUndirectedSimpleCircuits} returns a list of the \emph{ undirected simple circuits} in \mbox{\texttt{\mdseries\slshape digraph}}. 

 See Section \ref{Definitions} for the definition of a simple circuit, and related notions. Note that a loop
is a simple circuit. A simple circuit is undirected if the orientation of the
edges in the circuit does not matter.

 The attribute \texttt{DigraphAllUndirectedSimpleCircuitss} ignores multiple edges, and identifies a undirected simple circuit using only
its subsequence of vertices. See Section \ref{DigraphAllSimpleCircuits} for more details on simple circuits.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := ChainDigraph(10);;|
  !gapprompt@gap>| !gapinput@DigraphAllUndirectedSimpleCircuits(D);|
  [  ]
  !gapprompt@gap>| !gapinput@D := Digraph([[1, 1]]);|
  <immutable multidigraph with 1 vertex, 2 edges>
  !gapprompt@gap>| !gapinput@DigraphAllUndirectedSimpleCircuits(D);|
  [ [ 1 ] ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(IsMutableDigraph, 3);|
  <mutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphAllUndirectedSimpleCircuits(D);|
  [ [ 1, 2, 3 ] ]
  !gapprompt@gap>| !gapinput@D := DigraphSymmetricClosure(CycleDigraph(IsMutableDigraph, 3));|
  <mutable digraph with 3 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@DigraphAllUndirectedSimpleCircuits(D);|
  [ [ 1, 2, 3 ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphAllChordlessCycles}}
\logpage{[ 5, 4, 34 ]}\nobreak
\hyperdef{L}{X7F0AC5617CE5E9DD}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphAllChordlessCycles({\mdseries\slshape digraph})\index{DigraphAllChordlessCycles@\texttt{DigraphAllChordlessCycles}}
\label{DigraphAllChordlessCycles}
}\hfill{\scriptsize (attribute)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphAllChordlessCyclesOfMaximalLength({\mdseries\slshape digraph, maxLength})\index{DigraphAllChordlessCyclesOfMaximalLength@\texttt{Digraph}\-\texttt{All}\-\texttt{Chordless}\-\texttt{Cycles}\-\texttt{Of}\-\texttt{Maximal}\-\texttt{Length}}
\label{DigraphAllChordlessCyclesOfMaximalLength}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A list of lists of vertices.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph, then \texttt{DigraphAllChordlessCycles} returns a list of the \emph{chordless cycles} in \mbox{\texttt{\mdseries\slshape digraph}}. The method \texttt{DigraphAllChordlessCyclesOfMaximalLength} returns a list of all \emph{chordless cycles} in \mbox{\texttt{\mdseries\slshape digraph}} of length at most \mbox{\texttt{\mdseries\slshape maxLength}}

 A chordless cycle $C$ is a undirected simple circuit (see Section \ref{Definitions} ) where each pair of vertices in $C$ are not connected by an edge not in $C$. Here, cycles of length two are ignored.

 For a digraph without multiple edges, a simple circuit is uniquely determined
by its subsequence of vertices. However this is not the case for a
multidigraph. The attribute \texttt{DigraphAllChordlessCycles} ignores multiple edges, and identifies a simple circuit using only its
subsequence of vertices. See Section \ref{DigraphAllSimpleCircuits} for more details.

 This method uses the algorithms described in \cite{US14}.

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := ChainDigraph(10);;|
  !gapprompt@gap>| !gapinput@DigraphAllChordlessCycles(D);|
  [  ]
  !gapprompt@gap>| !gapinput@D := Digraph([[1, 1]]);|
  <immutable multidigraph with 1 vertex, 2 edges>
  !gapprompt@gap>| !gapinput@DigraphAllChordlessCycles(D);|
  [  ]
  !gapprompt@gap>| !gapinput@D := CycleDigraph(3);;|
  !gapprompt@gap>| !gapinput@DigraphAllChordlessCycles(D);|
  [ [ 2, 1, 3 ] ]
  !gapprompt@gap>| !gapinput@D := CompleteDigraph(4);|
  <immutable complete digraph with 4 vertices>
  !gapprompt@gap>| !gapinput@DigraphAllChordlessCycles(D);|
  [ [ 2, 1, 3 ], [ 2, 1, 4 ], [ 3, 1, 4 ], [ 3, 2, 4 ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{FacialWalks}}
\logpage{[ 5, 4, 35 ]}\nobreak
\hyperdef{L}{X805F15398735AD7D}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{FacialWalks({\mdseries\slshape digraph, list})\index{FacialWalks@\texttt{FacialWalks}}
\label{FacialWalks}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A list of lists of vertices.



 If \mbox{\texttt{\mdseries\slshape digraph}} is an Eulerian digraph and \mbox{\texttt{\mdseries\slshape list}} is a rotation system of \mbox{\texttt{\mdseries\slshape digraph}}, then \texttt{FacialWalks} returns a list of the \emph{facial walks} in \mbox{\texttt{\mdseries\slshape digraph}}. 

 A rotation system defines for each vertex the ordering of the
out\texttt{\symbol{45}}neighbours. For example, the method \ref{PlanarEmbedding} computes for a planar digraph \mbox{\texttt{\mdseries\slshape D}} the rotation system of a planar embedding of \mbox{\texttt{\mdseries\slshape D}}. The facial walks of \mbox{\texttt{\mdseries\slshape digraph}} are closed walks and they are defined by the rotation system \mbox{\texttt{\mdseries\slshape list}}. They describe the boundaries of the faces of the embedding of \mbox{\texttt{\mdseries\slshape digraph}} given by the rotation system \mbox{\texttt{\mdseries\slshape list}}. The operation \texttt{FacialWalks} ignores multiple edges and loops.

 Here are some examples for planar embeddings: 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D1 := CycleDigraph(4);;|
  !gapprompt@gap>| !gapinput@planar := PlanarEmbedding(D1);|
  [ [ 2 ], [ 3 ], [ 4 ], [ 1 ] ]
  !gapprompt@gap>| !gapinput@FacialWalks(D1, planar);|
  [ [ 1, 2, 3, 4 ] ]
  !gapprompt@gap>| !gapinput@nonPlanar := [[2, 4], [1, 3], [2, 4], [1, 3]];;|
  !gapprompt@gap>| !gapinput@FacialWalks(D1, nonPlanar);|
  [ [ 1, 2, 3, 4 ] ]
  !gapprompt@gap>| !gapinput@D2 := CompleteMultipartiteDigraph([2, 2, 2]);;|
  !gapprompt@gap>| !gapinput@rotationSystem := PlanarEmbedding(D2);|
  [ [ 3, 5, 4, 6 ], [ 6, 4, 5, 3 ], [ 6, 2, 5, 1 ], [ 1, 5, 2, 6 ],
    [ 1, 3, 2, 4 ], [ 1, 4, 2, 3 ] ]
  !gapprompt@gap>| !gapinput@FacialWalks(D2, rotationSystem);|
  [ [ 1, 3, 6 ], [ 1, 4, 5 ], [ 1, 5, 3 ], [ 1, 6, 4 ], [ 2, 3, 5 ],
    [ 2, 4, 6 ], [ 2, 5, 4 ], [ 2, 6, 3 ] ]
\end{Verbatim}
 Here is an example of a non\texttt{\symbol{45}}planar digraph with a
corresponding rotation system: 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D3 := CompleteMultipartiteDigraph([3, 3]);;|
  !gapprompt@gap>| !gapinput@rot := [[6, 5, 4], [6, 5, 4], [6, 5, 4], [1, 2, 3],|
  !gapprompt@>| !gapinput@           [1, 2, 3], [1, 2, 3]];|
  [ [ 6, 5, 4 ], [ 6, 5, 4 ], [ 6, 5, 4 ], [ 1, 2, 3 ], [ 1, 2, 3 ],
    [ 1, 2, 3 ] ]
  !gapprompt@gap>| !gapinput@FacialWalks(D3, rot);|
  [ [ 1, 4, 2, 6, 3, 5 ], [ 1, 5, 2, 4, 3, 6 ], [ 1, 6, 2, 5, 3, 4 ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphLayers}}
\logpage{[ 5, 4, 36 ]}\nobreak
\hyperdef{L}{X870E04307C5F213F}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphLayers({\mdseries\slshape digraph, vertex})\index{DigraphLayers@\texttt{DigraphLayers}}
\label{DigraphLayers}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A list.



 This operation returns a list \texttt{list} such that \texttt{list[i]} is the list of vertices whose minimum distance from the vertex \mbox{\texttt{\mdseries\slshape vertex}} in \mbox{\texttt{\mdseries\slshape digraph}} is \texttt{i \texttt{\symbol{45}} 1}. Vertex \mbox{\texttt{\mdseries\slshape vertex}} is assumed to be at distance \texttt{0} from itself. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := CompleteDigraph(4);;|
  !gapprompt@gap>| !gapinput@DigraphLayers(D, 1);|
  [ [ 1 ], [ 2, 3, 4 ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphDegeneracy}}
\logpage{[ 5, 4, 37 ]}\nobreak
\hyperdef{L}{X7B2E42327DA118E0}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphDegeneracy({\mdseries\slshape digraph})\index{DigraphDegeneracy@\texttt{DigraphDegeneracy}}
\label{DigraphDegeneracy}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A non\texttt{\symbol{45}}negative integer, or \texttt{fail}.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a symmetric digraph without multiple edge\texttt{\symbol{45}} see \texttt{IsSymmetricDigraph} (\ref{IsSymmetricDigraph}) and \texttt{IsMultiDigraph} (\ref{IsMultiDigraph}) \texttt{\symbol{45}} then this attribute returns the degeneracy of \mbox{\texttt{\mdseries\slshape digraph}}. 

 The degeneracy of a digraph is the least integer \texttt{k} such that every induced of \mbox{\texttt{\mdseries\slshape digraph}} contains a vertex whose number of neighbours (excluding itself) is at most \texttt{k}. Note that this means that loops are ignored.

 If \mbox{\texttt{\mdseries\slshape digraph}} is not symmetric or has multiple edges then this attribute returns \texttt{fail}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := DigraphSymmetricClosure(ChainDigraph(5));;|
  !gapprompt@gap>| !gapinput@DigraphDegeneracy(D);|
  1
  !gapprompt@gap>| !gapinput@D := CompleteDigraph(5);;|
  !gapprompt@gap>| !gapinput@DigraphDegeneracy(D);|
  4
  !gapprompt@gap>| !gapinput@D := Digraph([[1], [2, 4, 5], [3, 4], [2, 3, 4], [2], []]);|
  <immutable digraph with 6 vertices, 10 edges>
  !gapprompt@gap>| !gapinput@DigraphDegeneracy(D);|
  1
  !gapprompt@gap>| !gapinput@D := GeneralisedPetersenGraph(IsMutableDigraph, 10, 3);|
  <mutable digraph with 20 vertices, 60 edges>
  !gapprompt@gap>| !gapinput@DigraphDegeneracy(D);|
  3
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphDegeneracyOrdering}}
\logpage{[ 5, 4, 38 ]}\nobreak
\hyperdef{L}{X827C2BD17A4547E3}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphDegeneracyOrdering({\mdseries\slshape digraph})\index{DigraphDegeneracyOrdering@\texttt{DigraphDegeneracyOrdering}}
\label{DigraphDegeneracyOrdering}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A list of integers, or \texttt{fail}.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph for which \texttt{DigraphDegeneracy(}\mbox{\texttt{\mdseries\slshape digraph}}\texttt{)} is a non\texttt{\symbol{45}}negative integer \texttt{k} \texttt{\symbol{45}} see \texttt{DigraphDegeneracy} (\ref{DigraphDegeneracy}) \texttt{\symbol{45}} then this attribute returns a degeneracy ordering of the
vertices of the vertices of \mbox{\texttt{\mdseries\slshape digraph}}.

 A degeneracy ordering of \mbox{\texttt{\mdseries\slshape digraph}} is a list \texttt{ordering} of the vertices of \mbox{\texttt{\mdseries\slshape digraph}} ordered such that for any position \texttt{i} of the list, the vertex \texttt{ordering[i]} has at most \texttt{k} neighbours in later position of the list.

 If \texttt{DigraphDegeneracy(}\mbox{\texttt{\mdseries\slshape digraph}}\texttt{)} returns \texttt{fail}, then this attribute returns \texttt{fail}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := DigraphSymmetricClosure(ChainDigraph(5));;|
  !gapprompt@gap>| !gapinput@DigraphDegeneracyOrdering(D);|
  [ 5, 4, 3, 2, 1 ]
  !gapprompt@gap>| !gapinput@D := CompleteDigraph(5);;|
  !gapprompt@gap>| !gapinput@DigraphDegeneracyOrdering(D);|
  [ 5, 4, 3, 2, 1 ]
  !gapprompt@gap>| !gapinput@D := Digraph([[1], [2, 4, 5], [3, 4], [2, 3, 4], [2], []]);|
  <immutable digraph with 6 vertices, 10 edges>
  !gapprompt@gap>| !gapinput@DigraphDegeneracyOrdering(D);|
  [ 1, 6, 5, 2, 4, 3 ]
  !gapprompt@gap>| !gapinput@D := GeneralisedPetersenGraph(IsMutableDigraph, 3, 1);|
  <mutable digraph with 6 vertices, 18 edges>
  !gapprompt@gap>| !gapinput@DigraphDegeneracyOrdering(D);|
  [ 6, 5, 4, 1, 3, 2 ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{HamiltonianPath}}
\logpage{[ 5, 4, 39 ]}\nobreak
\hyperdef{L}{X863FDFC4839A3B82}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{HamiltonianPath({\mdseries\slshape digraph})\index{HamiltonianPath@\texttt{HamiltonianPath}}
\label{HamiltonianPath}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A list or \texttt{fail}.



 Returns a Hamiltonian path if one exists, \texttt{fail} if not.

 A \emph{Hamiltonian path} of a digraph with \texttt{n} vertices is directed cycle of length \texttt{n}. If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph that contains a Hamiltonian path, then this function returns one,
described in the form used by \texttt{DigraphAllSimpleCircuits} (\ref{DigraphAllSimpleCircuits}). Note if \mbox{\texttt{\mdseries\slshape digraph}} has 0 or 1 vertices, then \texttt{HamiltonianPath} returns \texttt{[]} or \texttt{[1]}, respectively.

 The method used in this attribute has the same worst case complexity as \texttt{DigraphMonomorphism} (\ref{DigraphMonomorphism}). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := Digraph([[]]);|
  <immutable empty digraph with 1 vertex>
  !gapprompt@gap>| !gapinput@HamiltonianPath(D);|
  [ 1 ]
  !gapprompt@gap>| !gapinput@D := Digraph([[2], [1]]);|
  <immutable digraph with 2 vertices, 2 edges>
  !gapprompt@gap>| !gapinput@HamiltonianPath(D);|
  [ 1, 2 ]
  !gapprompt@gap>| !gapinput@D := Digraph([[3], [], [2]]);|
  <immutable digraph with 3 vertices, 2 edges>
  !gapprompt@gap>| !gapinput@HamiltonianPath(D);|
  fail
  !gapprompt@gap>| !gapinput@D := Digraph([[2], [3], [1]]);|
  <immutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@HamiltonianPath(D);|
  [ 1, 2, 3 ]
  !gapprompt@gap>| !gapinput@D := GeneralisedPetersenGraph(IsMutableDigraph, 5, 2);|
  <mutable digraph with 10 vertices, 30 edges>
  !gapprompt@gap>| !gapinput@HamiltonianPath(D);|
  fail
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{NrSpanningTrees}}
\logpage{[ 5, 4, 40 ]}\nobreak
\hyperdef{L}{X82F30D5681466BC6}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{NrSpanningTrees({\mdseries\slshape digraph})\index{NrSpanningTrees@\texttt{NrSpanningTrees}}
\label{NrSpanningTrees}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
An integer.



 Returns the number of spanning trees of the symmetric digraph \mbox{\texttt{\mdseries\slshape digraph}}. \texttt{NrSpanningTrees} will return an error if \mbox{\texttt{\mdseries\slshape digraph}} is not a symmetric digraph. 

 See \texttt{IsSymmetricDigraph} (\ref{IsSymmetricDigraph}) and \texttt{IsUndirectedSpanningTree} (\ref{IsUndirectedSpanningTree}) for more information. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := CompleteDigraph(5);|
  <immutable complete digraph with 5 vertices>
  !gapprompt@gap>| !gapinput@NrSpanningTrees(D);|
  125
  !gapprompt@gap>| !gapinput@D := DigraphSymmetricClosure(CycleDigraph(24));;|
  !gapprompt@gap>| !gapinput@NrSpanningTrees(D);|
  24
  !gapprompt@gap>| !gapinput@NrSpanningTrees(EmptyDigraph(0));|
  0
  !gapprompt@gap>| !gapinput@D := GeneralisedPetersenGraph(IsMutableDigraph, 9, 2);|
  <mutable digraph with 18 vertices, 54 edges>
  !gapprompt@gap>| !gapinput@NrSpanningTrees(D);|
  1134225
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphDijkstra (for a source and target)}}
\logpage{[ 5, 4, 41 ]}\nobreak
\hyperdef{L}{X79352A8286D1D8F6}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphDijkstra({\mdseries\slshape digraph, source, target})\index{DigraphDijkstra@\texttt{DigraphDijkstra}!for a source and target}
\label{DigraphDijkstra:for a source and target}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphDijkstra({\mdseries\slshape digraph, source})\index{DigraphDijkstra@\texttt{DigraphDijkstra}!for a source}
\label{DigraphDijkstra:for a source}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
Two lists.



 If \mbox{\texttt{\mdseries\slshape digraph}} is a digraph and \mbox{\texttt{\mdseries\slshape source}} and \mbox{\texttt{\mdseries\slshape target}} are vertices of \mbox{\texttt{\mdseries\slshape digraph}}, then \texttt{DigraphDijkstra} calculates the length of the shortest path from \mbox{\texttt{\mdseries\slshape source}} to \mbox{\texttt{\mdseries\slshape target}} and returns two lists. Each element of the first list is the distance of the
corresponding element from \mbox{\texttt{\mdseries\slshape source}}. If a vertex was not visited in the process of calculating the shortest
distance to \mbox{\texttt{\mdseries\slshape target}} or if there is no path connecting that vertex with \mbox{\texttt{\mdseries\slshape source}}, then the corresponding distance is \texttt{infinity}. Each element of the second list gives the previous vertex in the shortest
path from \mbox{\texttt{\mdseries\slshape source}} to the corresponding vertex. For \mbox{\texttt{\mdseries\slshape source}} and for any vertices that remained unvisited this will b\texttt{\texttt{\symbol{45}}1}.

 If the optional second argument \mbox{\texttt{\mdseries\slshape target}} is not present, then \texttt{DigraphDijkstra} returns the shortest path from \mbox{\texttt{\mdseries\slshape source}} to every vertex that is reachable from \mbox{\texttt{\mdseries\slshape source}}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@mat := [[0, 1, 1], [0, 0, 1], [0, 0, 0]];|
  [ [ 0, 1, 1 ], [ 0, 0, 1 ], [ 0, 0, 0 ] ]
  !gapprompt@gap>| !gapinput@D := DigraphByAdjacencyMatrix(mat);|
  <immutable digraph with 3 vertices, 3 edges>
  !gapprompt@gap>| !gapinput@DigraphDijkstra(D, 2, 3);|
  [ [ infinity, 0, 1 ], [ -1, -1, 2 ] ]
  !gapprompt@gap>| !gapinput@DigraphDijkstra(D, 1, 3);|
  [ [ 0, 1, 1 ], [ -1, 1, 1 ] ]
  !gapprompt@gap>| !gapinput@DigraphDijkstra(D, 1, 2);|
  [ [ 0, 1, 1 ], [ -1, 1, 1 ] ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphCycleBasis}}
\logpage{[ 5, 4, 42 ]}\nobreak
\hyperdef{L}{X794CD6037D4CF58C}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphCycleBasis({\mdseries\slshape digraph})\index{DigraphCycleBasis@\texttt{DigraphCycleBasis}}
\label{DigraphCycleBasis}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A list and a list of GF(2) vectors



 If \mbox{\texttt{\mdseries\slshape digraph}} is a symmetric loopless digraph with no multiple edges, then \texttt{DigraphCycleBasis} calculates the \emph{fundamental cycle basis} o\mbox{\texttt{\mdseries\slshape digraph}} and returns a list of edges and a list of a basis vectors. If \mbox{\texttt{\mdseries\slshape digraph}} contains a loop, this function will return an error. If \mbox{\texttt{\mdseries\slshape digraph}} is a multi\texttt{\symbol{45}}digraph, then multiple edges incident to the
same vertices are treated as a single edge by this function. See \texttt{IsSymmetricDigraph} (\ref{IsSymmetricDigraph}), \texttt{DigraphHasLoops} (\ref{DigraphHasLoops}), and \texttt{IsMultiDigraph} (\ref{IsMultiDigraph}). The first list returned contains the out\texttt{\symbol{45}}neighours that
provide the ordering on the edges with the symmetric edges appearing only
once; these are the same as \emph{OutNeighbours(MaximalAntiSymmetricSubdigraph(G))}. Se\texttt{MaximalAntiSymmetricSubdigraph} (\ref{MaximalAntiSymmetricSubdigraph}) \texttt{OutNeighbours} (\ref{OutNeighbours}). The second list returned contains the basis vectors of the cycle space of
the digraph. These vectors belongs to $(GF(2))^m$ where $m$ is the length of the list of edges.

 A graph is \emph{eulerian} if every vertex has an even degree. A \emph{cycle space} of a graph is a subspace of $(GF(2))^m$ representing the set of all \emph{eulerian} subgraphs without isolated vertices. An eulerian subgraph without isolated
vertices can be uniquely identified using the edges that is contains.
Therefore, given some ordering on the edges of the graph, a subgraph can be
represented by a vector in $(GF(2))^m$ where the $i$\texttt{\symbol{45}}th entry is $1$ if the $i$\texttt{\symbol{45}}th edge is in the subgraph and $0$ otherwise. In this function, the ordering of the edges is returned as the
first list which corresponds to \texttt{OutNeighbours(MaximalAntiSymmetricSubdigraph(G))}. See \texttt{MaximalAntiSymmetricSubdigraph} (\ref{MaximalAntiSymmetricSubdigraph}) and \texttt{OutNeighbours} (\ref{OutNeighbours}). The first basis vector for the complete digraph with 4 vertices shown below
represents the edges \texttt{[1, 2]}, \texttt{[1, 3]} and \texttt{[2, 3]} i.e. cycle subgraph between the vertices \texttt{1}, \texttt{2} and \texttt{3} The cycle space is closed under the symmetric difference of the edges of the
graph. This nicely corresponds to the addition of vectors in $(GF(2))^m$ which makes the vector space formulation of the cycle space very natural.

 A \emph{cycle basis} is a basis of the cycle space. A \emph{fundamental cycle basis} is a special kind of basis of the cycle space where there is a specific
spanning tree (forest, when the graph is disconnected) of the graph and each
basis corresponds to the unique cycle created by adding an edge outside the
spanning tree of the graph to the spanning tree. In this function, the
spanning forest is rooted in the vertex with the smallest label for each
connected component of the graph. 

 The fundamental cycle basis is unique up to reordering of the basis vectors.
The number of basis vectors in the fundamental cycle basis is $m - n + c$, where $m$ is the number of edges, $n$ is the number of vertices, and $c$ is the number of connected components. See \texttt{DigraphConnectedComponents} (\ref{DigraphConnectedComponents}).

 This function performs a depth first traversal of the input digraph with
complexity $O(m + n)$ and the complexity of the computation of the basis is $O(m^2)$ where $m$ is the number of edges in the input digraph. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D := CycleGraph(4);|
  <immutable symmetric digraph with 4 vertices, 8 edges>
  !gapprompt@gap>| !gapinput@res := DigraphCycleBasis(D);|
  [ [ [ 2, 4 ], [ 3 ], [ 4 ], [  ] ], [ <a GF2 vector of length 4> ] ]
  !gapprompt@gap>| !gapinput@List(res[2][1]);|
  [ Z(2)^0, Z(2)^0, Z(2)^0, Z(2)^0 ]
  !gapprompt@gap>| !gapinput@D := CompleteDigraph(4);                                     |
  <immutable complete digraph with 4 vertices>
  !gapprompt@gap>| !gapinput@res := DigraphCycleBasis(D);|
  [ [ [ 2, 3, 4 ], [ 3, 4 ], [ 4 ], [  ] ], 
    [ <a GF2 vector of length 6>, <a GF2 vector of length 6>, 
        <a GF2 vector of length 6> ] ]
  !gapprompt@gap>| !gapinput@List(res[2][1]);            |
  [ Z(2)^0, 0*Z(2), Z(2)^0, 0*Z(2), Z(2)^0, 0*Z(2) ]
  !gapprompt@gap>| !gapinput@List(res[2][2]);|
  [ 0*Z(2), Z(2)^0, Z(2)^0, 0*Z(2), 0*Z(2), Z(2)^0 ]
  !gapprompt@gap>| !gapinput@List(res[2][3]);|
  [ Z(2)^0, Z(2)^0, 0*Z(2), Z(2)^0, 0*Z(2), 0*Z(2) ]
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphIsKing}}
\logpage{[ 5, 4, 43 ]}\nobreak
\hyperdef{L}{X835AAF9085BC9D84}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphIsKing({\mdseries\slshape D, v, k})\index{DigraphIsKing@\texttt{DigraphIsKing}}
\label{DigraphIsKing}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
\texttt{true} or \texttt{false}.



 If \mbox{\texttt{\mdseries\slshape D}} is a tournament and \mbox{\texttt{\mdseries\slshape v}} is a vertex in the tournament, then this operation returns \texttt{true} if every other vertex of \mbox{\texttt{\mdseries\slshape D}} is reachable from \mbox{\texttt{\mdseries\slshape v}} by a path of length at most \mbox{\texttt{\mdseries\slshape k}}. Otherwise, an error is given. If \texttt{true} is returned, then the vertex, \mbox{\texttt{\mdseries\slshape v}}, is a \mbox{\texttt{\mdseries\slshape k}}\texttt{\symbol{45}}king. 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gr := Digraph([[2, 3, 4], [3, 5], [5], [2, 3], [1, 4]]);|
  <immutable digraph with 5 vertices, 10 edges>
  !gapprompt@gap>| !gapinput@DigraphIsKing(gr, 2, 2);|
  true
  !gapprompt@gap>| !gapinput@DigraphIsKing(gr, 3, 2);|
  false
  !gapprompt@gap>| !gapinput@OutNeighboursOfVertex(gr, 3);|
  [ 5 ]
  !gapprompt@gap>| !gapinput@OutNeighboursOfVertex(gr, 5);|
  [ 1, 4 ]
  !gapprompt@gap>| !gapinput@Union(last, last2);|
  [ 1, 4, 5 ]
  !gapprompt@gap>| !gapinput@DigraphIsKing(gr, 3, 4);|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DigraphKings}}
\logpage{[ 5, 4, 44 ]}\nobreak
\hyperdef{L}{X7A17B9B67AC50561}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DigraphKings({\mdseries\slshape D, n})\index{DigraphKings@\texttt{DigraphKings}}
\label{DigraphKings}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A list.



 If \mbox{\texttt{\mdseries\slshape D}} is a tournament, then this operation returns a list of the \mbox{\texttt{\mdseries\slshape n}}\texttt{\symbol{45}}kings in the tournament (se\texttt{DigraphIsKing} (\ref{DigraphIsKing})).

 If \mbox{\texttt{\mdseries\slshape D}} is not tournament, then an error is given (see \texttt{IsTournament} (\ref{IsTournament})). If the tournament contains a source, then the source is the only
2\texttt{\symbol{45}}king (see \texttt{DigraphSources} (\ref{DigraphSources})). The number of 2\texttt{\symbol{45}}kings in a tournament without a source
is at least three. A tournament cannot have exactly two
2\texttt{\symbol{45}}kings. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gr := Digraph([[2, 3, 4], [3, 5], [5], [2, 3], [1, 4]]);|
  <immutable digraph with 5 vertices, 10 edges>
  !gapprompt@gap>| !gapinput@DigraphKings(gr, 2);|
  [ 1, 2, 5 ]
  !gapprompt@gap>| !gapinput@gr := Digraph([[2, 3, 4, 5], [3, 5], [5], [2, 3], [4]]);|
  <immutable digraph with 5 vertices, 10 edges>
  !gapprompt@gap>| !gapinput@DigraphSources(gr);|
  [ 1 ]
  !gapprompt@gap>| !gapinput@DigraphKings(gr, 2);|
  [ 1 ]
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{Cayley graphs of groups}}\logpage{[ 5, 5, 0 ]}
\hyperdef{L}{X82F900777D677F55}{}
{
 

\subsection{\textcolor{Chapter }{GroupOfCayleyDigraph}}
\logpage{[ 5, 5, 1 ]}\nobreak
\hyperdef{L}{X7A000B1D7CCF7093}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{GroupOfCayleyDigraph({\mdseries\slshape digraph})\index{GroupOfCayleyDigraph@\texttt{GroupOfCayleyDigraph}}
\label{GroupOfCayleyDigraph}
}\hfill{\scriptsize (attribute)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{SemigroupOfCayleyDigraph({\mdseries\slshape digraph})\index{SemigroupOfCayleyDigraph@\texttt{SemigroupOfCayleyDigraph}}
\label{SemigroupOfCayleyDigraph}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A group or semigroup.



 If \mbox{\texttt{\mdseries\slshape digraph}} is an immutable Cayley graph of a group \texttt{G} and \mbox{\texttt{\mdseries\slshape digraph}} belongs to the category \texttt{IsCayleyDigraph} (\ref{IsCayleyDigraph}), then \texttt{GroupOfCayleyDigraph} returns \texttt{G}. 

 If \mbox{\texttt{\mdseries\slshape digraph}} is a Cayley graph of a semigroup \texttt{S} an\mbox{\texttt{\mdseries\slshape digraph}} belongs to the category \texttt{IsCayleyDigraph} (\ref{IsCayleyDigraph}), then \texttt{SemigroupOfCayleyDigraph} returns \texttt{S}. 

 See also \texttt{GeneratorsOfCayleyDigraph} (\ref{GeneratorsOfCayleyDigraph}). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G := DihedralGroup(IsPermGroup, 8);|
  Group([ (1,2,3,4), (2,4) ])
  !gapprompt@gap>| !gapinput@digraph := CayleyDigraph(G);|
  <immutable digraph with 8 vertices, 16 edges>
  !gapprompt@gap>| !gapinput@GroupOfCayleyDigraph(digraph) = G;|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{GeneratorsOfCayleyDigraph}}
\logpage{[ 5, 5, 2 ]}\nobreak
\hyperdef{L}{X8528455987D7D2BF}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{GeneratorsOfCayleyDigraph({\mdseries\slshape digraph})\index{GeneratorsOfCayleyDigraph@\texttt{GeneratorsOfCayleyDigraph}}
\label{GeneratorsOfCayleyDigraph}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A list of generators.



 If \mbox{\texttt{\mdseries\slshape digraph}} is an immutable Cayley graph of a group or semigroup with respect to a set of
generators \texttt{gens} and \mbox{\texttt{\mdseries\slshape digraph}} belongs to the category \texttt{IsCayleyDigraph} (\ref{IsCayleyDigraph}), then \texttt{GeneratorsOfCayleyDigraph} return the list of generators \texttt{gens} over which \mbox{\texttt{\mdseries\slshape digraph}} is defined. 

 See also \texttt{GroupOfCayleyDigraph} (\ref{GroupOfCayleyDigraph}) or \texttt{SemigroupOfCayleyDigraph} (\ref{SemigroupOfCayleyDigraph}). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G := DihedralGroup(IsPermGroup, 8);|
  Group([ (1,2,3,4), (2,4) ])
  !gapprompt@gap>| !gapinput@digraph := CayleyDigraph(G);|
  <immutable digraph with 8 vertices, 16 edges>
  !gapprompt@gap>| !gapinput@GeneratorsOfCayleyDigraph(digraph) = GeneratorsOfGroup(G);|
  true
  !gapprompt@gap>| !gapinput@digraph := CayleyDigraph(G, [()]);|
  <immutable digraph with 8 vertices, 8 edges>
  !gapprompt@gap>| !gapinput@GeneratorsOfCayleyDigraph(digraph) = [()];|
  true
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{Associated semigroups}}\logpage{[ 5, 6, 0 ]}
\hyperdef{L}{X790FD6647ECCAE3C}{}
{
 

\subsection{\textcolor{Chapter }{AsSemigroup (for a filter and a digraph)}}
\logpage{[ 5, 6, 1 ]}\nobreak
\hyperdef{L}{X87D5C60D7B0C1309}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{AsSemigroup({\mdseries\slshape filt, digraph})\index{AsSemigroup@\texttt{AsSemigroup}!for a filter and a digraph}
\label{AsSemigroup:for a filter and a digraph}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{AsMonoid({\mdseries\slshape filt, digraph})\index{AsMonoid@\texttt{AsMonoid}}
\label{AsMonoid}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
A semilattice of partial perms.



 The operation \texttt{AsSemigroup} requires that \mbox{\texttt{\mdseries\slshape filt}} be equal to \texttt{IsPartialPermSemigroup} (\textbf{Reference: IsPartialPermSemigroup}). If \mbox{\texttt{\mdseries\slshape digraph}} is a \texttt{IsJoinSemilatticeDigraph} (\ref{IsJoinSemilatticeDigraph}) or \texttt{IsLatticeDigraph} (\ref{IsLatticeDigraph}) then \texttt{AsSemigroup} returns a semigroup of partial perms which is isomorphic to the semigroup
whose elements are the vertices of \mbox{\texttt{\mdseries\slshape digraph}} with the binary operation \texttt{PartialOrderDigraphJoinOfVertices} (\ref{PartialOrderDigraphJoinOfVertices}). If \mbox{\texttt{\mdseries\slshape digraph}} satisfies \texttt{IsMeetSemilatticeDigraph} (\ref{IsMeetSemilatticeDigraph}) but not \texttt{IsJoinSemilatticeDigraph} (\ref{IsJoinSemilatticeDigraph}) then \texttt{AsSemigroup} returns a semigroup of partial perms which is isomorphic to the semigroup
whose elements are the vertices of \mbox{\texttt{\mdseries\slshape digraph}} with the binary operation \texttt{PartialOrderDigraphMeetOfVertices} (\ref{PartialOrderDigraphMeetOfVertices}). 

 The operation \texttt{AsMonoid} behaves similarly to \texttt{AsSemigroup} except that \mbox{\texttt{\mdseries\slshape filt}} may also be equal to \texttt{IsPartialPermMonoid} (\textbf{Reference: IsPartialPermMonoid}), \mbox{\texttt{\mdseries\slshape digraph}} must satisfy \texttt{IsLatticeDigraph} (\ref{IsLatticeDigraph}), and the output satisfies \texttt{IsMonoid} (\textbf{Reference: IsMonoid}). 

 The output of both of these operations is guaranteed to be of minimal degree
(see \texttt{DegreeOfPartialPermSemigroup} (\textbf{Reference: DegreeOfPartialPermSemigroup})). Furthermore the \texttt{GeneratorsOfSemigroup} (\textbf{Reference: GeneratorsOfSemigroup}) of the output is guaranteed to be the unique generating set of minimal size. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@di := Digraph([[1], [1, 2], [1, 3], [1, 4], [1, 2, 3, 5]]);|
  <immutable digraph with 5 vertices, 11 edges>
  !gapprompt@gap>| !gapinput@S := AsSemigroup(IsPartialPermSemigroup, di);|
  <partial perm semigroup of rank 3 with 4 generators>
  !gapprompt@gap>| !gapinput@ForAll(Elements(S), IsIdempotent);|
  true
  !gapprompt@gap>| !gapinput@IsInverseSemigroup(S);|
  true
  !gapprompt@gap>| !gapinput@Size(S);|
  5
  !gapprompt@gap>| !gapinput@di := Digraph([[1], [1, 2], [1, 2, 3]]);|
  <immutable digraph with 3 vertices, 6 edges>
  !gapprompt@gap>| !gapinput@M := AsMonoid(IsPartialPermMonoid, di);|
  <partial perm monoid of rank 2 with 3 generators>
  !gapprompt@gap>| !gapinput@Size(M);|
  3
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{AsSemigroup (for a filter, semilattice digraph, and two lists)}}
\logpage{[ 5, 6, 2 ]}\nobreak
\hyperdef{L}{X7C6D5EC27C51066B}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{AsSemigroup({\mdseries\slshape filt, Y, gps, homs})\index{AsSemigroup@\texttt{AsSemigroup}!for a filter, semilattice digraph, and two lists}
\label{AsSemigroup:for a filter, semilattice digraph, and two lists}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:}
 A Clifford semigroup of partial perms. 



 The operation \texttt{AsSemigroup} requires that \mbox{\texttt{\mdseries\slshape filt}} be equal to \texttt{IsPartialPermSemigroup} (\textbf{Reference: IsPartialPermSemigroup}). If \mbox{\texttt{\mdseries\slshape Y}} is a \texttt{IsJoinSemilatticeDigraph} (\ref{IsJoinSemilatticeDigraph}) or \texttt{IsMeetSemilatticeDigraph} (\ref{IsMeetSemilatticeDigraph}), \mbox{\texttt{\mdseries\slshape gps}} is a list of groups corresponding to each vertex, and \mbox{\texttt{\mdseries\slshape homs}} is a list containing for each edge \texttt{(i, j)} in the transitive reduction of \mbox{\texttt{\mdseries\slshape digraph}} a triple \texttt{[i, j, hom]} where \texttt{hom} is a group homomorphism from \texttt{gps[i]} to \texttt{gps[j]}, and the diagram of homomorphisms commutes, then \texttt{AsSemigroup} returns a semigroup of partial perms which is isomorphic to the strong
semilattice of groups $S[Y; gps; homs]$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G1 := AlternatingGroup(4);;|
  !gapprompt@gap>| !gapinput@G2 := SymmetricGroup(2);;|
  !gapprompt@gap>| !gapinput@G3 := SymmetricGroup(3);;|
  !gapprompt@gap>| !gapinput@gr := Digraph([[1, 3], [2, 3], [3]]);;|
  !gapprompt@gap>| !gapinput@sgn := function(x)|
  !gapprompt@>| !gapinput@if SignPerm(x) = 1 then|
  !gapprompt@>| !gapinput@return ();|
  !gapprompt@>| !gapinput@fi;|
  !gapprompt@>| !gapinput@return (1, 2);|
  !gapprompt@>| !gapinput@end;;|
  !gapprompt@gap>| !gapinput@hom13 := GroupHomomorphismByFunction(G1, G3, sgn);;|
  !gapprompt@gap>| !gapinput@hom23 := GroupHomomorphismByFunction(G2, G3, sgn);;|
  !gapprompt@gap>| !gapinput@T := AsSemigroup(IsPartialPermSemigroup,|
  !gapprompt@>| !gapinput@gr,|
  !gapprompt@>| !gapinput@[G1, G2, G3], [[1, 3, hom13], [2, 3, hom23]]);;|
  !gapprompt@gap>| !gapinput@Size(T);|
  20
  !gapprompt@gap>| !gapinput@D := GreensDClasses(T);;|
  !gapprompt@gap>| !gapinput@List(D, Size);|
  [ 6, 12, 2 ]
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{Planarity}}\logpage{[ 5, 7, 0 ]}
\hyperdef{L}{X7E2305528492DDC0}{}
{
 

\subsection{\textcolor{Chapter }{KuratowskiPlanarSubdigraph}}
\logpage{[ 5, 7, 1 ]}\nobreak
\hyperdef{L}{X7DC478637E8C190D}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{KuratowskiPlanarSubdigraph({\mdseries\slshape digraph})\index{KuratowskiPlanarSubdigraph@\texttt{KuratowskiPlanarSubdigraph}}
\label{KuratowskiPlanarSubdigraph}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:}
A list or \texttt{fail}.



 \texttt{KuratowskiPlanarSubdigraph} returns the immutable list of lists of out\texttt{\symbol{45}}neighbours of an
--> --------------------

--> maximum size reached

--> --------------------

Messung V0.5 in Prozent
C=100 H=100 G=100

¤ Dauer der Verarbeitung: 0.524 Sekunden  (vorverarbeitet am  2026-04-27) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge