# how can I draw a functional graph in tikz?

Let X is a finite set and $f:X \rightarrow X$ is a function. how can i draw the graph with vertex V=X and edges (x,f(x)) with x in V?

• Welcome to TeX-sx! Please show us what you've tried so far: particularly for those who are not mathematicians that would be helpful. – Joseph Wright Dec 22 '14 at 9:50
• I draw only simple graphs in tikz!!! – mina Dec 22 '14 at 10:57
• tikz is a good tool for this. What have you tried so far? – Andrew Swann Dec 22 '14 at 11:19
• I don't know how big your graph is, but I would recommend the graphs library of tikz. There is the whole chapter 19 as explanation of this libarary in the manual. we can just provide more assistance with more information from your side as Joseph and Andrew already pointed out. – Dave Dec 22 '14 at 12:12
• For small X this is easy. But for large X, I want to draw it automatically.For example if $X=\{0,1,2,...,99\}$ it draws $f(x)=x^11 mod 100$. – user69399 Dec 22 '14 at 12:16

Non (La)TeX solution

Based on your question I guess that it could be a good idea to use another software to produce the graph so it would be easy to change the parameters.

For example, using Mathematica (code below) the output graph is (right click to see in original size)

The code

f[x_] := Mod[x^11, 100];
NV = 90;
V = Table[i, {i, 1, NV}]
FV = Table[f[V[[i]]], {i, 1, NV}]
EV = Table[DirectedEdge[V[[i]], FV[[i]]], {i, 1, NV}]
Graph[EV, VertexLabels -> "Name"]