[Tex/LaTex] Basic undirected graphs in TikZ


Hey TeX Stack Exchangers,

I have to draw some really basic undirected graphs in TikZ and struggling to find documentation that fits my needs. Each of my graphs has 10 edges and an equal number of degrees per vertice. I want to draw 3 graphs as follows:

  1. A graph with 20 nodes each with a degree of 1
  2. A graph with 10 nodes each with a degree of 2
  3. A graph with 5 nodes each with a degree of 4

I obviously don't want to hand code all of these nodes and edges. I've been playing around with loops in TikZ but it is really frustrating. The closest thing I found for graph #2 is this link but it isn't much help.


Best Answer

With a special package for graphs it is easy:









See documentation of tkz-berge.

enter image description here

Related Question