# Package to draw graphs (not graphics) by mathematical desciptions

Is there any latex package to draw graphs by its descriptive relations. Lets say:

\draw_graph_complete{5}{1}

Or

\draw_graph{u,v,x,y,z}{{u,v}{v,x}{x,z}{y,z}}

I don't want to deal with placement coordinates or stuff like that.

So far I have found the tikz libraries as graphs and graphs.standard.

For example this MWE.

\documentclass[a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{graphs, graphs.standard}
\begin{document}
\begin{tikzpicture}
\graph[nodes={circle, draw}, grow right=2cm, branch down=2cm]{
b,
a -- {b,c},
c -- {b},
e -- {a,d},
d -- {c}
};
\end{tikzpicture}
\end{document}


gives a nice graph, but lacks symmetry in the node b. I can live with that, but looking for alternatives.

• If you want to draw a complete graph or other standard graphs, doesn't graphs.standard do what you need? (I realize it doesn't for the non-standard graph that you provided in your code.) – LarrySnyder610 Apr 28 '19 at 2:46
• See my answer for the question posted here. Basically, you want to use tikz in combination with the tkz-graph, and tkz-berge packages and you should look into sagetex with Sage. Links are provided to get you started. – DJP Apr 28 '19 at 2:48

I think that the question is more how to know which algorithm to employ. I do not have a general answer but in this case you may want to do

\documentclass[a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{graphs,graphdrawing, graphs.standard}
\usegdlibrary{force}
\begin{document}
\begin{tikzpicture}
\graph[spring layout,
nodes={circle, draw}, ]{
b,
a -- {b,c},
c -- {b},
e -- {a,d},
d --[orient=90] {c}
};
\end{tikzpicture}
\end{document}


This places b more symmetrically.