难以标记和连接 fitzpicture 中的节点

难以标记和连接 fitzpicture 中的节点

我在标记 64 个顶点时遇到了很大的问题。当我应用代码(参见附加代码)时,我得到的是一个菱形,当我完成匹配顶点时,它看起来很糟糕。我需要圆形的 64 个顶点,这样边缘和节点就不会重叠。感谢大家的帮助。

\begin{figure}[h!]
\centering
\hspace*{-2cm}%\includegraphics[width=6cm,height=5cm]
\begin{tikzpicture}[scale=.45]

% =================
\tikzstyle{every node}=[draw,circle,fill=black,minimum size=.5pt,inner sep=2pt]
\draw node (a1) [label= right: {$(1,0,0,0)$}] at (0,16) {};
\draw node (a2) [label= right: {$(0,1,0,0)$}]  at (1,15){};
\draw node (a3) [label=right: {$(0,0,1,0)$}] at (2,14){};
\draw node (a4) [label=right: {$(0,0,0,1)$}] at (3,13){};
\draw node (a5) [label=right: {$(2,0,0,0)$}] at (4,12) {};
\draw node (a6) [label=right: {$(0,2,0,0)$}]  at (5,11){};
\draw node (a7) [label=right: {$(0,0,2,0)$}] at (6,10){};
\draw node (a8) [label=right: {$(0,0,0,2)$}] at (7,9){};
\draw node (b1) [label=right: {$(1,1,0,0)$}] at (8,8) {};
\draw node (b2) [label=right: {$(1,0,1,0)$}]  at (9,7){};
\draw node (b3) [label=right: {$(1,0,0,1)$}] at (10,6){};
\draw node (b4) [label=right: {$(1,2,0,0)$}] at (11,5){};
\draw node (b5) [label=right: {$(1,0,2,0)$}] at (12,4) {};
\draw node (b6) [label=right: {$(1,0,0,2)$}]  at (13,3){};
\draw node (b7) [label=right: {$(2,1,0,0)$}] at (14,2){};
\draw node (b8) [label=right: {$(2,0,1,0)$}] at (15,1){};
\draw node (b9) [label= right: {$(2,0,0,1)$}] at (16,0) {};
\draw node (b10) [label= right: {$(2,2,0,0)$}]  at (15,-1){};
\draw node (b11) [label=right: {$(2,0,2,0)$}] at (14,-2){};
\draw node (b12) [label=right: {$(2,0,0,2)$}] at (13,-3){};
\draw node (b13) [label=right: {$(0,1,1,0)$}] at (12,-4) {};
\draw node (b14) [label=right: {$(0,1,0,1)$}]  at (11,-5){};
\draw node (b15) [label=right: {$(0,0,1,1)$}] at (10,-6){};
\draw node (b16) [label=right: {$(0,2,2,0)$}] at (9,-7){};
\draw node (b17) [label=right: {$(0,2,0,2)$}] at (8,-8) {};
\draw node (b18) [label=right: {$(0,0,2,2)$}]  at (7,-9){};
\draw node (b19) [label=right: {$(0,1,2,0)$}] at (6,-10){};
\draw node (b20) [label=right: {$(0,2,1,0)$}] at (5,-11){};
\draw node (b21) [label=right: {$(0,1,0,2)$}] at (4,-12) {};
\draw node (b22) [label=right: {$(0,2,0,1)$}]  at (3,-13){};
\draw node (b23) [label=right: {$(0,0,2,1)$}] at (2,-14){};
\draw node (b24) [label=right: {$(0,0,1,2)$}] at (1,-15){};
\draw node (c1) [label= left: {$(0,1,1,1)$}] at (0,-16) {};
\draw node (c2) [label= left: {$(1,1,0,1)$}]  at (-1,-15){};
\draw node (c3) [label=left: {$(1,0,1,1)$}] at (-2,-14){};
\draw node (c4) [label=left: {$(1,1,1,0)$}] at (-3,-13){};
\draw node (c5) [label=left: {$(0,1,2,1)$}] at (-4,-12) {};
\draw node (c6) [label=left: {$(0,1,1,2)$}]  at (-5,-11){};
\draw node (c7) [label=left: {$(0,1,2,2)$}] at (-6,-10){};
\draw node (c8) [label=left: {$(0,2,1,1)$}] at (-7,-9){};
\draw node (c9) [label=left: {$(0,2,2,1)$}] at (-8,-8) {};
\draw node (c10) [label=left: {$(0,2,1,2)$}]  at (-9,-7){};
\draw node (c11) [label=left: {$(0,2,2,2)$}] at (-10,-6){};
\draw node (c12) [label=left: {$(1,0,1,2)$}] at (-11,-5){};
\draw node (c13) [label=left: {$(1,0,2,1)$}] at (-12,-4) {};
\draw node (c14) [label=left: {$(1,0,2,2)$}]  at (-13,-3){};
\draw node (c15) [label=left: {$(2,0,1,2)$}] at (-14,-2){};
\draw node (c16) [label=left: {$(2,0,2,1)$}] at (-15,-1){};
\draw node (c17) [label= left: {$(2,0,2,2)$}] at (-16,0) {};
\draw node (c18) [label= left: {$(1,1,0,2)$}]  at (-15,1){};
\draw node (c19) [label=left: {$(1,2,0,1)$}] at (-14,2){};
\draw node (c20) [label= left: {$(1,2,0,2)$}] at (-13,3){};
\draw node (c21) [label= left: {$(2,1,0,2)$}] at (-12,4) {};
\draw node (c22) [label= left: {$(2,2,0,1)$}]  at (-11,5){};
\draw node (c23) [label= left: {$(2,2,0,2)$}] at (-10,6){};
\draw node (c24) [label= left: {$(1,1,2,0)$}] at (-9,7){};
\draw node (c25) [label= left: {$(1,2,1,0)$}] at (-8,8) {};
\draw node (c26) [label= left: {$(1,2,2,0)$}]  at (-7,9){};
\draw node (c27) [label= left: {$(2,1,2,0)$}] at (-6,10){};
\draw node (c28) [label= left: {$(2,2,1,0)$}] at (-5,11){};
\draw node (c29) [label= left: {$(2,2,2,0)$}] at (-4,12) {};
\draw node (c30) [label= left: {$(2,1,0,1)$}]  at (-3,13){};
\draw node (c31) [label= left: {$(2,0,1,1)$}] at (-2,14){};
\draw node (c32) [label= left: {$(2,1,1,0)$}] at (-1,15){};
% ------------
\draw [ultra thick, red](a1) -- (a2);
\draw [ultra thick, red](a1) -- (a3);
\draw [ultra thick, red](a1) -- (a4);
\draw [ultra thick, red](a1) -- (a6);
\draw [ultra thick, red](a1) -- (a7);
\draw [ultra thick, red](a1) -- (a8);
\draw [ultra thick, red](a1) -- (b13);
\draw [ultra thick, red](a1) -- (b14);
\end{tikzpicture}
\caption{}
\label{Sel2}
\end{figure}

答案1

有很多节点!

将它们摆成圆形很容易。对于标签,我选择也将它们旋转。

您必须使用大半径和/或非常小的节点以使直线不与节点相交。

针对这个例子,这里有两种解决方案。
第一种通过直线连接所有节点(但在节点后面)。第二种有一些弯曲的曲线。

代码

\documentclass[tikz]{standalone}
\usetikzlibrary{graphs}
\newcounter{tikzlabel}
\tikzgraphsset{every graph/.append code=\setcounter{tikzlabel}{0}}
\tikzset{
  circular label/.style n args={4}{
    label={[%
      /utils/exec=
        \pgfmathsetmacro\angle{Mod(90-\value{tikzlabel}/64*360,360)}%
        \pgfmathifthenelse{(\angle>90 && \angle<270)}{"east"}{"west"}%
        \tikzset{anchor/.expanded=\pgfmathresult}%
        \stepcounter{tikzlabel},
      rotate=\angle+180*(\angle>90 && \angle<270),
      label position=\angle]$(#1, #2, #3, #4)$}}}
\begin{document}
\tikz\graph[
  nodes={
    draw, fill, circle, inner sep=+1pt,
    circular label/.expand once=\tikzgraphnodename},
  typeset=, clockwise=64, radius=5cm,
]{
  1000, 0100, 0010, 0001, 2000, 0200, 0020, 0002,
  1100, 1010, 1001, 1200, 1020, 1002, 2100, 2010,
  2001, 2200, 2020, 2002, 0110, 0101, 0011, 0220,
  0202, 0022, 0120, 0210, 0102, 0201, 0021, 0012,
  0111, 1101, 1011, 1110, 0121, 0112, 0122, 0211,
  0221, 0212, 0222, 1012, 1021, 1022, 2012, 2021,
  2022, 1102, 1201, 1202, 2102, 2201, 2202, 1120,
  1210, 1220, 2120, 2210, 2220, 2101, 2011, 2110,
} [behind path] graph[use existing nodes, edges={red, thick}]{
  1000 -- {0010, 0001, 0200, 0020, 0002},
  1000 -- {0100, 0110, 0101}
};
\tikz\graph[
  nodes={
    draw, fill, circle, inner sep=+1pt,
    circular label/.expand once=\tikzgraphnodename},
  typeset=, clockwise=64, radius=5cm, edges={red, thick}
]{
  1000, 0100, 0010, 0001, 2000, 0200, 0020, 0002,
  1100, 1010, 1001, 1200, 1020, 1002, 2100, 2010,
  2001, 2200, 2020, 2002, 0110, 0101, 0011, 0220,
  0202, 0022, 0120, 0210, 0102, 0201, 0021, 0012,
  0111, 1101, 1011, 1110, 0121, 0112, 0122, 0211,
  0221, 0212, 0222, 1012, 1021, 1022, 2012, 2021,
  2022, 1102, 1201, 1202, 2102, 2201, 2202, 1120,
  1210, 1220, 2120, 2210, 2220, 2101, 2011, 2110,
  1000 --[bend right=10] {0010, 0001, 0200, 0020, 0002},
  1000 -- {0100, 0110, 0101}
};
\end{document}

输出

在此处输入图片描述

相关内容