我如何绘制规范的 IV DAG?

我如何绘制规范的 IV DAG?

这是我的代码:

\documentclass{scrartcl}

\usepackage{tkz-graph} 
 
\usetikzlibrary{shapes.geometric}%   

\thispagestyle{empty}

\begin{document}


\tikzstyle{VertexStyle} = [shape            = ellipse,
                               minimum width    = 6ex,%
                               draw]

\tikzstyle{EdgeStyle}   = [->,>=stealth']
      
\begin{tikzpicture}[scale=1.5] 

\SetGraphUnit{2} 

\Vertex{Z}   \EA(Z){A} 
                 \SOEA(A){U} \NOEA(U){Y}
\Edges(Z,A,Y) \Edges(U,A) \Edges(U,Y)
  

\end{tikzpicture}

\end{document}

如何制作从 U 到 A 和从 U 到 Y 的虚线箭头?

答案1

欢迎使用 TeX: SE。您可以通过以下方式更改边缘样式\Edges[style=dashed] (<vertex-1>,<vertext-2>);

%\documentclass{scrartcl}
\documentclass[border=3.141592]{standalone} % accomodate page size to image size
\usepackage{tkz-graph}
\usetikzlibrary{arrows.meta,
                shapes.geometric}%
\tikzstyle{VertexStyle} = [shape=ellipse,
                           minimum width=6ex,
                           draw]
  \tikzstyle{EdgeStyle} = [-Stealth]

\thispagestyle{empty}

\begin{document}
    \begin{tikzpicture}[scale=1.5]
\SetGraphUnit{2}
\Vertex{Z}   \EA(Z){A}
                 \SOEA(A){U} \NOEA(U){Y}
\Edges(Z,A,Y) 
\Edges[style=dashed](U,A) 
\Edges[style=dashed](U,Y)
    \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容