# How do I change one edge in a tree graph to a double arrow?

I use the following code plot a binary tree and wants to change an edge to double arrow.

g = TreeGraph[{11 -> 23, 11 -> 24, 23 -> 40, 23 -> 39, 24 -> 30,
24 -> 50, 40 -> 55, 40 -> 45},
VertexShapeFunction -> ({EdgeForm[White],
RGBColor[113/255, 190/255, 236/255], Disk[#1, 0.2], White,
Text[#2, #1]} &)]


This plots the tree well. My question is how do I change a single edge to a double arrow, as illustrated below? It looks EdgeShapeFunction can do this, and I have tried the following without success. Thank you.

SetProperty[{g, 11 -> 23}, EdgeShapeFunction -> ("DoubleArrowheads")]


I also have tried

SetProperty[{g, (11 -> 23)}, EdgeStyle -> {Arrowheads[{-.05, .05}]}]


However, the arrows overlap with the vertex.

BTW, anyone knows how to chnage the font size in tree graph?

• Use the option EdgeStyle -> {(11 -> 23) -> Arrowheads[{-.05, .05}]},? – kglr Nov 16 '15 at 13:43
• ... or use SetProperty[{g, (11 -> 23)}, EdgeStyle -> {Arrowheads[{-.05, .05}]}]. – kglr Nov 16 '15 at 13:44
• or SetProperty[{g, (11 -> 23)}, {EdgeStyle -> {Arrowheads[{-.05, .05}]}, PerformanceGoal -> "Quality"}] – halmir Nov 16 '15 at 17:44

You could use

SetProperty[{g, (11 -> 23)}, EdgeStyle -> {Arrowheads[{{-.05, .2}, {.05, .8}}]}]


but since the offset is scaled relative to the line length, it's not possible in general to point the edge of the disk:

You can create custom EdgeShapeFunction to replace automatic:

arrow[pts : {p1_, p2_}, offset_, arrowheads_: {}] :=
With[{m = Mean[pts], w = Normalize[p2 - p1],
Arrow@{m - (n - offset) w, m + (n - offset) w}}];

g = TreeGraph[{11 -> 23, 11 -> 24, 23 -> 40, 23 -> 39, 24 -> 30,    24 -> 50, 40 -> 55, 40 -> 45},

EdgeShapeFunction -> (arrow[#, .2] &),
VertexShapeFunction -> ({EdgeForm[White],
RGBColor[113/255, 190/255, 236/255], Disk[#1, 0.2], White,
Text[#2, #1]} &)
]


and

SetProperty[{g, (11 -> 23)}, EdgeShapeFunction -> (arrow[#, .2, {-.05, .05}] &)]


• I'm curious why I had to sue EdgeShapeFunction -> (arrow[#, .2] &),  for g. If it is automatic, SetProperty results in single arrowhead added to every other edge... – Kuba Nov 16 '15 at 16:11