diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/graphs/tikzlibrarygraphs.standard.code.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/graphs/tikzlibrarygraphs.standard.code.tex | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/graphs/tikzlibrarygraphs.standard.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/graphs/tikzlibrarygraphs.standard.code.tex new file mode 100644 index 00000000000..a56702bcf96 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/graphs/tikzlibrarygraphs.standard.code.tex @@ -0,0 +1,112 @@ +% Copyright 2010 by Till Tantau +% Copyright 2011 by Jannis Pohlmann +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/graphs/tikzlibrarygraphs.standard.code.tex,v 1.9 2012/02/27 20:00:11 tantau Exp $ + + +% +% Basic graphs +% + + +\tikzgraphsset{ + % + % An independent set $V$ of nodes. + % + declare={subgraph I_n}% + { + \foreach \tikz@lib@graph@node@num in \tikzgraphV + { \tikz@lib@graph@node@num } + }, + % + % An two-shore independent set $V$ with shores V and W. + % + declare={subgraph I_nm}% + { + subgraph I_n [name shore V] -- [no edges] + subgraph I_n [name shore W, V/.expand once=\tikzgraphW] + }, + % + % The complete clique on $V$. + % + declare={subgraph K_n}% + { + [clique] + subgraph I_n + }, + % + % A complete bipartite graph with shores V and W. + % + declare={subgraph K_nm}% + { + [color class=shore V, + color class=shore W, + complete bipartite={shore V}{shore W}] + subgraph I_n [name shore V, shore V] -- [no edges] + subgraph I_n [name shore W, V/.expand once=\tikzgraphW, shore W] + }, + % + % A cycle with n nodes. + % + declare={subgraph C_n}% + { + [cycle] + subgraph I_n + }, + % + % A path with n nodes. + % + declare={subgraph P_n}% + { + [path] + subgraph I_n + }, + % + % A grid with n nodes. + % + declare={subgraph Grid_n}% + { + [grid] + subgraph I_n + }, + % + % A random graph according to the G_{n,p} model: For each pair of + % vertices there is an edge between them with probability p. + % + p/.initial=0.5, + declare={subgraph G_np}% + { + [/utils/exec={ + \pgfmathsetmacro\tikz@lib@lg@p{\pgfkeysvalueof{/tikz/graphs/p}} + \let\tikz@lib@gnp@edges\pgfutil@empty% + \foreach \tikz@lib@graph@node@a [count=\tikz@lib@g@count@a] in \tikzgraphV + \foreach \tikz@lib@graph@node@b [count=\tikz@lib@g@count@b] in \tikzgraphV + { + \ifnum\tikz@lib@g@count@a<\tikz@lib@g@count@b\relax + \pgfmathparse{rnd} + \ifdim\pgfmathresult pt<\tikz@lib@lg@p pt% + \ifx\tikz@lib@gnp@edges\pgfutil@empty + \xdef\tikz@lib@gnp@edges{\tikz@lib@graph@node@a--\tikz@lib@graph@node@b}% + \else + \xdef\tikz@lib@gnp@edges{\tikz@lib@gnp@edges,\tikz@lib@graph@node@a--\tikz@lib@graph@node@b}% + \fi + \fi + \fi + } + }] + \foreach \tikz@lg@temp in \tikz@lib@gnp@edges { + [parse/.expand once=\tikz@lg@temp] + } + }, +} + + + + |