-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathfigure8-11-a-undirected-graphs.tex
More file actions
45 lines (40 loc) · 1.64 KB
/
figure8-11-a-undirected-graphs.tex
File metadata and controls
45 lines (40 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usepackage{medl_colors}
\usetikzlibrary{graphdrawing,graphdrawing.trees,graphs, graphs.standard, backgrounds, calc, arrows.meta, matrix}
\usegdlibrary{layered}
\begin{document}
\begin{tikzpicture}
\path (0, -2) graph [tree layout, nodes={blueshape, circle, minimum size=1cm,empty nodes}, level sep=6mm, sibling sep=15mm, edges={thickline}]
{
1[label = center:$v_1$];
2[label = center:$v_2$];
3[label = center:$v_3$];
4[label = center:$v_4$];
5[label = center:$v_5$];
6[label = center:$v_6$];
7[label = center:$v_7$];
8[label = center:$v_8$];
1 -- {
3 -- {2 -- {5 -- {6, 7}}, 4, 6 -- {8}}
};
};
% Matrix to the right
{\Large \matrix (m) [matrix of math nodes, nodes in empty cells, left delimiter=[, right delimiter={]}, row sep=0.3cm, column sep=0.3cm, minimum width=0.4cm, minimum height=0.4cm, scale=0.7] at (10, -5.5) {
0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 1 & 0 & 1 & 0 & 0 & 0 \\
1 & 1 & 0 & 1 & 0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 & 0 & 1 & 1 & 0 \\
0 & 0 & 1 & 0 & 1 & 0 & 0 & 1 \\
0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\
};
}
% Labels for the matrix
\foreach \i in {1,...,8}
\node[anchor=east, xshift=-0.5cm] at (m-\i-1.west) {\i};
\foreach \j in {1,...,8}
\node[anchor=north, yshift=0.7cm] at (m-1-\j.north) {\j};
\end{tikzpicture}
\end{document}