%!TEX root = /Users/ego/Boulot/TKZ/tkz-berge/doc-us/TKZdoc-berge-main.tex %<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––> \section{Macros and Edges in a graph} %<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––> \subsection{Edge in a graph from one vertex \tkzcname{EdgeInGraphFromOneToComp}} \begin{NewMacroBox}{EdgeInGraphFromOneToComp}{\oarg{local options}\var{prefix}\var{order}\var{from}} \begin{tabular}{llc} \hline Arguments & & Definition \\ \midrule \TAline{order} {}{order of the graph} \bottomrule \end{tabular} \medskip \begin{tabular}{llc} \midrule options & default & definition \\ \midrule \TOline{RA} {4} { radius circle} \TOline{prefix} {a} {prefix for vertices } \TOline{Math} {false} {math mode } \bottomrule \end{tabular} \medskip \emph{This macro works on an unique graph. |from| is integer. |EdgeInGraph| designs a macro that works only in a graph defined by a prefix. The result is some edges between the vertex |from| and the others vertices. } \end{NewMacroBox} \subsubsection{Empty Cycle} \begin{center} \begin{tkzexample}[very small] \begin{tikzpicture} \GraphInit[vstyle=Shade] \grEmptyCycle[RA=4,prefix=a]{8}% \EdgeInGraphFromOneToComp{a}{8}{3} \end{tikzpicture} \end{tkzexample} \end{center} \vfill \newpage \subsection{Edges in a graph - a loop \tkzcname{EdgeInGraphLoop}}% \begin{NewMacroBox}{EdgeInGraphLoop}{\var{prefix}\var{order}} \emph{This macro is useful with vertices on a circle . |order| in an integer.} \end{NewMacroBox} \subsubsection{Empty Cycle} \begin{center} \begin{tkzexample}[very small] \begin{tikzpicture} \GraphInit[vstyle=Shade] \grEmptyCycle[RA=2,prefix=a]{8}% \EdgeInGraphLoop{a}{8} \end{tikzpicture}\end{tkzexample} \end{center} \subsubsection{Empty Cycle} \begin{center} \begin{tkzexample}[very small] \begin{tikzpicture}[node distance=4cm] \GraphInit[vstyle=Shade] \Vertices{square}{a0,a1,a2,a3} \EdgeInGraphLoop{a}{4} \end{tikzpicture} \end{tkzexample} \end{center} \newpage \subsection{Edges in a graph - a loop \tkzcname{EdgeInGraphLoop*}} \begin{NewMacroBox}{EdgeInGraphLoop*}{\var{prefix}\var{order}} \medskip \emph{Not exactly a loop, there is no edge between the first and the last vertex.} \end{NewMacroBox} \subsubsection{Empty Cycle} \begin{center} \begin{tkzexample}[very small] \begin{tikzpicture} \GraphInit[vstyle=Art] \grEmptyCycle[RA=4,prefix=a]{8}% \EdgeInGraphLoop*{a}{8} \end{tikzpicture} \end{tkzexample} \end{center} \subsubsection{Empty Path} \begin{center} \begin{tkzexample}[very small] \begin{tikzpicture} \grEmptyPath[prefix=h,RA=2,RS=2]{6} \EdgeInGraphLoop*{h}{6} \end{tikzpicture} \end{tkzexample} \end{center} \vfill \newpage \subsection{Sequence of edges in a graph \tkzcname{EdgeInGraphSeq}} \begin{NewMacroBox}{EdgeInGraphSeq}{\var{prefix}\var{start}\var{end}} \medskip \emph{This macro gives a sequence of edges between |start| and |end|.\\ |start| and |end| are two integers. } \end{NewMacroBox} \subsubsection{EdgeInGraphSeq} \begin{center} \begin{tkzexample}[very small] \begin{tikzpicture} \GraphInit[vstyle=Shade] \grEmptyCycle[RA=2,prefix=a]{8}% \EdgeInGraphSeq{a}{2}{5} \end{tikzpicture} \end{tkzexample} \end{center} \newpage \subsection{Edges in a graph \tkzcname{EdgeInGraphMod}} \begin{NewMacroBox}{EdgeInGraphMod}{\var{prefix}\var{order}\var{add}} \medskip \emph{This macro works on an unique graph. Edges between $v_i$ and $v_j$ with $i$ in $0,...,(\text{\#2}-1)$ and $j=\text{Mod(i+\#3,\#2)}$.\\ \#2 = |order| and \#3 = |add|.\\ |Mod| is like |mod| but the result is a positive integer. } \end{NewMacroBox} \subsubsection{EdgeInGraphMod} \begin{center} \begin{tkzexample}[very small] \begin{tikzpicture} \GraphInit[vstyle=Shade] \grEmptyCycle[RA=2,prefix=a]{8}% \EdgeInGraphMod{a}{8}{2} \end{tikzpicture} \end{tkzexample} \end{center} \subsubsection{EdgeInGraphMod 2} \begin{center} \begin{tkzexample}[very small] \begin{tikzpicture} \GraphInit[vstyle=Shade] \grEmptyCycle[RA=3,prefix=a]{13}% \EdgeInGraphMod{a}{13}{3} \end{tikzpicture} \end{tkzexample} \end{center} \newpage \subsection{Edges in a graph \tkzcname{EdgeInGraphMod*}} \begin{NewMacroBox}{EdgeInGraphMod*}{\var{prefix}\var{order}\var{add}\var{start}\var{step}} \medskip \emph{Edges between $v_i$ and $v_j$ with $i$ in $\#4,\#4+\#5,...,(\text{\#2}-1)$ and $j=\text{Mod(i+\#3,\#2)}$}\\ \#2 = |order|, \#3 = |add|, \#4 = |start|, \#5 = |step|.\\ \end{NewMacroBox} \subsubsection{EdgeInGraphMod*} \begin{center} \begin{tkzexample}[very small] \begin{tikzpicture} \GraphInit[vstyle=Shade] \grEmptyCycle[prefix=a]{17}% \EdgeInGraphMod*{a}{17}{5}{1}{2} \end{tikzpicture} \end{tkzexample} \end{center} \newpage \subsection{Edges in a graph \tkzcname{EdgeInGraphModLoop}} \begin{NewMacroBox}{EdgeInGraphModLoop}{\var{prefix}\var{order}\var{add}\var{start}} \medskip \emph{ |order|, |add| and |start| are integers.\\ Edges between $v_i$ and $v_j$ with $i$ from $\#4$, $j=\text{Mod(i+\#3,\#2)}$ and then $i=j$ until $j=\#4$\\ \#2 = |order|, \#3 = |add| and \#4 = |start|.} \end{NewMacroBox} \subsubsection{EdgeInGraphModLoop} \begin{center} \begin{tkzexample}[very small] \begin{tikzpicture} \GraphInit[vstyle=Shade] \grEmptyCycle[RA=4]{7} \EdgeInGraphModLoop{a}{7}{2}{1} \end{tikzpicture} \end{tkzexample} \end{center} \subsubsection{EdgeInGraphModLoop} \begin{center} \begin{tkzexample}[very small] \begin{tikzpicture} \GraphInit[vstyle=Shade] \grEmptyCycle[RA=4]{8} \EdgeInGraphModLoop{a}{8}{2}{1} \end{tikzpicture} \end{tkzexample} \end{center} \newpage \subsection{Edges between two graphs with the same order \tkzcname{EdgeIdentity}} \begin{NewMacroBox}{EdgeIdentity}{\var{prefix1}\var{prefix2}\var{order}} \medskip \emph{|order| is an integer. This macro gives edges between two graphs.\\ Edges between $v_i$ and $v_j$ with $i=j$ in $0,...,(\text{\#3}-1)$.\\ \#3 = |order|.\\} \end{NewMacroBox} \subsubsection{EdgeIdentity} \begin{center} \begin{tkzexample}[very small] \begin{tikzpicture} \GraphInit[vstyle=Shade] \grEmptyCycle[prefix=v,RA=3]{5} \grEmptyCycle[prefix=w,RA=1]{5} \EdgeIdentity{v}{w}{5} \end{tikzpicture} \end{tkzexample} \end{center} \vfill \newpage \subsection{Edges between two graphs with the same order \tkzcname{EdgeIdentity*}} \begin{NewMacroBox}{EdgeIdentity*}{\var{prefix1}\var{prefix2}\var{list}} \medskip \emph{|list| is a list of integers. This macro gives edges between two graphs.\\ Edges between $v_i$ and $v_j$ with $i=j$ in |list|.\\} \end{NewMacroBox} \subsubsection{EdgeIdentity*} \begin{center} \begin{tkzexample}[very small] \begin{tikzpicture} \GraphInit[vstyle=Shade] \begin{scope}[rotate=30] \grEmptyCycle[RA=3,prefix=a]{5}% \end{scope} \grEmptyCycle[RA=5,prefix=b]{5}% \EdgeIdentity*{a}{b}{0,...,4} \end{tikzpicture} \end{tkzexample} \end{center} \subsubsection{EdgeIdentity*} \begin{center} \begin{tkzexample}[very small] \begin{tikzpicture} \GraphInit[vstyle=Shade] \begin{scope}[rotate=30] \grEmptyCycle[RA=3,prefix=a]{5}% \end{scope} \grEmptyCycle[RA=5,prefix=b]{5}% \EdgeIdentity*{a}{b}{0,2,4} \end{tikzpicture} \end{tkzexample} \end{center} \newpage \subsection{Edges between two graphs \tkzcname{EdgeFromOneToAll}} \begin{NewMacroBox}{EdgeFromOneToAll}{\var{prefix1}\var{prefix2}\var{from}\var{order}} \medskip \emph{The graphs must to have the same order. |from| and |order| are integers.} \end{NewMacroBox} \subsubsection{EdgeFromOneToAll} \begin{center} \begin{tkzexample}[very small] \begin{tikzpicture} \GraphInit[vstyle=Shade] \grPath[form=1,RA=2,RS=0]{5} \grPath[form=1,prefix=b,RA=2,RS=4]{5} \EdgeFromOneToAll{a}{b}{1}{5} \end{tikzpicture}\end{tkzexample} \end{center} \newpage \subsection{Edges between two graphs \tkzcname{EdgeFromOneToSeq}} \begin{NewMacroBox}{EdgeFromOneToSeq}{\var{prefix1}\var{prefix2}\var{from}\var{start}\var{end}} \medskip \emph{|from|, |start| and |end| are integers. This macro builds edges between the vertex with an indice |from| through the vertices with an indice in the sequence |start|,...,|end|.} \end{NewMacroBox} \subsubsection{EdgeFromOneToSeq} \begin{center} \begin{tkzexample}[very small] \begin{tikzpicture} \GraphInit[vstyle=Shade] \grPath[form=1,RA=2,RS=0]{5} \grPath[form=1,prefix=b,RA=2,RS=4]{5} \EdgeFromOneToSeq{a}{b}{1}{2}{4} \end{tikzpicture} \end{tkzexample} \end{center} \newpage \subsection{Edges between two graphs \tkzcname{EdgeFromOneToSel}} \begin{NewMacroBox}{EdgeFromOneToSel}{\var{prefix1}\var{prefix2}\var{from}\var{list}} \medskip \emph{This macro builds edges between the vertex with an indice |from| through the vertices with an indice in the list |list|.} \end{NewMacroBox} \subsubsection{EdgeFromOneToSel} \begin{center} \begin{tkzexample}[very small] \begin{tikzpicture} \GraphInit[vstyle=Shade] \grPath[form=1,RA=2]{5} \grPath[form=1,prefix=b,RA=2,RS=4]{5} \EdgeFromOneToSel{a}{b}{1}{0,2,4} \end{tikzpicture} \end{tkzexample} \end{center} \newpage \subsection{Edges between two graphs \tkzcname{EdgeFromOneToComp}} \begin{NewMacroBox}{EdgeFromOneToComp}{\var{prefix1}\var{prefix2}\var{from}\var{order2}} \medskip \emph{This macro builds edges between the vertex with an indice |from| through all the vertices of the second graph, except the vertex with an indice |from|.} \end{NewMacroBox} \subsubsection{EdgeFromOneToComp} \begin{center} \begin{tkzexample}[vbox] \begin{tikzpicture} \GraphInit[vstyle=Shade] \grPath[form=1,RA=2,RS=0]{5} \grPath[form=1,prefix=b,RA=2,RS=4]{5} \EdgeFromOneToComp{a}{b}{2}{3} \end{tikzpicture} \end{tkzexample} \end{center} \newpage \subsection{Edges between two graphs \tkzcname{EdgeMod}}% \begin{NewMacroBox}{EdgeMod}{\var{prefix1}\var{prefix2}\var{order}\var{step}} \medskip \emph{This macro works on two graphs with the same order. We get edges between $v_i$ and $v_j$ with $i$ in $0,...,(\text{\#2}-1)$ and $j=\text{Mod(i+\#4,\#3)}$.\\ \#3 = |order| and \#4 = |step|.} \end{NewMacroBox} \subsubsection{EdgeMod} \begin{center} \begin{tkzexample}[vbox] \begin{tikzpicture} \GraphInit[vstyle=Shade] \grEmptyCycle[prefix=a,RA=6]{9} \grEmptyCycle[prefix=b,RA=3]{9} \EdgeMod{a}{b}{9}{1} \end{tikzpicture} \end{tkzexample} \end{center} \newpage \subsection{Edges between two graphs \tkzcname{EdgeMod*}}% \begin{NewMacroBox}{EdgeMod*}{\var{prefix1}\var{prefix2}\var{order}\var{step1}\var{step2}} \medskip \emph{This macro works on two graphs with the same order. We get edges between $v_i$ and $v_j$ with $i$ in $0,...,(\text{\#3}-1)$ with a step $\text{\#5}$ and $j=\text{Mod(i+\#4,\#3)}$.\\ \#3 = |order| , \#4 = |step1| and \#5 = |step2|.} \end{NewMacroBox} \subsubsection{\tkzcname{EdgeMod*} }%with |step1|=1 and |step2|=2 \begin{center} \begin{tkzexample}[vbox] \begin{tikzpicture} \GraphInit[vstyle=Shade] \grEmptyCycle[prefix=a,RA=6]{8} \grEmptyCycle[prefix=b,RA=4]{8} \EdgeMod*{a}{b}{8}{1}{2} \end{tikzpicture} \end{tkzexample} \end{center} \subsubsection{EdgeMod* }%with |step1|=2 and |step2|=1 \begin{center} \begin{tkzexample}[vbox] \begin{tikzpicture} \GraphInit[vstyle=Shade] \grEmptyCycle[prefix=a,RA=6]{8} \grEmptyCycle[prefix=b,RA=2]{8} \EdgeMod*{a}{b}{8}{1}{1} \end{tikzpicture} \end{tkzexample} \end{center} \newpage \subsection{Edges between two graphs \tkzcname{EdgeDoubleMod}}% \begin{NewMacroBox}{EdgeDoubleMod}{\var{prefix1}\var{nb}\var{nb}\var{nb}\var{prefix2}\var{nb}\var{nb}\var{nb}\var{end}} For the first node, the numbers are : \var{order1}\var{start1}\var{add1} \medskip For the second node, the numbers are : \var{order2}\var{start2}\var{add2}\var{end} \medskip \emph{Edges between $v_i$ and $v_j$ with $i=\text{Mod(\#3+(\#4*k),\#2)}$ and j=$\text{Mod(\#7+(\#8*k),\#6)}$ $k$ is an integer from $0$ to |end|.\\ \#2 = |order1|, \#3 = |start1| and \#4 = |add1|.\\ \#6 = |order2|, \#7 = |start2| and \#8 = |add2|.} \end{NewMacroBox} \subsubsection{EdgeDoubleMod} \begin{center} \begin{tkzexample}[vbox] \begin{tikzpicture} \GraphInit[vstyle=Shade] \begin{scope}[rotate=-90] \grEmptyCycle[RA=2,prefix=a]{5}{2} \end{scope} \begin{scope}[rotate=-18] \grEmptyCycle[RA=4,prefix=b]{5}{2} \end{scope} \EdgeDoubleMod{b}{5}{0}{1}% {a}{5}{2}{1}{5} \end{tikzpicture} \end{tkzexample} \end{center} \subsubsection{EdgeDoubleMod with two graphs and different orders} \begin{center} \begin{tkzexample}[vbox] \begin{tikzpicture} \GraphInit[vstyle=Shade] \grEmptyCycle[prefix=a,RA=5]{10} \grEmptyCycle[prefix=b,RA=7]{20} \EdgeDoubleMod{a}{10}{0}{1}% {b}{20}{0}{2}{10} \end{tikzpicture} \end{tkzexample} \end{center} \endinput