# Draw multiple arrows from one node to many others using a palette of colors

This is a continuation of a previous question: Draw a set of arrows using a palette of colors.

## What I want

I want to draw multiple arrows starting from one node to more than one. Each arrow that starts in the same node must have the same color; but another node must have the following color (with its arrows of the same color), and so on.

You have to achieve the following in the most automatically possible way: ## What I have done

This MWE is adapted for a better manipulation of the answer to that question:

\documentclass{article}

\usepackage{tikz}

\newcommand\totalnodes{5} % Define the total of nodes-1

\begin{document}

\begin{tikzpicture} % From https://tex.stackexchange.com/a/480466/152550
\foreach \X in {0,...,\totalnodes} {
\node[circle,draw,name=a\X] at (0,\X) {};
\node[circle,draw,name=b\X] at (1,\X) {};
% [actual node] * [0.75 (limits the final color to purple)] * 1/\totalsubjects
\pgfmathsetmacro{\huenum}{\X*0.75*(1/\totalnodes)}
\definecolor{mycolor}{hsb}{\huenum,1,1}
\draw[-latex,mycolor] (a\X) to (b\X);
}
\end{tikzpicture}

\end{document} As you can see, I am not able to find an algorithm capable of adding more arrows that come from the same node.

My idea was to make a recursive algorithm that goes through some of the nodes in which I wanted to get the arrow, but I do not know how to jump from node 0 to 2 and then to 5 and so on.

For example, to start with something I tried to change \draw[-latex,mycolor] (a\X) to (b\X); to \draw[-latex,mycolor] (a\X) to (b$\X-0$); (new line) \draw[-latex,mycolor] (a\X) to (b$\X-1$); (new line) \draw[-latex,mycolor] (a\X) to (b$\X-2$); etc. but the compiler gives errors (as expected).

Thanks!!

Something like this? You specify the connections in a list. The 0th entry specifies that the 0th a node is to be connected with the b nodes 2 and 3, and so on.

\documentclass{article}

\usepackage{tikz}

\newcommand\totalnodes{5} % Define the total of nodes-1

\begin{document}

\begin{tikzpicture} % From https://tex.stackexchange.com/a/480466/152550
\def\LstCon{{"{2,3}","{1}","{2}","{2,3,4,5}","{4}","{1,4,5}"}}
\foreach \X in {0,...,\totalnodes} {
\node[circle,draw,name=a\X] at (0,\X) {};
\node[circle,draw,name=b\X] at (1,\X) {};
}
\foreach \X in {0,...,\totalnodes} {
\pgfmathsetmacro{\huenum}{\X*0.75*(1/\totalnodes)}
\definecolor{mycolor}{hsb}{\huenum,1,1}
\pgfmathsetmacro{\mylst}{\LstCon[\X]}
\foreach \Y in \mylst
{\draw[-latex,mycolor] (a\X) to (b\Y);}
}
\end{tikzpicture}

\end{document} 