1

I need to create a weighte d graph on Latex. I got 6k+ vertex.

I found the manual but is for French. I found the script below but there is something that I don't understand.

There is a simple way that allow me to declare Vertex / Edge without write the position of the Vertex?

In this script what does it means this row?

\Vertex{P}
  \NOEA(P){B}  \SOEA(P){M} \NOEA(B){D}
  \SOEA(B){C}  \SOEA(C){L}

Full script

\documentclass[11pt]{scrartcl}
\usepackage{tkz-graph}


\begin{document}
\begin{tikzpicture}
 \SetUpEdge[lw         = 1.5pt,
            color      = orange,
            labelcolor = white]
  \GraphInit[vstyle=Normal] 
  \SetGraphUnit{3}
  \tikzset{VertexStyle/.append  style={fill}}
  \Vertex{P}
  \NOEA(P){B}  \SOEA(P){M} \NOEA(B){D}
  \SOEA(B){C}  \SOEA(C){L}
  \tikzset{EdgeStyle/.style={->}}
  \Edge[label=$3$](C)(B)
  \Edge[label=$10$](D)(B)
  \Edge[label=$10$](L)(M)
  \Edge[label=$10$](B)(P)
  \tikzset{EdgeStyle/.style={<->}}
  \Edge[label=$4$](P)(M)
  \Edge[label=$9$](C)(M)
  \Edge[label=$4$](C)(L)
  \Edge[label=$5$](C)(D)
  \Edge[label=$10$](B)(M)
  \tikzset{EdgeStyle/.style={<->,relative=false,in=0,out=60}}
  \Edge[label=$11$](L)(D)
\end{tikzpicture}
\end{document}

1 Answers1

0

With such a huge amount of vertices, I would recommend, as an alternative, you using Graphviz Dot instead of Latex package you're trying to describe above. Note also that there exists a latex package (dot2tex) to include your Graphviz Dot code into latex; wrapped in a PGF/TikZ environment to create a neat vector graphics image (however for a huge graph I would encourage you to render it externally by using graphviz and simply include the image in you .tex document).

The syntax of Graphviz Dot is really simple and can be written quite easily programatically (as I assume you wont write your 6k vertices manually...).

As an example, the following branch and price tree was generated programatically using Graphviz Dot.

Branch-and-Price Tree

digraph BST {
    node [color = "black", shape = "point"]; 
    edge [arrowsize = "0.1"];
1->2;
2 [color = "blue"];
1->3;
3 [color = "blue"];
1 [color = "black"];
3->4;
4 [color = "blue"];
3->5;

...

}

For details, see the Graphviz DOT documentation, and for an example of an autogenerated graph for a small instance of the shortest path problem, see

Community
  • 1
  • 1
dfrib
  • 70,367
  • 12
  • 127
  • 192