1

Please can any one help me to write under the graph in latex like this graph

enter image description here

i used the tikzpicture to ddraw any graph this is

\begin{figure}[h]
    \centering
     \begin{tikzpicture}
\matrix[column sep=4em, row sep=9ex, inner sep=0pt, minimum width=8pt] (M) {
    \node[mypoint, label={[left,xshift=-6pt,yshift=-3pt]v$_{1}$}] (V1) {}; 
    &  \node[mypoint, label={[right,xshift=6pt,yshift=-3pt]v$_{2}$}] (V2) {};
  & & \node[mypoint, label={[left,xshift=-6pt,yshift=-3pt]v$_{1}$}] (V11) {};
   & \node[mypoint, label={[right,xshift=6pt,yshift=-3pt]v$_{2}$}] (V21) {};
    \\
    \node[mypoint, label={[left,xshift=2pt,yshift=4pt]v$_{3}$}] (V3) {}; & \node[mypoint, label={[right,xshift=6pt,yshift=-3pt]v$_{4}$}] (V4) {};
    & & \node[mypoint, label={[left,xshift=2pt,yshift=4pt]v$_{3}$}] (V31) {}; &  \node[mypoint, label={[right,xshift=6pt,yshift=-3pt]v$_{4}$}] (V41) {};



    \\
};
\draw (V3) --  (V1);
\draw (V3) -- node[below]{G} (V4);
\draw (V2) --  (V4);
\draw (V3) --  (V2);
\draw (V11) --  (V21);
\draw (V11) --  (V41);


\end{tikzpicture} 



    \includegraphics[width=0.9\textwidth ]{}
    \caption{A graph with it's complement \label{13}}

\end{figure}
  • You could write under it directly in tikz or use an external package like stackengine. However, for us to help you, you should add a minimum working example of code to show what you have achieved so far. – Steven B. Segletes Aug 9 '17 at 19:13
  • i divided the code in three comment because the size of it is big – Maryam Fasfous Aug 9 '17 at 19:26
  • 1
    You can edit your original question to add the code, rather than supplying it in comments. Also, a "working" example means to begin with \documentclass and end with \end{document} – Steven B. Segletes Aug 9 '17 at 19:32
  • 1
    Please add your code to your question, you must become familiar with our format – skpblack Aug 9 '17 at 19:32
  • 2
    When you copy code into a question, highlight the code block and press the {} button at the top of the edit box. This will indent the code 4 spaces, which has the effect of displaying it to the read as code, rather than text. I did this for you already, but for next time... – Steven B. Segletes Aug 9 '17 at 19:36
2

I would suggest that you use two \matrixes instead of one. It's easy to place the second one relative to the first one, with the help of the positioning library, and the labels can be added by using a label for the \matrix.

Note that for node labels, you should use the syntax label={[<options>]<position>:<label>}. In this case you don't need any options I think, just do e.g. label=left:$v_1$.

output of code

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix,positioning}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[
   mypoint/.style={fill,draw,inner sep=0pt,label distance=2pt,minimum size=3pt,circle},
   % define a style for the matrix
   mymatrix/.style={
     column sep=4em, row sep=9ex,
     % makes each cell a node that is automatically named, so don't use \node ...
     matrix of nodes,
     % applies the mypoint style to each node in the matrix
     nodes=mypoint}]

\matrix[
  mymatrix,
  % add label below the matrix
  label=below:$G$
]
% give the matrix a name
 (M)
{
    |[label=left:$v_{1}$]| & |[label=right:$v_{2}$]| \\
    |[label=left:$v_{3}$]| & |[label=right:$v_{4}$]| \\
};

\matrix[
  mymatrix,
  % position it relative to the first matrix
  right=3cm of M,
  label=below:$G2$
]
 (M2)
{
    |[label=left:$v_{1}$]| & |[label=right:$v_{2}$]| \\
    |[label=left:$v_{3}$]| & |[label=right:$v_{4}$]| \\
};

% draw lines in left matrix
% the name of the matrix is M, so each node is named
% M-<row number>-<column number>
\draw (M-1-1) -- (M-2-1) -- (M-1-2) -- (M-2-2) -- (M-2-1);

% lines in right matrix
\draw (M2-1-2) -- (M2-1-1) -- (M2-2-2);

\end{tikzpicture} 

\bigskip


    \includegraphics[width=0.9\textwidth ]{example-image-16x10}
    \caption{A graph with its complement \label{13}}

\end{figure}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.