Example: Interaction nets

Published 2008-06-27 | Author: Marc de Falco

These examples are from the documentation of the tikz-inet package available on CTAN. The package helps you to draw interaction nets (a graphical programming paradigm close to functional programming and linear logic).

Author:Marc de Falco
Source:The tikz-inet documentation

Download as: [PDF] [TEX]  •  [Open in Overleaf]

Interaction nets

Do you have a question regarding this example, TikZ or LaTeX in general? Just ask in the LaTeX Forum.
Oder frag auf Deutsch auf TeXwelt.de. En français: TeXnique.fr.

% Interaction nets
% Author: Marc de Falco
\documentclass{minimal}
\usepackage[fancy,color=orange]{tikz-inet}
\begin{document}

\begin{tikzpicture}
\newcount\angle
    \foreach \x in {1,...,12} {
        \pgfmathsetcount{\angle}{360*\x/12+90}
        \inetcell[\inetcellstyle=green!\x0,
            at=(\the\angle-90:1.5cm)]
            (c\x){A}[\angle]
    }
\end{tikzpicture}

\begin{tikzpicture}
    \inetcell{A}
    \inetprombox{(A)}(pa)
    \inetcell[at=(bpa.east),right=5pt]{B}
    \inetwire(B.middle pax)(A.middle pax)
    \inetprombox{(bpa)(pa)(B)}(p)
    \inetwire(A.pal)(pa.middle pax)
    \inetwirefree(pa.pal)
    \inetwirefree(p.pal)
    \inetwire(B.pal)(p.middle pax)
\end{tikzpicture}

\begin{tikzpicture}
\matrix{
    \inetcell{A} &
    \inetcell[fancycellstyle=green]{B} \\
    \inetcell[bottom color=green]{C} &
    \inetcell[draw=black]{D} \\
    \inetcell[very thick]{E} &
    \inetnofancy \inetcell{F} \inetfancy \\
};
\end{tikzpicture}

\begin{tikzpicture}
\newcount\angle
    \newcount\order
    \order=10
    \newcount\arity
    \pgfmathsetcount{\arity}{\order-1}
    \foreach \x in {1,...,\order} {
        \foreach \y/\symbol in {0/!,1/?} {
            \pgfmathsetcount{\angle}
                {(180*(2*\x+\y))/\order+90}
            \inetcell[at=(\the\angle-90:\the\order*1.8ex),
                arity=\order-1](c\y\x){\symbol}[\angle]
            \inetwirefree(c\y\x.pal)
        }
    }

    \newcount\nextcell
    \newcount\nextport
    \newcount\depth
    \foreach \x in {1,...,\order} {
        \foreach \y in {1,...,\arity} {
            \pgfmathsetcount{\nextcell}
                {mod(\x+\y-1,\order)+1}
            \pgfmathsetcount{\nextport}
                {\arity-\y+1}
            \pgfmathsetcount{\depth}{(\x-1)*100/\order}
            \inetwire[\inetwirestyle=\inetcolor!\the\depth!black]%
                (c0\x.pax \y)(c1\the\nextcell.pax \the\nextport)
        }
    }
\end{tikzpicture}
\end{document}

Comments

  • #1 Rohin, March 3, 2009 at 6:38 a.m.

    Wow. This looks extremely good. Nice choice of contrasting shades

  • #2 johnbor56, May 9, 2012 at 9:17 a.m.

    Здравствуйте, приглашаю вас на мой сайт http://knigipoyoge.ru с бесплатными книгами. Если вы интерисуетесь йогой, и всем что с ней связано, вы найдете у нас полезную информацию.

Adding comments is currently not enabled.

Features
Tags
Scientific and technical areas

Cookbook

LaTeX Beginners Guide

Limited discount 50%
coupon code tDRet6Y

Creative Commons License