有没有什么办法可以清理这个问题,以便清楚地看到 p$_1$ 和 p$_3$ 在 t=1 到 t=2 的各个分支上是不同的?
移动其中一个的位置看起来都很愚蠢,而且我没有足够的经验来找到正确的命令来使它们各自的分支更清楚地不重叠。
代码:
\documentclass[12pt]{article}
\usepackage{lipsum,wrapfig,graphicx,scrextend,sectsty,verbatim,tikz,tkz-berge}
\begin{document}
\begin{tikzpicture}[scale=3]
\GraphInit[vstyle=Classic]
\SetUpVertex[Lpos=-90]
\tikzset{VertexStyle/.style = {shape=circle, fill=black, minimum size=3pt,inner sep=0pt}
}
%t=1
\Vertex[x=0,y=1.5]{S$_0$}
\Vertex[x=1,y=1.5]{mS$_0$}
\Vertex[x=1,y=2]{uS$_0$}
\Vertex[x=1,y=1]{dS$_0$}
%t=2
\Vertex[x=2,y=2.5]{u$^2$S$_0$}
\Vertex[x=2,y=2]{umS$_0$}
\Vertex[x=2,y=1.5]{m$^2$S$_0$}
\Vertex[x=2,y=1]{dmS$_0$}
\Vertex[x=2,y=.5]{d$^2$S$_0$}
%t=1
\Edge[label = $\widetilde{p}_1$](S$_0$)(uS$_0$)
\Edges[label = $\widetilde{p}_2$](S$_0$,mS$_0$)
\Edges[label = $\widetilde{p}_3$](S$_0$,dS$_0$)
%t=2
%u
\Edges[label = $\widetilde{p}_1$](uS$_0$,u$^2$S$_0$)
\Edges[label = $\widetilde{p}_2$](uS$_0$,umS$_0$)
\Edges[label = $\widetilde{p}_3$](uS$_0$,m$^2$S$_0$)
%m
\Edges[label = $\widetilde{p}_3\,\widetilde{p}_1$]
(mS$_0$,umS$_0$)
\Edges[label = $\widetilde{p}_2$](mS$_0$,m$^2$S$_0$)
\Edges[label = $\widetilde{p}_3$](mS$_0$,dmS$_0$)
%d
\Edges[label = $\widetilde{p}_3\,\widetilde{p}_1$](dS$_0$,m$^2$S$_0$)
\Edges[label = $\widetilde{p}_2$](dS$_0$,dmS$_0$)
\Edges[label = $\widetilde{p}_3$](dS$_0$,d$^2$S$_0$)
\end{tikzpicture}
\end{document}
答案1
\documentclass[12pt]{article}
\usepackage{lipsum,wrapfig,graphicx,scrextend}
\usepackage{sectsty,verbatim,tikz,tkz-berge,amsmath,amsthm,amssymb,amsfonts,tkz-graph}
\usetikzlibrary{trees,fit,shapes,arrows, calc}
\begin{document}
\begin{quote}
\begin{tikzpicture}[scale=3]
\GraphInit[vstyle=Classic]
\SetUpVertex[Lpos=-90]
\tikzset{VertexStyle/.style = {shape=circle, fill=black, minimum size=3pt,inner sep=0pt}
}
%t=1
\Vertex[x=0,y=1.5]{S$_0$}
\Vertex[x=1,y=1.5]{mS$_0$}
\Vertex[x=1,y=2]{uS$_0$}
\Vertex[x=1,y=1]{dS$_0$}
%t=2
\Vertex[x=2,y=3]{u$^2$S$_0$}
\Vertex[x=2,y=2.5]{umS$_0$}
\Vertex[x=2,y=1.]{m$^2$S$_0$}
\Vertex[x=2,y=.5]{dmS$_0$}
\Vertex[x=2,y=0]{d$^2$S$_0$}
\Vertex[x=2,y=1.75]{udS$_0$}
%t=1
\tikzset{EdgeStyle/.style={->,font=\scriptsize,above,sloped,midway}}
\Edge[label = $\widetilde{p}_1$](S$_0$)(uS$_0$)
\Edges[label = $\widetilde{p}_2$](S$_0$,mS$_0$)
\Edges[label = $\widetilde{p}_3$](S$_0$,dS$_0$)
%t=2
%u
\Edges[label = $\widetilde{p}_1$](uS$_0$,u$^2$S$_0$)
\Edges[label = $\widetilde{p}_2$](uS$_0$,umS$_0$)
\Edges[label = $\widetilde{p}_3$, color=red](uS$_0$,udS$_0$)
%m
\Edges[label = $\widetilde{p}_1$, color=blue](mS$_0$,umS$_0$)
\Edges[label = $\widetilde{p}_2$](mS$_0$,m$^2$S$_0$)
\Edges[label = $\widetilde{p}_3$,color=blue](mS$_0$,dmS$_0$)
%d
\Edges[label = $\widetilde{p}_1$,color=red](dS$_0$,udS$_0$)
\Edges[label = $\widetilde{p}_2$](dS$_0$,dmS$_0$)
\Edges[label = $\widetilde{p}_3$](dS$_0$,d$^2$S$_0$)
\end{tikzpicture}
\end{document}
我们所做的只是将最后的节点进一步展开,以便可以看到 p$_n$ 语句。否则它们会相互覆盖而无法被看到。