2
\documentclass{book}
\usepackage{graphs}
\usetikzlibrary{graphs}

\begin{doument}
\begin{tikzpicture}[new set=import nodes]
\begin{scope}[nodes={set=import nodes}] % make all nodes part of this set
\node [red] (a) at (0,1) {$a$};
\node [red] (b) at (1,1) {$b$};
\node [red] (d) at (2,1) {$d$};
\end{scope}
\graph {
(import nodes);
% "import" the nodes
a -> b -> c -> d -> e;
};
\end{tikzpicture}
\end{document}

When I compiled this code, I got the error

! LaTeX Error: File `graphs.sty' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)

Enter file name: 
  • Welcome! Do you have a package called graphs i.e. a file graphs.sty? Because I don't - it doesn't seem to be in TeX Live. – cfr Feb 6 '16 at 3:44
3

LaTeX can only load existent packages. If you try to load a non-existent one, it will complain with an error.

No graphs.sty exists on my system. I think the package you probably want is TikZ:

\documentclass{book}
\usepackage{tikz}
\usetikzlibrary{graphs}

\begin{document}
\begin{tikzpicture}[new set=import nodes]
\begin{scope}[nodes={set=import nodes}] % make all nodes part of this set
\node [red] (a) at (0,1) {$a$};
\node [red] (b) at (1,1) {$b$};
\node [red] (d) at (2,1) {$d$};
\end{scope}
\graph {
(import nodes);
% "import" the nodes
a -> b -> c -> d -> e;
};
\end{tikzpicture}
\end{document}

graph of nodes

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.