<p><img src="/data/ueditor/php/upload/image/20200426/1587875854472717.png" title="1587875854472717.png" alt="2020-04-26 12-32-02屏幕截图.png" style="max-width:650px"></p><p><br></p><p>闲来无事,模仿你的图。</p><p></p><p>\documentclass[tikz]{standalone}<br>\usepackage{tikz}<br>\usetikzlibrary[<br> arrows.meta,<br> bending,<br> backgrounds,<br> graphs,<br> graphs.standard,<br> ]<br>\begin{document}<br>\begin{tikzpicture}[>=Latex]<br> \graph [<br> color class=c-0, color class=c-1,color class=c-2,color class=c-3,<br> nodes={draw, circle},empty nodes,<br> branch right, grow down]<br>{ [complete bipartite={c-0}{c-1},complete bipartite={c-1}{c-2},complete bipartite={c-2}{c-3},<-]<br> x[c-0,],<br> {[placement/width=1,placement/depth=-2]<br> subgraph I_n [name=lA,c-1,V={1,...,5}]<br> },<br> {[placement/width=2,placement/depth=-2]<br> subgraph I_n [name=lB,c-2,V={1,...,5},],<br> },<br> {[placement/width=3,placement/depth=-2]<br> subgraph I_n [name=lC,c-3,V={1,...,5},],<br> },<br>};<br>\end{tikzpicture}<br><br>\begin{tikzpicture}[>=Latex]<br>\def\mycircleradius{2mm}<br>\graph [<br> color class=c-0, color class=c-1,color class=c-2,color class=c-3,<br> nodes={circle,minimum width=2*\mycircleradius},empty nodes,branch right, grow down]<br>{[complete bipartite={c-0}{c-1},complete bipartite={c-1}{c-2},complete bipartite={c-2}{c-3},<-]<br> {[placement/width=0,placement/depth=3]0[c-0]},<br> {[placement/width=1]<br> \foreach \i in {1,3,5}<br> {<br> {[placement/depth=\i]\i[c-1]},<br> },<br> \foreach \i in {2,4}<br> {<br> {[placement/depth=\i]\i[!c-1]},<br> }<br> },<br> {[placement/width=2]<br> \foreach \i[evaluate={ \mmm = \i-5;}] in {7,10}<br> {<br> {[placement/depth=\mmm]\i[c-2]},<br> },<br> \foreach \i[evaluate={ \mmm = \i-5;}] in {6,8,9}<br> {<br> {[placement/depth=\mmm]\i[!c-2]},<br> }<br> },<br> {[placement/width=3]<br> \foreach \i[evaluate={ \mmm = \i-10;}] in {11,14,15}<br> {<br> {[placement/depth=\mmm]\i[c-3]},<br> },<br> \foreach \i[evaluate={ \mmm = \i-10;}] in {12,13}<br> {<br> {[placement/depth=\mmm]\i[!c-3]},<br> }<br> },<br>};<br>\begin{scope}[on background layer]<br> \foreach \i in {2,4,6,8,9,12,13}<br> {<br> \draw [densely dotted](\i) circle [radius=\mycircleradius];<br> \draw (\i.135)--(\i.-45);<br> \draw (\i.45)--(\i.225);<br> }<br> \foreach \i in {0,1,...,15}<br> {<br> \global\def\donotdraw{0}<br> \foreach \j in {2,4,6,8,9,12,13}<br> {<br> \ifnum\i=\j\relax<br> \global\def\donotdraw{1}<br> \fi<br> }<br> \ifnum\donotdraw=1\relax<br> \else<br> \draw (\i) circle [radius=\mycircleradius];<br> \fi<br> }<br>\end{scope}<br>\end{tikzpicture}<br>\end{document}</p><p><br></p><p>主要用了 TikZ 的 graphs, graphs.standard 这两个库。</p><p>另外也有 graphdrawing 库可用。</p><p>也有 tkz-graph 宏包,这个包的作者 也是 tkz-euclide 包的作者,手册好像是法文的。</p>