add.tex 2.64 KB
Newer Older
rusty1s's avatar
rusty1s committed
1
2
\documentclass[class=minimal]{standalone}

rusty1s's avatar
rusty1s committed
3
\usepackage{graphicx}
rusty1s's avatar
rusty1s committed
4
\usepackage{tikz}
rusty1s's avatar
rusty1s committed
5
6
7
\usetikzlibrary{shapes.geometric}

\newcommand{\tiny}[1]{\scalebox{0.45}{#1}}
rusty1s's avatar
rusty1s committed
8
9
10
11
12
13

\begin{document}

\begin{tikzpicture}

\tikzstyle{title}=[text width=1.1cm, inner sep=0pt]
rusty1s's avatar
rusty1s committed
14
\tikzstyle{square}=[rectangle, draw, minimum width=0.5cm, minimum height=0.5cm, inner sep=0pt, fill opacity=0.5, text opacity=1]
rusty1s's avatar
rusty1s committed
15
16
17
18
\tikzstyle{color1}=[fill=cyan]
\tikzstyle{color2}=[fill=orange]
\tikzstyle{color3}=[fill=olive]
\tikzstyle{color4}=[fill=magenta]
rusty1s's avatar
rusty1s committed
19
\tikzstyle{op}=[ellipse, draw, inner sep=-1pt, minimum height=8pt, minimum width=8pt]
rusty1s's avatar
rusty1s committed
20
\tikzstyle{edge1}=[->]
rusty1s's avatar
rusty1s committed
21
\tikzstyle{edge2}=[out=-90, in=90, looseness=0.85]
rusty1s's avatar
rusty1s committed
22

rusty1s's avatar
rusty1s committed
23
24
\node[title] at (-0.8, 2.2) {index};
\node[title] at (-0.8, 1.5) {input};
rusty1s's avatar
rusty1s committed
25
26
\node[title] at (-0.8, 0.0) {output};

rusty1s's avatar
rusty1s committed
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
\node[square] (index1) at (0.0, 2.2) {$0$};
\node[square] (index2) at (0.5, 2.2) {$0$};
\node[square] (index3) at (1.0, 2.2) {$1$};
\node[square] (index4) at (1.5, 2.2) {$0$};
\node[square] (index5) at (2.0, 2.2) {$2$};
\node[square] (index6) at (2.5, 2.2) {$2$};
\node[square] (index7) at (3.0, 2.2) {$3$};
\node[square] (index8) at (3.5, 2.2) {$3$};

\node[square, color1] (input1) at (0.0, 1.5) {$5$};
\node[square, color1] (input2) at (0.5, 1.5) {$1$};
\node[square, color2] (input3) at (1.0, 1.5) {$7$};
\node[square, color1] (input4) at (1.5, 1.5) {$2$};
\node[square, color3] (input5) at (2.0, 1.5) {$3$};
\node[square, color3] (input6) at (2.5, 1.5) {$2$};
\node[square, color4] (input7) at (3.0, 1.5) {$1$};
\node[square, color4] (input8) at (3.5, 1.5) {$3$};
rusty1s's avatar
rusty1s committed
44

rusty1s's avatar
rusty1s committed
45
46
47
48
\node[op] (op1) at (1.0, 0.6) {\tiny{+}};
\node[op] (op2) at (1.5, 0.6) {\tiny{+}};
\node[op] (op3) at (2.0, 0.6) {\tiny{+}};
\node[op] (op4) at (2.5, 0.6) {\tiny{+}};
rusty1s's avatar
rusty1s committed
49

rusty1s's avatar
rusty1s committed
50
51
52
53
\node[square, color1] (output1) at (1.0, 0.0) {$8$};
\node[square, color2] (output2) at (1.5, 0.0) {$7$};
\node[square, color3] (output3) at (2.0, 0.0) {$5$};
\node[square, color4] (output4) at (2.5, 0.0) {$4$};
rusty1s's avatar
rusty1s committed
54
55
56
57
58
59
60
61
62
63

\draw[edge1] (index1) -- (input1);
\draw[edge1] (index2) -- (input2);
\draw[edge1] (index3) -- (input3);
\draw[edge1] (index4) -- (input4);
\draw[edge1] (index5) -- (input5);
\draw[edge1] (index6) -- (input6);
\draw[edge1] (index7) -- (input7);
\draw[edge1] (index8) -- (input8);

rusty1s's avatar
rusty1s committed
64
65
66
67
68
69
70
71
72
73
74
75
76
\draw[edge1] (input1) to[edge2] (op1);
\draw[edge1] (input2) to[edge2] (op1);
\draw[edge1] (input3) to[edge2] (op2);
\draw[edge1] (input4) to[edge2] (op1);
\draw[edge1] (input5) to[edge2] (op3);
\draw[edge1] (input6) to[edge2] (op3);
\draw[edge1] (input7) to[edge2] (op4);
\draw[edge1] (input8) to[edge2] (op4);

\draw[edge1] (op1) -- (output1);
\draw[edge1] (op2) -- (output2);
\draw[edge1] (op3) -- (output3);
\draw[edge1] (op4) -- (output4);
rusty1s's avatar
rusty1s committed
77
78
79
80

\end{tikzpicture}

\end{document}