谁会用用LaTex画二项树,如图

1个回答

  • 看看这个效果咋样?

    文字标注自己改吧,图看不清

    documentclass{article}

    usepackage[svgnames]{xcolor}

    usepackage{tikz}

    usetikzlibrary{arrows,shapes,positioning}

    tikzstyle arrowstyle=[scale=1]

    begin{document}

    begin{tikzpicture}

    node[fill=black,circle,scale=0.5](0) at (0,0){};

    node[fill=black,circle,scale=0.5](1) at (2,1) {};

    node[fill=black,circle,scale=0.5](2) at (2,-1) {};

    node [fill=black,circle,scale=0.5] (3) at (4, -0) {};

    node [fill=black,circle,scale=0.5] (4) at (4, 2) {};

    node [fill=black,circle,scale=0.5] (5) at (6, 3) {};

    node [fill=black,circle,scale=0.5] (6) at (4, -2) {};

    node [fill=black,circle,scale=0.5] (7) at (6, -3) {};

    node [fill=black,circle,scale=0.5] (8) at (6, 1) {};

    node [fill=black,circle,scale=0.5] (9) at (6, -1) {};

    node [fill=black,circle,scale=0.5] (10) at (8, -2) {};

    node [fill=black,circle,scale=0.5] (11) at (8, 4) {};

    node [fill=black,circle,scale=0.5] (12) at (8, 2) {};

    node [fill=black,circle,scale=0.5] (13) at (8, -0) {};

    node [fill=black,circle,scale=0.5] (14) at (8, -4) {};

    draw[->,thick] (0) to (1);

    draw[->,thick] (1) to (4);

    draw[->,thick] (4) to (5);

    draw[->,thick] (5) to (11);

    draw[->,thick] (0) to (2);

    draw[->,thick] (2) to (3);

    draw[->,thick] (1) to (3);

    draw[->,thick] (4) to (8);

    draw[->,thick] (3) to (8);

    draw[->,thick] (8) to (12);

    draw[->,thick] (5) to (12);

    draw[->,thick] (2) to (6);

    draw[->,thick] (6) to (7);

    draw[->,thick] (7) to (14);

    draw[->,thick] (3) to (9);

    draw[->,thick] (6) to (9);

    draw[->,thick] (9) to (10);

    draw[->,thick] (7) to (10);

    draw[->,thick] (9) to (13);

    draw[->,thick] (8) to (13);

    node [above] at (0) {$S_0$};

    node [above] at (1) {$S_1$};

    node [above] at (2) {$S_2$};

    node [above] at (3) {$S_3$};

    node [above] at (4) {$S_4$};

    node [above] at (5) {$S_5$};

    node [above] at (6) {$S_6$};

    node [above] at (7) {$S_7$};

    node [above] at (8) {$S_8$};

    node [above] at (9) {$S_9$};

    node [above] at (10) {$S_{10}$};

    node [above] at (11) {$S_{11}$};

    node [above] at (12) {$S_{12}$};

    node [above] at (13) {$S_{13}$};

    node [above] at (14) {$S_{14}$};

    end{tikzpicture}

    end{document}