I have drawn several graphs using tikz. Right now I am getting the vertex label inside the vertex. But I want the labels of vertices outside it.
Also I want to draw two tickz pictures in one line. Please help.
I am using the following code.
\documentclass[11pt]{article}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{caption}
\begin{document}
\begin{figure}[h]
\centering
\begin{tikzpicture}
\begin{scope}[every node/.style={fill=white,circle,thick,draw}]
\node(A) at (1,1) {1};
\node(B) at (0,0) {2};
\node(C) at (1,-1) {3};
\end{scope}
\begin{scope}
[every edge/.style={draw=black,very thick}]
\path[-](A)edge node {} (B);
\path[-](B) edge node {} (C);
\end{scope}
\end{tikzpicture}
\caption*{Figure 1}
\end{figure}
\medskip
\begin{figure}[h]
\centering
\begin{tikzpicture}
\begin{scope}[every node/.style={fill=white,circle,thick,draw}]
\node(A) at (0,0) {2};
\node(B) at (-1,1) {4};
\node(C) at (1,1) {6};
\node(D) at (1,-1) {8};
\node(E) at (-1,-1) {10};
\end{scope}
\begin{scope}
[every edge/.style={draw=black,very thick}]
\path[-](A)edge node {} (B);
\path[-](A) edge node {} (C);
\path[-](A) edge node {} (D);
\path[-](A) edge node {} (E);
\end{scope}
\end{tikzpicture}
\caption*{Figure 2}
\end{figure}
\end{document}
Best Answer
An alternative, based on assumption,that you wish two figures side by side and not subfigures:
I also slightly change code to make it more concise and easy to use (omit are
scope
s, defined node for simple settings their labels, omitted are not used nodes ad edges. Figures are placed intabularx
table.Addendum: In case, that you like to organize figures in one line as sub figures:
In above MWE is used environments
subfigure
from packagesubcaption
.