5

I never got to layout (arbitrary) large edge labels in a dot2tex section. The problem is that the size of the layout has no effect of the layout and the rendering is only based on the default edge length. I want to describe a graph with arbitrary content (in nodes and in edges) and not care at all about the layout (maybe I have to specify something like max. edge label and max. node width).

I tried a lot of things in the example below, the most important are:

  • try with all layout engines available for dot2texi (all don't calculate the required space correctly (in other layouts which do more than hierarchical arrangement, like fdp, it's not only a length, but a space calculation issue)
  • putting text and whitespace in all combinations of label and texlbl
  • tried plain text, vbox, minipage environment in texlbl/label
  • omitting enclosing tikzpicture

One issue is that some crucial edge attribute like texlbl in dot2texi don't seem to be documented.

\RequirePackage{shellesc}
\documentclass[a4paper,10pt]{article}

\usepackage{dot2texi}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}

\begin{document}
\begin{dot2tex}[autosize,tikz,scale=1.0,fdp]
digraph G {
    A [shape=box, texlbl="A"];
    B [shape=box, texlbl="B"];
    C [shape=box, texlbl="C"];
    D [shape=box, texlbl="\vbox{ABCDEFGHIJKLMNOPQ ABCDEFGHIJKLMNOPQ ABCDEFGHIJKLMNOPQ ABCDEFGHIJKLMNOPQ ABCDEFGHIJKLMNOPQ ABCDEFGHIJKLMNOPQ ABCDEFGHIJKLMNOPQ ABCDEFGHIJKLMNOPQ ABCDEFGHIJKLMNOPQ ABCDEFGHIJKLMNOPQ }"];
    E [shape=box, texlbl="ABCDEFGHIJKLMNOPQ "];
    A -> B [label=" ", shape=box, width=10, texlbl="\vbox{abcdefghijklmnopqrstuvw }"];
    B -> C [label=" ", shape=box, width=10, texlbl="\vbox{ 1234567890  1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890}"];
    C -> D;
    D -> E;
}
\end{dot2tex}
\end{document}

results in

enter image description here

where the size of the edge from B to C is obviously not taken into account when calculating the layout. I expect it to not overlap with B or C. Adding the autosize option fixes the issue for the dot, but this doesn't help with other layouts (which are crucial for the task described below) like fdp.

I'm looking for a (Lua)TeX solution which allows both nodes and edges to contain as many forms of information as possible (text, images, tables, formulas, etc.) and still be layed out correctly. My intention is to create a very well linked knowledge graph for which I only have to specify my knowledge in the form of nodes and the links in the form of edges.

Recommendations of alternative ways outside of the world of dot2texi and pgf to solve this problem are welcome.

2
  • After adding the [autosize] option to the \usepackage{dot2texi} in the MWE you stated, compilation appears to calculate the edge length between B and C correctly without overlap, resulting in a 'correct' layout. Does this solve your problem?
    – aehrm
    Jul 6, 2018 at 22:56
  • @aehrm Thanks for your input. Adding the autosize option to usepackage{dot2texi} or to the dot2texi section only fixes the issue for the default dot layout, more details see edit. Jul 7, 2018 at 23:44

0

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.