related questions


I would like to go from either an adjacency matrix or list of edge pairs to a human-readable graph diagram that fits on a page, i.e. as in the example from the first question, from this:

(1, 1)
(1, 2)
(1, 5)
(2, 1)
(2, 3)
(2, 5)
(3, 2)
(3, 4)
(4, 3)
(4, 5)
(4, 6)
(5, 1)
(5, 2)
(5, 4)
(6, 4)

to this:

desired graph

I'm not particular about the formatting, or node placement, apart from general things like color and maybe bounding box--I would just like to keep it entirely contained inside a TeX document (as opposed to relying on an external file from GraphViz etc.).

Is there an existing solution for this? If not, where do I start?

  • You can do this pretty much built-in using TikZ and LuaTeX. – Sean Allred Sep 18 '14 at 3:56
  • Are any of these differences between LuaTeX and XeTeX going to break existing documents out of the box? I'm coming from XeTeX which I rely on constantly for Unicode/international support. – bright-star Sep 18 '14 at 4:00
  • I can't say. I know that LuaTeX isn't yet stable enough (IMHO) for archival documents, but from what I've heard it is very much stable enough for general use. YMMV. – Sean Allred Sep 18 '14 at 4:01
  • 2
    The sagetex package uses a CAS that has lots of support for graph theory. You'd need to install Sage on your computer or process LaTeX with a free SageMath Cloud account. You can experiment with Sage code for graphs using a Sage Cell Server. – DJP Sep 18 '14 at 4:54
  • That's definitely my fallback and I have used sagetex before, but it's quite a heavy dependency even if it can be reached from within a TeX document. – bright-star Sep 18 '14 at 8:33

Your Answer

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

Browse other questions tagged or ask your own question.