I have this graph:
I would like to add nodes for specifying weights to some arrows and undirected edges. Edge (A)(r) should have capacity = \infty
, and some undirected edges should have some numbers associated to their nodes.
I coded the edges by separating undirected arrows (using (n1) edge (n2)
notation for undirected edges, and using \draw [->]
for directed edges). The problem with this is that, for arrows, I can't change the code into something like (n1) edge node[MyStyle]{T} (n2)
, and I can't write it in the undirected edge set, because this would draw two separate edges between the same nodes.
How could I tweak this code in a simple way, to obtain what I want?
\documentclass{article}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{setspace}
\begin{document}
\begin{center}
\begin{tikzpicture}
[scale=1.2,auto=left, every node/.style={ circle, fill=blue!20, minimum size=2.5mm, inner sep=2pt}
]
\tikzset{My Style/.style={scale=0.8, black,fill=white,opacity=.2,text opacity=1, minimum size=0.5cm, }}
\tikzset{>=latex}
\node [fill = white, draw = black] (n1) at (0, 4){A};
\node [rectangle] (n2) at (1, 4){r};
\node [rectangle] (n3) at (2, 5){p};
\node [rectangle] (n4) at (3.5, 5){q};
\node [rectangle] (n5) at (3.5, 3.5){s};
\node [fill = white, draw = black] (n6) at (5, 4){B};
\path
(n2) edge[bend left = 15] (n3)
(n3) edge (n4)
(n4) edge (n5)
(n2) edge[bend right = 15] (n5);
\draw [->] (n1) edge (n2) (n4) edge[bend left = 15] (n6) (n5) edge[bend right = 15] (n6);
\end{tikzpicture}
\captionof{figure}{}
\end{center}
\end{document}
THANKS