Re: tikz e grafi pesati

#58270
robitex
Amministratore del forum
    Up
    0
    Down
    ::

    Ciao,
    sto provando a disegnare grafi con tikz.
    Ad esempio:
    `
    \documentclass{article}

    \usepackage{tikz}
    \usepackage{verbatim}
    \usetikzlibrary{arrows,shapes,positioning}

    \begin{document}
    \pagestyle{empty}

    \tikzstyle{v1}=[circle, draw,inner sep=2pt, minimum width=8pt]
    \tikzstyle{edge} = [draw,thick,-,font=\small , double=red, double distance=1pt]
    \tikzstyle{edge1} = [draw,thick,-,font=\small]
    \tikzstyle{label} = [draw,fill=yellow,font=\normalsize]

    \begin{figure}
    \begin{tikzpicture}[scale=1, auto,swap]
    \foreach \pos/\name in {{(0,0)/a}, {(0,2)/b}, {(1,1)/c}}
    \node[v1] (\name) at \pos {};

    \draw[edge] (a) to node[label] {+} (b);
    \path[edge1] (a) to node[label] {$-$} (c);

    \end{tikzpicture}
    \end{figure}
    \end{document}
    `
    Vorrei però chè le etichette sugli archi siano al centro dell’arco stesso. Come posso fare?
    (per intenderci come qui http://www.texample.net/tikz/examples/bridges-of-konigsberg/)

    Togli l’opzione auto.
    Bye

    Go to top