PCC
Reduc7

Description

This code is a LaTeX document that uses the TikZ package to create a simple directed graph. The code begins by setting the document class to "standalone" and loading the TikZ package. It then defines a new style called "near start abs" that shifts the position of a node. The code also loads the TikZ library "positioning".

Within the "tikzpicture" environment, the code places several nodes using the "node" command, each represented by a circle with black borders, white fill, and a minimum size of 10pt. The nodes are labeled with letters and numbers, for example "r" is the label for the first node, "r1a" is the label for the second node, and so on.

The nodes are positioned relative to each other using the "right of", "above right of", and "above of" keywords. The "node distance" option is used to set the distance between nodes.

The edges between the nodes are drawn using the "draw" command, with the "circle" option to make them curved. The edges are labeled with numbers using the "node" command, with the "above" option to place the label above the edge. The direction of the edge is specified using arrows. The edges are also labeled with the thickness using the "thick" option.

Once compiled, this code will produce a standalone image of the directed graph with circular nodes and curved edges. The image will be saved as a PDF file.

Keywords

latex, tikz, nodes, positioning, edges, circles, drawing, styles, arrows.

Source Code

PCC

\documentclass[tikz]{standalone}
\tikzset{near start abs/.style={xshift=1cm}}
 
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[node distance=1.5cm]
% place nodes
\node[circle,draw=black, fill=white, inner sep=0pt,minimum size=10pt] (r) {};
\node[circle,draw=black, fill=white, inner sep=0pt,right of=r, minimum size=10pt] (r1a) {};
\node[circle,draw=black, fill=white, inner sep=0pt,above right of=r, minimum size=10pt] (r2a) {};
\node[circle,draw=black, fill=white, inner sep=0pt,right of=r2a, minimum size=10pt] (r2b) {};
\node[circle,draw=black, fill=white, inner sep=0pt,above of=r2a, minimum size=10pt] (r3a) {};
\node[circle,draw=black, fill=white, inner sep=0pt,right of=r3a, minimum size=10pt] (r3b) {};
\node[circle,draw=black, fill=white, inner sep=0pt,above right of=r3a, minimum size=10pt] (r4a) {};
\draw (r) -- node[above] {\small{1}} ++(r1a);
\draw (r) -- node[above] {\small{2}} ++(r2a);
\draw[->,thick] (r3a) -- node[above] {\small{3}} ++(r);
\draw (r2a) -- node[above] {\small{1}} ++(r2b);
\draw[<-,thick] (r3a) -- node[above] {\small{1}} ++(r3b);
\draw[<-,thick] (r3a) -- node[above] {\small{2}} ++(r4a);
\end{tikzpicture}
\end{document}
Deploy to Overleaf