1

I'm trying to get graphs looking like the following example:

I wan't my graphs to look like this

But all I can get is this:

result of my attempts, see also MWE

The problem is that the edges don't connect the centers of the nodes. On the white node on the top I tried some workaround but I cannot get the node in front of the edges covering the edges. Without the workaround it looks like on the smaller black nodes. Also my graphs seem to be not as smooth as other graphs I have seen. Also any ideas of further improvements or things I should do differently are very welcome.

MWE:

\documentclass[a4paper]{article} 
\usepackage{tikz}
\begin{document}
    \begin{tikzpicture} [every node/.style={draw,circle,inner sep=0pt},
    level/.style={sibling distance=20mm/#1},
    level distance=25mm]
    \tikzstyle{hollow node}=[draw,circle, fill=white, outer sep=-5pt,inner sep=0pt,
    minimum width=10pt, above]
    \tikzstyle{black node}=[draw,circle,fill= black, inner sep=0pt,
    minimum width=5pt]
    \node[hollow node](1){\null}
    child{node[black node]{\null}
        child{node[hollow node]{\null}}
        child{node[hollow node]{\null}} }
    child{node[black node]{\null}
        child{node[hollow node]{\null}}
        child{node[hollow node]{\null}} }
    child{node[black node]{\null}
        child{node[hollow node]{\null}}
        child{node[hollow node]{\null}}};
    \end{tikzpicture}
\end{document}
  • Your code gives radial edges for me (with or without the outer sep = -5pt). It doesn't seem so on your picture, though. Have you zoomed in on the node in your pdf ? And everything is smooth, but lines seem to be thicker in your example. – Christoph Frings Jul 15 '16 at 09:40
  • Try to add the option clip to your path. That should remove the part of the line, that is inside your circle. – Carina Jul 15 '16 at 09:46

1 Answers1

1

Don't use a negative outer sep and take a look at Should \tikzset or \tikzstyle be used to define TikZ styles?

\documentclass[a4paper]{article} 
\usepackage{tikz}
\begin{document}
    \begin{tikzpicture} [
    level/.style={sibling distance=20mm/#1},
    level distance=25mm,
    hollow node/.style={draw, circle, minimum width=10pt, inner sep=0pt},
    black node/.style={draw, circle, fill=black, inner sep=0pt,
    minimum width=5pt}]

    \node[hollow node](1){}
    child{node[black node]{}
        child{node[hollow node]{}}
        child{node[hollow node]{}} }
    child{node[black node]{}
        child{node[hollow node]{}}
        child{node[hollow node]{}} }
    child{node[black node]{}
        child{node[hollow node]{}}
        child{node[hollow node]{}}};
    \end{tikzpicture}
\end{document}

enter image description here

Ignasi
  • 136,588