在 tkz-berge 中向圖中加入任意邊

在 tkz-berge 中向圖中加入任意邊

我希望能夠在 tkz-berge 中的一個圖表中添加任意邊。例如,在下圖中,我想在 v0 和 v4 之間新增一條邊。

循環圖

\documentclass[a4paper]{article}

\usepackage{tikz}
\usepackage{tkz-berge}

\begin{document}

\begin{tikzpicture}
  \GraphInit[vstyle=Normal];
  \grCycle[prefix=v,Math=true,RA=2]{10};
\end{tikzpicture}

\end{document}

tkz-berge 文件描述了許多\Edge...命令,但它們似乎都是添加邊的模式。我沒有看到用於添加單一任意邊的命令。

我確實嘗試使用 tkz-graph 中的普通\Edge命令,猜測自動生成的頂點標籤,但沒有成功。例如,我嘗試了以下操作:

\Edge(0)(4);
\Edge($v_0$)($v_4$);

我懷疑在幕後一定有一個命令被各種\Edge...命令用來添加單一邊緣。

編輯這是最終的解決方案。標籤方案是,例如,頂點 v_0 具有標籤v0

在此輸入影像描述

\documentclass[a4paper]{article}

\usepackage{tikz}
\usepackage{tkz-berge}

\begin{document}

\begin{tikzpicture}
  \GraphInit[vstyle=Normal];
  \grCycle[prefix=v,Math=true,RA=2]{10};
  \Edge(v0)(v4);
\end{tikzpicture}

\end{document}

答案1

像這樣的東西

在此輸入影像描述

或者

在此輸入影像描述

\documentclass[a4paper]{article}

\usepackage{tikz}
\usepackage{tkz-berge}

\begin{document}

\begin{tikzpicture}
  \GraphInit[vstyle=Shade]
  \grCycle[prefix=a,Math=true,RA=4]{10}%
  \EdgeInGraphFromOneToComp{a}{10}{0}
\end{tikzpicture}

\end{document}

或者

\documentclass[a4paper]{article}

\usepackage{tikz}
\usepackage{tkz-berge}

\begin{document}

\begin{tikzpicture}
    \GraphInit[vstyle=Shade]
    \grCycle[prefix=a,Math=true,RA=4]{10}%
    \Edge[](a0)(a4)
\end{tikzpicture}

\end{document}

相關內容