texlive[46659] Master: adigraph (17feb18)

commits+karl at tug.org commits+karl at tug.org
Sat Feb 17 23:35:27 CET 2018


Revision: 46659
          http://tug.org/svn/texlive?view=revision&revision=46659
Author:   karl
Date:     2018-02-17 23:35:27 +0100 (Sat, 17 Feb 2018)
Log Message:
-----------
adigraph (17feb18)

Modified Paths:
--------------
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/adigraph/
    trunk/Master/texmf-dist/doc/latex/adigraph/LICENSE
    trunk/Master/texmf-dist/doc/latex/adigraph/README.md
    trunk/Master/texmf-dist/doc/latex/adigraph/adigraph_library_example.pdf
    trunk/Master/texmf-dist/doc/latex/adigraph/adigraph_library_example.tex
    trunk/Master/texmf-dist/doc/latex/adigraph/img_examples/
    trunk/Master/texmf-dist/doc/latex/adigraph/img_examples/example_1.jpg
    trunk/Master/texmf-dist/doc/latex/adigraph/img_examples/example_cut.jpg
    trunk/Master/texmf-dist/tex/latex/adigraph/
    trunk/Master/texmf-dist/tex/latex/adigraph/adigraph.sty
    trunk/Master/tlpkg/tlpsrc/adigraph.tlpsrc

Added: trunk/Master/texmf-dist/doc/latex/adigraph/LICENSE
===================================================================
--- trunk/Master/texmf-dist/doc/latex/adigraph/LICENSE	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/adigraph/LICENSE	2018-02-17 22:35:27 UTC (rev 46659)
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 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, 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:
+
+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.

Added: trunk/Master/texmf-dist/doc/latex/adigraph/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/adigraph/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/adigraph/README.md	2018-02-17 22:35:27 UTC (rev 46659)
@@ -0,0 +1,145 @@
+# Smart Augmenting Graphs
+
+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, 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:
+
+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:
+
+```bash
+sudo tlmgr instal fp xparse xstring tikz
+```
+
+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:
+
+```latex
+\usepackage{adigraph}
+```
+
+Then, suppose you want to create a graph as the following:
+
+![alt text][graph]
+
+We start by defining a new graph:
+
+```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;
+    }
+```
+
+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:
+
+```latex
+\begin{figure}
+    \center
+    \myAdigraph{}
+    \caption{My Personal Graph}
+\end{figure}
+```
+
+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*:
+
+```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}
+```
+
+The working example in latex is found in the file *adigraph_library_example.tex*.
+
+The result with the cuts is the following:
+
+![alt text][cuts]
+
+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


Property changes on: trunk/Master/texmf-dist/doc/latex/adigraph/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/adigraph/adigraph_library_example.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/adigraph/adigraph_library_example.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/adigraph/adigraph_library_example.pdf	2018-02-17 08:41:35 UTC (rev 46658)
+++ trunk/Master/texmf-dist/doc/latex/adigraph/adigraph_library_example.pdf	2018-02-17 22:35:27 UTC (rev 46659)

Property changes on: trunk/Master/texmf-dist/doc/latex/adigraph/adigraph_library_example.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/adigraph/adigraph_library_example.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/adigraph/adigraph_library_example.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/adigraph/adigraph_library_example.tex	2018-02-17 22:35:27 UTC (rev 46659)
@@ -0,0 +1,99 @@
+\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


Property changes on: trunk/Master/texmf-dist/doc/latex/adigraph/adigraph_library_example.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/adigraph/img_examples/example_1.jpg
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/adigraph/img_examples/example_1.jpg
===================================================================
--- trunk/Master/texmf-dist/doc/latex/adigraph/img_examples/example_1.jpg	2018-02-17 08:41:35 UTC (rev 46658)
+++ trunk/Master/texmf-dist/doc/latex/adigraph/img_examples/example_1.jpg	2018-02-17 22:35:27 UTC (rev 46659)

Property changes on: trunk/Master/texmf-dist/doc/latex/adigraph/img_examples/example_1.jpg
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/adigraph/img_examples/example_cut.jpg
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/adigraph/img_examples/example_cut.jpg
===================================================================
--- trunk/Master/texmf-dist/doc/latex/adigraph/img_examples/example_cut.jpg	2018-02-17 08:41:35 UTC (rev 46658)
+++ trunk/Master/texmf-dist/doc/latex/adigraph/img_examples/example_cut.jpg	2018-02-17 22:35:27 UTC (rev 46659)

Property changes on: trunk/Master/texmf-dist/doc/latex/adigraph/img_examples/example_cut.jpg
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/adigraph/adigraph.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/adigraph/adigraph.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/adigraph/adigraph.sty	2018-02-17 22:35:27 UTC (rev 46659)
@@ -0,0 +1,359 @@
+%
+% 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, 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:
+%
+% 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.
+%
+\NeedsTeXFormat{LaTeX2e}[1994/06/01]
+\ProvidesPackage{adigraph}
+  [2018/02/16 v1.0 LaTeX package for creating augmenting directed graphs]
+
+\RequirePackage{fp}
+\RequirePackage{xparse}
+\RequirePackage{xstring}
+\RequirePackage{tikz}
+\usetikzlibrary{calc}
+
+\def\zero{0}
+
+\makeatletter
+\newcommand*{\rom}[1]{\expandafter\@slowromancap\romannumeral #1@}
+
+\NewDocumentCommand{\storeCoordinate}{m m m}{
+  \@namedef{adigraphNode#1#2}{#3}%
+}
+\NewDocumentCommand{\storeParsedEdge}{m m}{
+  \@namedef{parsed#1#2}{1}%
+}
+\makeatother
+\newcommand{\markEdgeAsParsed}[2]{%
+  %
+  % #1 -> First node of edge
+  % #2 -> Second node of edge
+  %
+  \IfInteger{#1}{%
+    \def\nodeA{\rom{#1}}%
+  }{%
+    \def\nodeA{#1}%
+  }%
+  \IfInteger{#2}{%
+    \def\nodeB{\rom{#2}}%
+  }{%
+    \def\nodeB{#2}%
+  }%
+  \storeParsedEdge{\nodeA}{\nodeB}
+}
+
+\newcommand{\edgeWasParsed}[3]{%
+  %
+  % #1 -> Variable to store boolean result
+  % #2 -> First node of edge
+  % #3 -> Second node of edge
+  %
+  \IfInteger{#2}{%
+    \def\nodeA{\rom{#2}}%
+  }{%
+    \def\nodeA{#2}%
+  }%
+  \IfInteger{#3}{%
+    \def\nodeB{\rom{#3}}%
+  }{%
+    \def\nodeB{#3}%
+  }%
+  \ifcsname parsed\nodeA\nodeB\endcsname
+    \FPset{#1}{1}
+  \else%
+    \FPset{#1}{0}
+  \fi%
+}
+
+\newcommand{\saveNodeCoordinate}[3]{
+  %
+  % #1 -> Node name
+  % #2 -> Coordinate, either X or Y
+  % #3 -> Numeric value
+  %
+  \IfInteger{#1}{%
+    \def\nodeName{\rom{#1}}%
+  }{%
+    \def\nodeName{#1}%
+  }%
+  \storeCoordinate{#2}{\nodeName}{#3}
+}
+
+\newcommand{\retrieveNodeCoordinate}[3]{
+  %
+  % #1 -> Variable to store coordinate into
+  % #2 -> Node name
+  % #3 -> Coordinate, either X or Y
+  %
+  \IfInteger{#2}{%
+    \def\nodeName{\rom{#2}}%
+  }{%
+    \def\nodeName{#2}%
+  }%
+
+  \FPset{#1}{\csname adigraphNode#3\nodeName\endcsname}
+}
+
+\newcommand{\saveNodeCoordinates}[3]{
+  %
+  % #1 -> Node name
+  % #2 -> X value
+  % #3 -> Y value
+  %
+  \saveNodeCoordinate{#1}{X}{#2}%
+  \saveNodeCoordinate{#1}{Y}{#3}%
+}
+
+\newcommand{\swp}[3]{
+  %
+  % #1 -> variable to assign
+  % #2 -> First node name
+  % #3 -> Second node name
+  %
+  \retrieveNodeCoordinate{\firstX}{#2}{X}
+  \retrieveNodeCoordinate{\firstY}{#2}{Y}
+  \retrieveNodeCoordinate{\secondX}{#3}{X}
+  \retrieveNodeCoordinate{\secondY}{#3}{Y}
+  %
+  \FPsub{\xSub}{\secondX}{\firstX}
+  \FPsub{\ySub}{\secondY}{\firstY}
+  \FPset{#1}{1}
+  \FPifgt{\xSub}{0}
+    \FPset{#1}{3}
+  \else%
+    \FPset{#1}{4}
+  \fi%
+  %
+  \FPifeq{\xSub}{0}
+    \FPset{\xiszero}{1}
+  \else%
+    \FPset{\xiszero}{0}
+  \fi%
+  %
+  \FPifgt{\ySub}{0}
+    \FPset{\yispos}{1}
+  \else%
+    \FPset{\yispos}{4}
+  \fi%
+  %
+  \FPadd{\xzeroypos}{\xiszero}{\yispos}
+  %
+  \FPifeq{\xzeroypos}{2}
+    \FPset{#1}{1}
+  \fi%
+  \FPifeq{\xzeroypos}{5}
+    \FPset{#1}{2}
+  \fi%
+}
+
+\newcommand{\executeNodeBuilder}[5]{
+  %
+  % #1 is node name
+  % #2 is x coordinate
+  % #3 is y coordinate
+  % #4 is label, that defaults to #1 when absent
+  % #5 is color, that defaults to black when absent
+  %
+  \IfValueT{#2}{
+    \IfValueTF{#4}{
+      \def\nodeLabel{#4}
+    }{
+      \def\nodeLabel{#1}
+    }
+    \IfValueTF{#5}{
+      \def\nodeColor{#5}
+    }{
+      \def\nodeColor{black}
+    }
+    \saveNodeCoordinates{#1}{#2}{#3}
+    \node[vertex,\nodeColor] (#1) at (#2,#3) {$\nodeLabel$};
+  }
+}
+
+\NewDocumentCommand{\nodeBuilder}{ > { \SplitArgument { 4 } { , } } m }{
+  \executeNodeBuilder #1
+}
+
+\newcommand{\executeEdgeBuilder}[7]{
+  %
+  % #1 is first node
+  % #2 is second node
+  % #3 is weight of first edge, which defaults to 0
+  % #4 is weight of second edge, which defaults to 0
+  % #5 Should we color edge? Or first optional color
+  % #6 Second optional color
+  % #7 Label position on axis
+  %
+  \edgeWasParsed{\isParsed}{#1}{#2}
+  \FPifeq{\isParsed}{0}
+    \markEdgeAsParsed{#1}{#2}
+    \markEdgeAsParsed{#2}{#1}
+  \fi%
+  \IfValueT{#2}{
+    \def\firstNode{#1}
+    \def\secondNode{#2}
+    \IfValueTF{#3}{
+      \def\firstEdgeWeight{#3}
+    }{
+      \def\firstEdgeWeight{0}
+    }
+    \IfValueTF{#4}{
+      \def\secondEdgeWeight{#4}
+    }{
+      \def\secondEdgeWeight{0}
+    }
+    \IfValueTF{#7}{
+      \def\labelPosition{#7}
+    }{
+      \def\labelPosition{midway}
+    }
+    \IfValueTF{#6}{
+      \IfValueTF{#5}{
+        \def\firstEdgeColor{#5}
+        \def\secondEdgeColor{#6}
+      }{
+        \def\firstEdgeColor{black}
+        \def\secondEdgeColor{black}
+      }
+    }{
+      \IfValueTF{#5}{
+        \def\firstEdgeColor{red}
+        \def\secondEdgeColor{blue}
+      }{
+        \def\firstEdgeColor{black}
+        \def\secondEdgeColor{black}
+      }
+    }
+
+    \FPadd{\weightSum}{\firstEdgeWeight}{\secondEdgeWeight}
+    \FPmul{\weightMul}{\firstEdgeWeight}{\secondEdgeWeight}
+    \FPadd{\firstZero}{\weightMul}{\firstEdgeWeight}
+    \FPadd{\secondZero}{\weightMul}{\secondEdgeWeight}
+
+    \swp{\firstWeightPositionFlag}{#1}{#2}
+    \swp{\secondWeightPositionFlag}{#2}{#1}
+
+    \FPifeq{\firstWeightPositionFlag}{1}
+      \def\firstWeightPosition{left}
+    \fi
+    \FPifeq{\firstWeightPositionFlag}{2}
+      \def\firstWeightPosition{right}
+    \fi
+    \FPifeq{\firstWeightPositionFlag}{3}
+      \def\firstWeightPosition{above}
+    \fi
+    \FPifeq{\firstWeightPositionFlag}{4}
+      \def\firstWeightPosition{below}
+    \fi
+
+    \FPifeq{\secondWeightPositionFlag}{1}
+      \def\secondWeightPosition{left}
+    \fi
+    \FPifeq{\secondWeightPositionFlag}{2}
+      \def\secondWeightPosition{right}
+    \fi
+    \FPifeq{\secondWeightPositionFlag}{3}
+      \def\secondWeightPosition{above}
+    \fi
+    \FPifeq{\secondWeightPositionFlag}{4}
+      \def\secondWeightPosition{below}
+    \fi
+    \FPifeq{\isParsed}{1}
+    \else
+    \FPifeq{\weightSum}{0}
+      % No edge has weights, so we draw both with no labels.
+      \draw[edge,\firstEdgeColor] (\firstNode) to [bend right=20] (\secondNode);
+      \draw[edge,\secondEdgeColor] (\secondNode) to [bend right=20] (\firstNode);
+    \else
+    \FPifeq{\weightSum}{0}
+      \draw[edge,\firstEdgeColor] (\firstNode) to node[\labelPosition, \secondWeightPosition] {$\firstEdgeWeight$}(\secondNode);
+    \else
+    \FPifeq{\firstZero}{0}
+      \draw[edge,\secondEdgeColor] (\secondNode) to node[\labelPosition, \firstWeightPosition] {$\secondEdgeWeight$}(\firstNode);
+    \FPifeq{\weightMul}{0}
+    \else
+      \draw[edge,\firstEdgeColor] (\firstNode) to [bend right=20] node[\labelPosition, \firstWeightPosition] {$\firstEdgeWeight$}(\secondNode);
+      \draw[edge,\secondEdgeColor] (\secondNode) to [bend right=20] node[\labelPosition, \secondWeightPosition] {$\secondEdgeWeight$}(\firstNode);
+    \fi
+  }
+}
+
+\NewDocumentCommand{\edgeBuilder}{> { \SplitArgument { 6 } { , } } m}{
+  \executeEdgeBuilder #1
+}
+
+\NewDocumentCommand{\calculateOrientation}{m m m}{
+  \retrieveNodeCoordinate{\firstX}{#2}{X}
+  \retrieveNodeCoordinate{\firstY}{#2}{Y}
+  \retrieveNodeCoordinate{\secondX}{#3}{X}
+  \retrieveNodeCoordinate{\secondY}{#3}{Y}
+  \FPsub{\deltaY}{\secondY}{\firstY}
+  \FPsub{\deltaX}{\secondX}{\firstX}
+  \FPifeq{\deltaX}{0}
+    \Fpset{#1}{90}
+  \else
+    \FPdiv{\deltaDiv}{\deltaY}{\deltaX}
+    \FParctan{\arcResult}{\deltaDiv}
+    \FPmul{#1}{\arcResult}{57.2958}
+  \fi
+}
+
+\NewDocumentCommand{\executeCutBuilder}{m m}{
+  \IfValueT{#2}{
+    \calculateOrientation{\orientation}{#1}{#2}
+    \draw[dashed,red,rotate=\orientation] ([yshift=10pt]$(#1)!0.7!(#2)$) -- ([yshift=-10pt]$(#1)!0.7!(#2)$);
+    % %\node[vertex] (d) at (-3,-3) {$ARIAN$};
+  }
+}
+
+\NewDocumentCommand{\cutBuilder}{> { \SplitArgument { 1 } { , } } m}{
+  \executeCutBuilder #1
+}
+
+\NewDocumentCommand{\smartGraph}{> { \SplitList { ; } } m > { \SplitList { ; } } m > { \SplitList { ; } } m > { \SplitList { ; } } m}{
+  %
+  % #1 -> Vertices
+  % #2 -> Edges
+  % #3 -> Modified edges
+  % #4 -> Cuts
+  %
+  \begin{tikzpicture}
+    \tikzset{
+      vertex/.style={circle,draw,minimum size=2em},
+      edge/.style={->,> = latex}
+    }
+
+    % vertices
+    \ProcessList {#1} {\nodeBuilder}
+
+    %edges
+    \ProcessList {#3} {\edgeBuilder}
+    \ProcessList {#2} {\edgeBuilder}
+
+    %cuts
+    \ProcessList {#4} {\cutBuilder}
+  \end{tikzpicture}
+}
+
+\NewDocumentCommand{\NewAdigraph}{m m m}{
+  %
+  % #1 -> Variable to assign to as command
+  % #2 -> Nodes
+  % #3 -> Edges
+  %
+  \expandafter\newcommand\csname #1\endcsname[2][]{
+    %
+    % ##1 -> Modified edges
+    %
+    \smartGraph{#2}{#3}{##2}{##1}
+  }%
+}
+
+\endinput
+%%
+%% End of file `adigraph.sty'.
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/tex/latex/adigraph/adigraph.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2018-02-17 08:41:35 UTC (rev 46658)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2018-02-17 22:35:27 UTC (rev 46659)
@@ -27,7 +27,7 @@
     academicons accanthis accfonts achemso
     acmart acmconf acro acronym acroterm
     active-conf actuarialangle actuarialsymbol
-    addfont addlines adfathesis adforn adhocfilelist
+    addfont addlines adfathesis adforn adhocfilelist adigraph
     adjmulticol adfsymbols adjustbox adobemapping
     adrconv adtrees advdate
     ae aecc aeguill afparticle afthesis

Added: trunk/Master/tlpkg/tlpsrc/adigraph.tlpsrc
===================================================================
Modified: trunk/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc	2018-02-17 08:41:35 UTC (rev 46658)
+++ trunk/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc	2018-02-17 22:35:27 UTC (rev 46659)
@@ -4,6 +4,7 @@
 #
 depend collection-basic
 #
+depend adigraph
 depend aobs-tikz
 depend askmaps
 depend asyfig



More information about the tex-live-commits mailing list