From 8f6a85906eed05ad9e0bf213a1232b24ab5f5d71 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 9 Mar 2018 22:45:46 +0000 Subject: adigraph (9mar18) git-svn-id: svn://tug.org/texlive/trunk@46901 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/adigraph/README.md | 194 +++--- .../latex/adigraph/adigraph_library_example.pdf | Bin 30254 -> 0 bytes .../latex/adigraph/adigraph_library_example.tex | 99 --- .../doc/latex/adigraph/documentation.pdf | Bin 0 -> 83820 bytes .../doc/latex/adigraph/documentation.tex | 670 +++++++++++++++++++++ .../doc/latex/adigraph/img_examples/example_0.jpg | Bin 0 -> 22295 bytes .../doc/latex/adigraph/img_examples/example_1.jpg | Bin 8232 -> 28096 bytes .../doc/latex/adigraph/img_examples/example_2.jpg | Bin 0 -> 25779 bytes .../doc/latex/adigraph/img_examples/example_3.jpg | Bin 0 -> 30001 bytes .../latex/adigraph/img_examples/example_cut.jpg | Bin 11032 -> 0 bytes Master/texmf-dist/doc/latex/adigraph/test.pdf | Bin 0 -> 13329 bytes Master/texmf-dist/doc/latex/adigraph/test.tex | 42 ++ 12 files changed, 793 insertions(+), 212 deletions(-) delete mode 100644 Master/texmf-dist/doc/latex/adigraph/adigraph_library_example.pdf delete mode 100644 Master/texmf-dist/doc/latex/adigraph/adigraph_library_example.tex create mode 100644 Master/texmf-dist/doc/latex/adigraph/documentation.pdf create mode 100644 Master/texmf-dist/doc/latex/adigraph/documentation.tex create mode 100644 Master/texmf-dist/doc/latex/adigraph/img_examples/example_0.jpg create mode 100644 Master/texmf-dist/doc/latex/adigraph/img_examples/example_2.jpg create mode 100644 Master/texmf-dist/doc/latex/adigraph/img_examples/example_3.jpg delete mode 100644 Master/texmf-dist/doc/latex/adigraph/img_examples/example_cut.jpg create mode 100644 Master/texmf-dist/doc/latex/adigraph/test.pdf create mode 100644 Master/texmf-dist/doc/latex/adigraph/test.tex (limited to 'Master/texmf-dist/doc/latex') diff --git a/Master/texmf-dist/doc/latex/adigraph/README.md b/Master/texmf-dist/doc/latex/adigraph/README.md index b2e269014de..f7d9e127783 100644 --- a/Master/texmf-dist/doc/latex/adigraph/README.md +++ b/Master/texmf-dist/doc/latex/adigraph/README.md @@ -1,145 +1,113 @@ -# Smart Augmenting Graphs +# Adigraph +[Adigraph](https://ctan.org/pkg/adigraph) is a pure latex library for drawing directed graphs and augmenting directed graphs, and to draw cuts over them. It DOES NOT require external libraries such as Graphviz or DOT. -Copyright 2018 Luca Cappelletti +It handles automatically the positioning of labels, with the exception of the horizontal position, and the inclinations of cuts. -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +**This library is released under MIT license (Copyright 2018 Luca Cappelletti)**. -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -A tex package to draw **augmenting graphs** easily and to draw **cuts** on them too. - -This package requires the packages **fp**, **xparse**, **xstring** and **tikz** (in particular tikz/calc). If you don't have them you can proceed by installing them by running: +## Documentation +For more information, you can read the documentation available [here](https://github.com/LucaCappelletti94/adigraph/blob/master/documentation.pdf) +## Basic setup +### Installing the package +If you are on Linux or macOs you can run the following. ```bash -sudo tlmgr instal fp xparse xstring tikz +sudo tlmgr install fp etoolbox adigraph ``` -I'm currently looking into publishing this package on ctan, until then you'll have to download it and include in locally with the usual: +Otherwise install the packages with the package manager of your choice. + +### Requiring the package in the document +Remember to require the package in the document. ```latex \usepackage{adigraph} ``` -Then, suppose you want to create a graph as the following: +## Basic example +More examples and step by step explanation is available in the [documentation](https://github.com/LucaCappelletti94/adigraph/blob/master/documentation.pdf). + +Suppose you want to create a graph as the following, with an augmenting path highlighted and a couple of cuts: -![alt text][graph] +

+ +

-We start by defining a new graph: +We start by defining a new graph, called *myAdigraph*: ```latex - \NewAdigraph{myAdigraph}{ - s,0,0,b,red; - 1,2,2; - 3,2,-2; - 2,6,2; - 4,6,-2; - t,8,0,e,blue; - }{ - s,3,25; - s,1,25; - 3,1,5; - 3,4,20; - 4,2,5; - 2,3,15,0,near start; - 4,1,5,0,near start; - 1,2,35; - 2,t,20; - 4,t,30; - } +\NewAdigraph{myAdigraph}{ + s:0,0; + 1:2,2; + 3:2,-2; + 2:6,2; + 4:6,-2; + t:8,0; +}{ + s,1:25; + s,3:25; + 3,4:25; + 1,2:35; + 2,t:20; + 4,t:30; + 3,1:10; + 4,2:10; + 2,3:15::near start; + 4,1:5::near start; +} ``` -In the first argument we are defining the *nodes*, while in the second one we are defining the *edges*. The name of this particular graph will be *myAdigraph*. - -We now want to draw this graph. We proceed as follows: +At this point the output is the following: ```latex -\begin{figure} - \center - \myAdigraph{} - \caption{My Personal Graph} -\end{figure} +\myAdigraph{} ``` -Suppose now we want to show the steps for calculating the maximum flow of the graph. We just add the edited edges inside the now empty argument of the *\myAdigraph*: +

+ +

+Then we can add the augmenting path as follows: ```latex -\begin{figure} - \center - \myAdigraph{ - s,3,5,20,1; - 3,4,0,20,1; - 4,t,20,10,1; - } - \caption{Sending 10 units over $s,3,4,t$} -\end{figure} - -\begin{figure} - \center - \myAdigraph{ - s,3,5,20; - 3,4,0,20; - s,1,20,5,1; - 4,1,5,0,red,blue,near start; - 4,t,15,15,1; - } - \caption{Sending 5 units over $s,1,4,t$} -\end{figure} - -\begin{figure} - \center - \myAdigraph{ - s,3,5,20; - 3,4,0,20; - s,1,15,10,1; - 1,2,25,10,1; - 4,2,5,0,1; - 4,t,10,20,1; - } - \caption{Sending 5 units over $s,1,2,4,t$} -\end{figure} - -\begin{figure} - \center - \myAdigraph{ - s,3,5,20; - 3,4,0,20; - s,1,5,20,1; - 1,2,15,20,1; - 4,2,5,0; - 2,t,0,20,1; - 4,t,10,20; - } - \caption{Sending 10 units over $s,1,2,t$} -\end{figure} - -\begin{figure} - \center - \myAdigraph[ - 3,4; - 2,t; - ]{ - s,3,5,20; - 3,4,0,20; - s,1,5,20,1; - 1,2,15,20,1; - 4,2,5,0; - 2,t,0,20,1; - 4,t,10,20; - } - \caption{Showing minimum cut} -\end{figure} +\myAdigraph{ + s,3,4,2,t:5; +} ``` -The working example in latex is found in the file *adigraph_library_example.tex*. +

+ +

+ +And the cuts (remember that the paths from previous steps are memorized by the library) are added as follows: + +```latex +\myAdigraph{}{ + 2,t,red; + 3,4,blue; +} +``` The result with the cuts is the following: -![alt text][cuts] +

+ +

+ +You can add both cuts and paths at the same time to keep the latest path highlighted: + +```latex +\myAdigraph{ + s,3,4,2,t:5; +}{ + 2,t,red; + 3,4,blue; +} +``` + +

+ +

Have a nice day! -**Luca Cappelletti** -[graph]: https://github.com/LucaCappelletti94/smart_augmenting_graphs/blob/master/img_examples/example_1.jpg?raw=true "Graph example" -[cuts]: https://github.com/LucaCappelletti94/smart_augmenting_graphs/blob/master/img_examples/example_cut.jpg?raw=true "Example with cuts" \ No newline at end of file +**Luca Cappelletti** diff --git a/Master/texmf-dist/doc/latex/adigraph/adigraph_library_example.pdf b/Master/texmf-dist/doc/latex/adigraph/adigraph_library_example.pdf deleted file mode 100644 index 9ed04629655..00000000000 Binary files a/Master/texmf-dist/doc/latex/adigraph/adigraph_library_example.pdf and /dev/null differ diff --git a/Master/texmf-dist/doc/latex/adigraph/adigraph_library_example.tex b/Master/texmf-dist/doc/latex/adigraph/adigraph_library_example.tex deleted file mode 100644 index 021d66cc4a7..00000000000 --- a/Master/texmf-dist/doc/latex/adigraph/adigraph_library_example.tex +++ /dev/null @@ -1,99 +0,0 @@ -\documentclass{report} - -\usepackage{adigraph} - -\begin{document} - -\NewAdigraph{myAdigraph}{ - s,0,0,b,red; - 1,2,2; - 3,2,-2; - 2,6,2; - 4,6,-2; - t,8,0,e,blue; -}{ - s,3,15,10; - s,1,25; - 3,1,5; - 3,4,10,10; - 4,2,0,5; - 2,3,15,0,black,black,near start; - 4,1,0,5,black,black,near start; - 1,2,30,5; - 2,t,10,10; - 4,t,30; -} - -\begin{figure} - \center - \myAdigraph{} - \caption{My Personal Graph} -\end{figure} - -\begin{figure} - \center - \myAdigraph{ - s,3,5,20,1; - 3,4,0,20,1; - 4,t,20,10,1; - } - \caption{Sending 10 units over $s,3,4,t$} -\end{figure} - -\begin{figure} - \center - \myAdigraph{ - s,3,5,20; - 3,4,0,20; - s,1,20,5,1; - 4,1,5,0,red,blue,near start; - 4,t,15,15,1; - } - \caption{Sending 5 units over $s,1,4,t$} -\end{figure} - -\begin{figure} - \center - \myAdigraph{ - s,3,5,20; - 3,4,0,20; - s,1,15,10,1; - 1,2,25,10,1; - 4,2,5,0,1; - 4,t,10,20,1; - } - \caption{Sending 5 units over $s,1,2,4,t$} -\end{figure} - -\begin{figure} - \center - \myAdigraph{ - s,3,5,20; - 3,4,0,20; - s,1,5,20,1; - 1,2,15,20,1; - 4,2,5,0; - 2,t,0,20,1; - 4,t,10,20; - } - \caption{Sending 10 units over $s,1,2,t$} -\end{figure} - -\begin{figure} - \center - \myAdigraph[ - 3,4; - 2,t; - ]{ - s,3,5,20; - 3,4,0,20; - s,1,5,20,1; - 1,2,15,20,1; - 4,2,5,0; - 2,t,0,20,1; - 4,t,10,20; - } - \caption{Showing minimum cut} -\end{figure} - -\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/adigraph/documentation.pdf b/Master/texmf-dist/doc/latex/adigraph/documentation.pdf new file mode 100644 index 00000000000..911e38550ad Binary files /dev/null and b/Master/texmf-dist/doc/latex/adigraph/documentation.pdf differ diff --git a/Master/texmf-dist/doc/latex/adigraph/documentation.tex b/Master/texmf-dist/doc/latex/adigraph/documentation.tex new file mode 100644 index 00000000000..d572758fe75 --- /dev/null +++ b/Master/texmf-dist/doc/latex/adigraph/documentation.tex @@ -0,0 +1,670 @@ +\documentclass{report} + +\title{Adigraph, V1.2} +\author{Luca Cappelletti} +\date{March 2018} + +\usepackage{adigraph} +\usepackage{xcolor} +\usepackage[colorlinks=true,urlcolor=blue,pdfpagelabels,hyperindex=false]{hyperref} +\usepackage{minted} +\usepackage{multicol} +\usepackage{graphicx} % for images and generally graphics +\usepackage{caption} % enabling of nice captions +\usepackage{subcaption} % and subcaptions of images +\definecolor{mintedbackground}{rgb}{0.95,0.95,0.95} +\setminted{ + bgcolor=mintedbackground, + fontfamily=tt, + linenos=true, + numberblanklines=true, + numbersep=5pt, + gobble=0, + frame=leftline, + framerule=0.4pt, + framesep=2mm, + funcnamehighlighting=true, + tabsize=4, + obeytabs=false, + mathescape=false + samepage=false, %with this setting you can force the list to appear on the same page + showspaces=false, + showtabs =false, + texcl=false, +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% THE FOLLOWING CENTERS ALL FLOATING ITEMS BY DEFAULT % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\makeatletter +\g@addto@macro\@floatboxreset\centering +\makeatother + +\makeatletter +\apptocmd\subcaption@minipage{\centering}{}{} +\makeatother + +\makeatletter +\providecommand*\setfloatlocations[2]{\@namedef{fps@#1}{#2}} +\makeatother +\setfloatlocations{figure}{H} +\setfloatlocations{table}{H} + +\begin{document} + +\maketitle + +{\hypersetup{hidelinks} + \tableofcontents % Generates the table of contents +} + +\chapter{Introduction} +\section{What is Adigraph?} +\textbf{\href{https://ctan.org/pkg/adigraph}{Adigraph}} is a latex library for drawing directed graphs and augmenting directed graphs, and to draw cuts over them. + +It handles automatically the positioning of labels, with the exception of the horizontal position, and the inclinations of cuts. + +The latest version is available on \href{https://github.com/LucaCappelletti94/adigraph}{Github}. + +\section{License} +Copyright 2018 Luca Cappelletti + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sub-license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\\ + +\chapter{Setup} +\section{Installing the dependencies} +Clearly you need to have texlive installed. Then, make sure you have the following packages: + +\begin{description} + \item[\href{https://ctan.org/pkg/fp}{fp}] Used for floating point calculations. + \item[\href{https://ctan.org/pkg/xparse}{xparse}] Used for elaborating parameters. + \item[\href{https://ctan.org/pkg/xstring}{xstring}] Used for elaborating strings. + \item[\href{https://ctan.org/pkg/etoolbox}{etoolbox}] Used for operations on lists. + \item[tikz] Used for drawing the actual graphs. + \item[tikz calc library] Used for some internal calculations in tikz. +\end{description} + +To be sure you can run the following, that will install the packages only if they are not already present: + +\begin{minted}{sh} +sudo tlmgr install etoolbox fp xstring +\end{minted} + +\section{Installing Adigraph} +You can install Adigraph, if it isn't already present in your setup, by running the following on Unix systems: + +\begin{minted}{sh} +sudo tlmgr install adigraph +\end{minted} + +On windows you should check on your package manager of choice (some latex distribution have a tlmgr implementation on windows too.) + +\chapter{Usage} +\section{Creating a new graph} +Here we create a new Adigraph object, called \textit{myAdigraph}. + +\begin{minted}{latex} +\NewAdigraph{myAdigraph}{ + +}{ + +}{ + +} +\end{minted} + +\section{Adding nodes} +We set its nodes with the following syntax: \textit{}. + +\begin{figure} + \begin{subfigure}{0.49\textwidth} + \begin{minted}{latex} +\NewAdigraph{myAdigraph}{ + s:0,0; + t:4,0; +} +\myAdigraph{} +\end{minted} + \end{subfigure} + \begin{subfigure}{0.49\textwidth} + \NewAdigraph{myAdigraph}{ + s:0,0; + t:4,0; + } + \myAdigraph{} + \end{subfigure} +\end{figure} + + +\subsection{Custom node colors} +To color a node you can use the following syntax: \textit{}. For example, to draw s in red and t in blue we would write: + +\begin{figure} + \begin{subfigure}{0.49\textwidth} + \begin{minted}{latex} +\NewAdigraph{myAdigraph}{ + s:0,0,red; + t:4,0,blue; +} +\myAdigraph{} +\end{minted} + \end{subfigure} + \begin{subfigure}{0.49\textwidth} + \NewAdigraph{myAdigraph}{ + s:0,0,red; + t:4,0,blue; + } + \myAdigraph{} + \end{subfigure} +\end{figure} + +Tested available colors are: red, blue, black, green. You may extend the possible colors with LaTex libraries such as xcolor. + +\subsection{Custom node labels} +To add a custom label you can use the following syntax: either \textit{} or \textit{} will work: + +\begin{figure} + \begin{subfigure}{0.49\textwidth} + \begin{minted}{latex} +\NewAdigraph{myAdigraph}{ + s:0,0,red:start; + t:4,0:end; +} +\myAdigraph{} +\end{minted} + \end{subfigure} + \begin{subfigure}{0.49\textwidth} + \NewAdigraph{myAdigraph}{ + s:0,0,red:start; + t:4,0:end; + } + \myAdigraph{} + \end{subfigure} +\end{figure} + +\section{Adding edges} +We set its nodes with the following syntax: \textit{}. + +\subsection{A simple edge} +\begin{figure} + \begin{subfigure}{0.49\textwidth} + \begin{minted}{latex} +\NewAdigraph{myAdigraph}{ + s:0,0; + t:4,0; +}{ + s,t; +} +\myAdigraph{} +\end{minted} + \end{subfigure} + \begin{subfigure}{0.49\textwidth} + \NewAdigraph{myAdigraph}{ + s:0,0; + t:4,0; + }{ + s,t; + } + \myAdigraph{} + \end{subfigure} +\end{figure} + +\subsection{A colored simple edge} +\begin{figure} + \begin{subfigure}{0.49\textwidth} + \begin{minted}{latex} +\NewAdigraph{myAdigraph}{ + s:0,0; + t:4,0; +}{ + s,t,red; +} +\myAdigraph{} +\end{minted} + \end{subfigure} + \begin{subfigure}{0.49\textwidth} + \NewAdigraph{myAdigraph}{ + s:0,0; + t:4,0; + }{ + s,t,red; + } + \myAdigraph{} + \end{subfigure} +\end{figure} + +\subsection{A weighted edge} +\begin{figure} + \begin{subfigure}{0.49\textwidth} + \begin{minted}{latex} +\NewAdigraph{myAdigraph}{ + s:0,0; + t:4,0; +}{ + s,t:56; +} +\myAdigraph{} +\end{minted} + \end{subfigure} + \begin{subfigure}{0.49\textwidth} + \NewAdigraph{myAdigraph}{ + s:0,0; + t:4,0; + }{ + s,t:56; + } + \myAdigraph{} + \end{subfigure} +\end{figure} + +\subsection{A weighted edge with label} +\begin{figure} + \begin{subfigure}{0.49\textwidth} + \begin{minted}{latex} +\NewAdigraph{myAdigraph}{ + s:0,0; + t:4,0; +}{ + s,t:56:myLabel; +} +\myAdigraph{} +\end{minted} + \end{subfigure} + \begin{subfigure}{0.49\textwidth} + \NewAdigraph{myAdigraph}{ + s:0,0; + t:4,0; + }{ + s,t:56:myLabel; + } + \myAdigraph{} + \end{subfigure} +\end{figure} + +\subsection{Edge in both directions} +\begin{figure} + \begin{subfigure}{0.49\textwidth} + \begin{minted}{latex} +\NewAdigraph{myAdigraph}{ + s:0,0; + t:4,0; +}{ + s,t; + t,s; +} +\myAdigraph{} +\end{minted} + \end{subfigure} + \begin{subfigure}{0.49\textwidth} + \NewAdigraph{myAdigraph}{ + s:0,0; + t:4,0; + }{ + s,t; + t,s; + } + \myAdigraph{} + \end{subfigure} +\end{figure} + +\subsection{Edge with weights in both directions} +\begin{figure} + \begin{subfigure}{0.49\textwidth} + \begin{minted}{latex} +\NewAdigraph{myAdigraph}{ + s:0,0; + t:4,0; +}{ + s,t:5; + t,s:5; +} +\myAdigraph{} +\end{minted} + \end{subfigure} + \begin{subfigure}{0.49\textwidth} + \NewAdigraph{myAdigraph}{ + s:0,0; + t:4,0; + }{ + s,t:5; + t,s:5; + } + \myAdigraph{} + \end{subfigure} +\end{figure} + +\subsection{Positioning labels} +\begin{figure} + \begin{subfigure}{0.49\textwidth} + \begin{minted}{latex} +\NewAdigraph{myAdigraph}{ + 1:0,0; + 2:0,2; + 3:4,2; + 4:4,0; +}{ + 1,3,red:1:a:near start; + 2,4,blue:1:b:near end; +} +\myAdigraph{} +\end{minted} + \end{subfigure} + \begin{subfigure}{0.49\textwidth} + \NewAdigraph{myAdigraph}{ + 1:0,0; + 2:0,2; + 3:4,2; + 4:4,0; + }{ + 1,3,red:1:a:near start; + 2,4,blue:1:b:near end; + } + \myAdigraph{} + \end{subfigure} +\end{figure} + +\subsection{Positioning weights} +\begin{figure} + \begin{subfigure}{0.49\textwidth} + \begin{minted}{latex} +\NewAdigraph{myAdigraph}{ + 1:0,0; + 2:0,2; + 3:4,2; + 4:4,0; +}{ + 1,3,red:1::near start; + 2,4,blue:1::near end; +} +\myAdigraph{} +\end{minted} + \end{subfigure} + \begin{subfigure}{0.49\textwidth} + \NewAdigraph{myAdigraph}{ + 1:0,0; + 2:0,2; + 3:4,2; + 4:4,0; + }{ + 1,3,red:1::near start; + 2,4,blue:1::near end; + } + \myAdigraph{} + \end{subfigure} +\end{figure} + + +\subsection{Multiple edges with weights} +\begin{figure} + \begin{subfigure}{0.49\textwidth} + \begin{minted}{latex} +\NewAdigraph{myAdigraph}{ + s:0,0; + t:4,0; + 1:0,3; + 2:4,3; +}{ + s,t:5; + t,s:5; + s,1:5; + 1,s:5; + 1,2:5; + 2,1:5; + 2,t:5; + t,2:5; + t,1:5; + 1,t:5; +} +\myAdigraph{} +\end{minted} + \end{subfigure} + \begin{subfigure}{0.49\textwidth} + \NewAdigraph{myAdigraph}{ + s:0,0; + t:4,0; + 1:0,3; + 2:4,3; + }{ + s,t:5; + t,s:5; + s,1:5; + 1,s:5; + 1,2:5; + 2,1:5; + 2,t:5; + t,2:5; + t,1:5; + 1,t:5; + } + \myAdigraph{} + \end{subfigure} +\end{figure} + +\section{Augmenting paths} +An augmenting path is specified by the following syntax: \textit{}. It is \textbf{very important} to note that incremental paths called upon the same object are memorized by default. + +\NewAdigraph{myAdigraph}{ + s:0,0; + 1:2,2; + 3:2,-2; + 2:6,2; + 4:6,-2; + t:8,0; +}{ + s,1:25; + s,3:25; + 3,4:25; + 1,2:35; + 2,t:20; + 4,t:30; + 3,1:10; + 4,2:10; + 2,3:15::near start; + 4,1:5::near start; +} + +\begin{figure} + \begin{subfigure}{0.49\textwidth} + \begin{minted}{latex} +\NewAdigraph{myAdigraph}{ + s:0,0; + 1:2,2; + 3:2,-2; + 2:6,2; + 4:6,-2; + t:8,0; +}{ + s,1:25; + s,3:25; + 3,4:25; + 1,2:35; + 2,t:20; + 4,t:30; + 3,1:10; + 4,2:10; + 2,3:15::near start; + 4,1:5::near start; +} +\myAdigraph{ + s,3,4,2,t:5; +} +\end{minted} + \end{subfigure} + \begin{subfigure}{0.49\textwidth} + \myAdigraph{ + s,3,4,2,t:5; + } + \end{subfigure} +\end{figure} + +For example, suppose now we'd like to send another 5 units on the graph edited by the previous incremental path, we'll have just to write the following: + +\begin{figure} + \begin{subfigure}{0.49\textwidth} + \begin{minted}{latex} +\myAdigraph{ + s,3,4,1,2,t:5; +} +\end{minted} + \end{subfigure} + \begin{subfigure}{0.49\textwidth} + \myAdigraph{ + s,3,4,1,2,t:5; + } + \end{subfigure} +\end{figure} + +\begin{figure} + \begin{subfigure}{0.49\textwidth} + \begin{minted}{latex} +\myAdigraph{ + s,3,4,t:15; +} +\end{minted} + \end{subfigure} + \begin{subfigure}{0.49\textwidth} + \myAdigraph{ + s,3,4,t:15; + } + \end{subfigure} +\end{figure} + +\begin{figure} + \begin{subfigure}{0.49\textwidth} + \begin{minted}{latex} +\myAdigraph{ + s,1,4,t:5; +} +\end{minted} + \end{subfigure} + \begin{subfigure}{0.49\textwidth} + \myAdigraph{ + s,1,4,t:5; + } + \end{subfigure} +\end{figure} + +\begin{figure} + \begin{subfigure}{0.49\textwidth} + \begin{minted}{latex} +\myAdigraph{ + s,1,2,t:10; +} +\end{minted} + \end{subfigure} + \begin{subfigure}{0.49\textwidth} + \myAdigraph{ + s,1,2,t:10; + } + \end{subfigure} +\end{figure} + +\begin{figure} + \begin{subfigure}{0.49\textwidth} + \begin{minted}{latex} +\myAdigraph{ + s,1,2,4,t:5; +} +\end{minted} + \end{subfigure} + \begin{subfigure}{0.49\textwidth} + \myAdigraph{ + s,1,2,4,t:5; + } + \end{subfigure} +\end{figure} + +\section{Cuts} + +The following is to add cuts to show minimum cuts for example, the syntax is: \textit{} + +\begin{figure} + \begin{subfigure}{0.49\textwidth} + \begin{minted}{latex} +\myAdigraph{}{ + 3,4; + 2,t; +} +\end{minted} + \end{subfigure} + \begin{subfigure}{0.49\textwidth} + \myAdigraph{}{ + 2,t; + 3,4; + } + \end{subfigure} +\end{figure} + +\subsection{Colored cuts} +If you'd like to color the cuts you just have to add the color as follows: \textit{} + +\begin{figure} + \begin{subfigure}{0.49\textwidth} + \begin{minted}{latex} +\myAdigraph{}{ + 3,4,red; + 2,t,blue; +} +\end{minted} + \end{subfigure} + \begin{subfigure}{0.49\textwidth} + \myAdigraph{}{ + 2,t,red; + 3,4,blue; + } + \end{subfigure} +\end{figure} + +\chapter{Warnings} +\section{Reserved words} +I reserve to use for the package the following tokens: + +\begin{multicols}{2} + \begin{enumerate} + \item Adigraph + \item AdigraphAugmentingPaths + \item AdigraphBuildEdge + \item AdigraphBuildEdgeWrapper + \item AdigraphBuildNode + \item AdigraphBuildPath + \item AdigraphCalculateOrientation + \item AdigraphCounter + \item AdigraphCountPaths + \item AdigraphCurrentPathNumber + \item AdigraphCutBuilder + \item AdigraphDrawEdge + \item AdigraphDrawNode + \item AdigraphEdgeBuilder + \item AdigraphEdgeDrawer + \item AdigraphEdgeList + \item AdigraphEdgeName + \item AdigraphElaboratePath + \item AdigraphElaboratePath + \item AdigraphExecuteCutBuilder + \item AdigraphFirstNode + \item AdigraphMemorizeEdge + \item AdigraphMemorizeNode + \item AdigraphNodeBuilder + \item AdigraphNodeList + \item AdigraphNodeName + \item AdigraphNumberOfPaths + \item AdigraphPathBuilder + \item AdigraphProcessAugmentingPaths + \item AdigraphProcessCuts + \item AdigraphProcessEdges + \item AdigraphProcessNodes + \item AdigraphProcessPaths + \item AdigraphRom + \item AdigraphSecondNode + \item AdigraphSimpleSum + \item AdigraphTwinEdgeWeight + \item NewAdigraph + \end{enumerate} +\end{multicols} + +\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/adigraph/img_examples/example_0.jpg b/Master/texmf-dist/doc/latex/adigraph/img_examples/example_0.jpg new file mode 100644 index 00000000000..9e530cad255 Binary files /dev/null and b/Master/texmf-dist/doc/latex/adigraph/img_examples/example_0.jpg differ diff --git a/Master/texmf-dist/doc/latex/adigraph/img_examples/example_1.jpg b/Master/texmf-dist/doc/latex/adigraph/img_examples/example_1.jpg index 651e4aba6f7..e1389419250 100644 Binary files a/Master/texmf-dist/doc/latex/adigraph/img_examples/example_1.jpg and b/Master/texmf-dist/doc/latex/adigraph/img_examples/example_1.jpg differ diff --git a/Master/texmf-dist/doc/latex/adigraph/img_examples/example_2.jpg b/Master/texmf-dist/doc/latex/adigraph/img_examples/example_2.jpg new file mode 100644 index 00000000000..d822f93b1d2 Binary files /dev/null and b/Master/texmf-dist/doc/latex/adigraph/img_examples/example_2.jpg differ diff --git a/Master/texmf-dist/doc/latex/adigraph/img_examples/example_3.jpg b/Master/texmf-dist/doc/latex/adigraph/img_examples/example_3.jpg new file mode 100644 index 00000000000..c2ba7c7374a Binary files /dev/null and b/Master/texmf-dist/doc/latex/adigraph/img_examples/example_3.jpg differ diff --git a/Master/texmf-dist/doc/latex/adigraph/img_examples/example_cut.jpg b/Master/texmf-dist/doc/latex/adigraph/img_examples/example_cut.jpg deleted file mode 100644 index 20f4c0d75b3..00000000000 Binary files a/Master/texmf-dist/doc/latex/adigraph/img_examples/example_cut.jpg and /dev/null differ diff --git a/Master/texmf-dist/doc/latex/adigraph/test.pdf b/Master/texmf-dist/doc/latex/adigraph/test.pdf new file mode 100644 index 00000000000..bd969940ca7 Binary files /dev/null and b/Master/texmf-dist/doc/latex/adigraph/test.pdf differ diff --git a/Master/texmf-dist/doc/latex/adigraph/test.tex b/Master/texmf-dist/doc/latex/adigraph/test.tex new file mode 100644 index 00000000000..ba12098a92a --- /dev/null +++ b/Master/texmf-dist/doc/latex/adigraph/test.tex @@ -0,0 +1,42 @@ +\documentclass{report} + +\usepackage{adigraph} + +\title{Adigraph, V1.2, small working test} +\author{Luca Cappelletti} +\date{March 2018} + +\begin{document} +\maketitle +\NewAdigraph{myAdigraph}{ + s:0,0; + 1:2,2; + 3:2,-2; + 2:6,2; + 4:6,-2; + t:8,0; +}{ + s,1:25; + s,3:25; + 3,4:25; + 1,2:35; + 2,t:20; + 4,t:30; + 3,1:10; + 4,2:10; + 2,3:15::near start; + 4,1:5::near start; +} + +\myAdigraph{} + + +\myAdigraph{ + s,3,4,2,t:5; +} + +\myAdigraph{}{ + 2,t,red; + 3,4,blue; +} +\end{document} \ No newline at end of file -- cgit v1.2.3