Hello.
I would like to draw the adjacency-list representation of a graph
using tikz, but I do not master it yet.
The picture should look like the one found at
http://www.iceb.ufop.br/decom/prof/romildo/misc/adjacency-list.jpg
Any help?
Romildo
|
|
0
|
|
|
|
Reply
|
romildo
|
8/25/2010 7:23:23 PM |
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
romildo <j.romildo@gmail.com> writes:
> Hello.
>
> I would like to draw the adjacency-list representation of a graph
> using tikz, but I do not master it yet.
>
> The picture should look like the one found at
> http://www.iceb.ufop.br/decom/prof/romildo/misc/adjacency-list.jpg
Are you sure that this is possible (i.e. already implemented)?
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
- --
It is better to die on one's feet than live on one's knees.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iEYEARECAAYFAkx2qxQACgkQM0LLzLt8Mhx18QCghCRlS/Vrr9ImIqxQHZK65jP2
OCUAni0slSwhqrv/Y3P85E91tEdG7PvN
=tAVV
-----END PGP SIGNATURE-----
|
|
0
|
|
|
|
Reply
|
Luca.Merciadri (232)
|
8/26/2010 5:57:40 PM
|
|
On Aug 25, 9:23=A0pm, romildo <j.romi...@gmail.com> wrote:
Try this:
%------------------------
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength{\PreviewBorder}{5mm}
\pagestyle{empty}
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}
\matrix (M) [matrix of nodes,
column sep=3D0pt,
row sep=3D0pt,
nodes=3D{draw,fill=3Dgray!20,minimum width=3D.5cm,outer sep=3D0pt,minimum
height=3D.7cm,anchor=3Dcenter},
column 1/.style=3D{minimum height=3D.8cm}]{
\mbox{} &[2mm] 2 & \mbox{} &[2mm] 5 & $/$ &[2mm] & &[2mm] & \\
\mbox{} & 1 & \mbox{} & 5 & \mbox{} & 3 & \mbox{} & 4 & $/$ \\
\mbox{} & 2 & \mbox{} & 4 & $/$ & & & & \\
\mbox{} & 2 & \mbox{} & 5 & \mbox{} & 3 & $/$ & & \\
\mbox{} & 4 & \mbox{} & 1 & \mbox{} & 2 & $/$ & & \\
};
\foreach \i in {1,2,3,4,5}{
\path (M-\i-1) [late options=3D{label=3Dleft:\i}];
\draw[->] (M-\i-1.center)--(M-\i-2.west);
\draw[->] (M-\i-3.center)--(M-\i-4.west);
}
\draw[->] (M-2-5.center)--(M-2-6.west);
\draw[->] (M-4-5.center)--(M-4-6.west);
\draw[->] (M-5-5.center)--(M-5-6.west);
\draw[->] (M-2-7.center)--(M-2-8.west);
\end{tikzpicture}
\end{document}
%-------------------------
Ignasi
|
|
0
|
|
|
|
Reply
|
Ignasi
|
9/2/2010 11:23:52 AM
|
|