I was reading a paper by Holten and van Wijk called "A User Study on Visualizing Directed Edges in Graphs". They show a number of graphical alternatives to using arrowheads:

I find the final one (f), that replaces the arrowheads with coneheads, particularly appealing, and would like to try using them. It appears there is no built in conehead functionality, and I was wondering if there is an easy way to do this.

Graphics[Arrow[{{1, 0}, {2, 1}}]]


My first thought was to replace the line with a cone:

Graphics3D[Cone[{{1, 0, 0}, {2, 1, 0}}, 0.05], Boxed -> False]


This works to some extent, but is a 3D command instead of 2D, and it was not obvious how to modify it to work with Graphics instead of Graphics3D. My second though was to use a Polygon:

conehead[{{a1_, b1_}, {a2_, b2_}}, r_] :=
Graphics[Polygon[{{a1, b1}, {a2, b2 - r}, {a2, b2 + r}}]];


This also works to some extent, but has several problems: the end of the cone isn't at the right angle, it doesn't work for many a's and b's, and there is no shading from transparent to dark.

So my question is: is there a straightforward way to replace arrowheads with coneheads?

• I realize this point is tangential to the focus of the question, but I most dislike style f) because it is the only one that implies three dimensions when no such implication is appropriate. In fact, the implied depth is inconsistent, and hence very visually confusing. As such, it is the most misleading, in my opinion. Commented Aug 18, 2018 at 18:29
• @David G. Stork -- According to Holten and van Wijk, subjects can extract information about connectedness more quickly and more accurately from (f) than from the others. They do not talk about the pseudo 3D effect of the tapered ends, but maybe this is why it is easier -- the eye has a third dimension in which to help organize the clutter. Commented Aug 18, 2018 at 19:32

conehead[r_][{p1_, ___, p2_}, ___] := With[
{n = Normalize[{{0, 1}, {-1, 0}}.(p2 - p1)]},
Polygon[{p1 - r n, p1 + r n, p2}]
]


Used in a graph:

RandomGraph[
{20, 40},
EdgeStyle -> Directive[Black, [email protected]]
]


StreamStyle glyph "Pointer" can be made to look the same as the desired shape, so we can use

f[w_: .05][pts_,___] := GraphicsGlyphsGlyphData["Pointer", GlyphWidth -> w,
GlyphControlFunction -> (1 - #&), PlotPoints -> 300][BezierCurve @ pts]


to generate the desired Graphics primitive:

Graphics[{Red,f[][{{1, 0}, {3, 1}}]}]


We can use it as EdgeShapeFunction in Graph:

SeedRandom[1]
RandomGraph[{20, 40}, EdgeShapeFunction -> f[], VertexSize -> .3,
EdgeStyle -> Directive[Opacity[.5], Black], ImageSize -> 500]


Curved edges are also handled:

SeedRandom[1]
RandomGraph[{20, 40}, EdgeShapeFunction -> f[.15],
GraphLayout -> "LayeredDigraphEmbedding",
VertexSize -> .3, EdgeStyle -> Directive[Opacity[.5], Black], ImageSize -> 500]


We can compose the pointer glyph with the built-in edge shape function "CurvedArc" to change straight lines into curved arcs:

ClearAll[f2]
f2[w_: .2, curve_: .5] := GraphicsGlyphsGlyphData["Pointer", GlyphWidth -> w][
GraphElementData[{"CurvedArc", "Curvature" -> curve}][##]] &;


Examples:

SeedRandom[1]
RandomGraph[{20, 40}, EdgeShapeFunction -> f2[], VertexSize -> .3,
EdgeStyle -> Directive[Opacity[.5], Black], ImageSize -> 500]


SeedRandom[1]
RandomGraph[{20, 40}, EdgeShapeFunction -> f2[.5], VertexSize -> .3,
EdgeStyle -> Directive[Opacity[.5], Black], ImageSize -> 500,
GraphLayout -> "LayeredDigraphEmbedding"]


Use EdgeShapeFunction -> f2[.5, 0] to keep the straight edges straight:

• There is an error in one of @kglr's posted functions. The function glyph2 contains the expression GraphicsGlyphsGlyphData[glyph, GlyphWidth -> w] which should instead be GraphicsGlyphsGlyphData[g, GlyphWidth -> w] Commented Aug 27, 2018 at 23:33

### "TaperedArrow" and "TaperedInverseArrow"

It turns out there are two built-in edge shape functions ("TaperedArrow" and "TaperedInverseArrow") that give the desired result. They come with two options:

GraphElementData["TaperedArrow", "Options"]


{"Width" -> Automatic, "Gradient" -> True}

Examples:

Row[Labeled[Graphics[
GraphElementData[{#, "Width" -> .1}][{{0, 0}, {3, 1}}, None],
ImageSize -> 300], #, Top] & /@
{"TaperedArrow", "TaperedInverseArrow"}]


With curves "Gradient" option has no effect (we don't get varying opacity along the curve):

Row[Labeled[Graphics[
GraphElementData[{#, "Width" -> .1}][{{0, 0}, {0,
0}, {2, -1}, {3, 1}, {3, 1}}, None], ImageSize -> 300], #, Top] & /@
{"TaperedArrow", "TaperedInverseArrow"}]


SeedRandom[1]
RandomGraph[{20, 40}, EdgeShapeFunction -> "TaperedArrow",
EdgeStyle -> Red, ImageSize -> Large]


Use EdgeShapeFunction -> GraphElementData[{"TaperedArrow", "Width" -> .1}] to get

Use EdgeShapeFunction -> GraphElementData[{"TaperedArrow", "Width" -> .05, "Gradient" -> False}] to get

Related function "TaperedInverseArrow" reverses the direction:

SeedRandom[1]
RandomGraph[{20, 40},
EdgeShapeFunction ->  GraphElementData[{"TaperedInverseArrow", "Width" -> .1}],
EdgeStyle -> Red, ImageSize -> Large]