felgut
(Peanut Butter)
November 13, 2014, 11:23am
1
Hi Wolfram community,
I guess i have a rather simple problem, but I really have problems to solve it. I have (directed) Graph with about 60 vertices and 3000 edges.
To make the graph a little more “handsome” I would like to have edges with a little space between the head of the edges and the vertices and with tiny arrowheads (at the end of an edge) .
I found something to fix the spacing problem on the documentation center, but I can’t find a direct way to size the arrowheads down using EdgeStyle or EdgeStyleFunction. Subsequent an example picture of my network.
dreiss
(David Reiss)
November 13, 2014, 7:44pm
2
In
there is this example of varying the size of the arrow heads for directed graphs. Could this be what you are looking for?
Table[
GraphPlot[{1 -> 6, 2 -> 6, 3 -> 6, 4 -> 6, 5 -> 6}, ImageSize -> 100,
DirectedEdges -> {True, "ArrowheadsSize" -> asize},
VertexLabeling -> True], {asize, {0.05, 0.1, 0.15}}]
It would be very useful if you edit your post add code - in the body of post or as an attachment.
felgut
(Peanut Butter)
November 14, 2014, 12:20pm
4
@ David, thanks for the hint. I allready saw that, but i would rather work with an Graph object (if that’s possible).
@ Sam, yes that would make sense, my code looks like this:
example = RandomGraph[{50, 500}, DirectedEdges -> True,
EdgeStyle -> Gray,
GraphLayout -> Automatic,
VertexLabels -> Table[i -> Placed[i, Center], {i, 50}]]
Vitaliyk
(Vitaliy Kaurov)
November 14, 2014, 4:48pm
5
Use EdgeShapeFunction . Built in shapes:
RandomGraph[{50, 500},
DirectedEdges -> True,
EdgeStyle -> Directive[Opacity[.3], Black],
GraphLayout -> Automatic,
VertexLabels -> Placed["Name", Center],
VertexSize -> .3,
EdgeShapeFunction -> GraphElementData[{"HalfFilledArrow", "ArrowSize" -> .02}],
ImageSize -> 800]
Custom shapes:
ef[pts_List, e_] := Block[
{size = .02,
offset = .9},
{Arrowheads[{{size, offset}}], Arrow[pts]}]
RandomGraph[{50, 500},
DirectedEdges -> True,
EdgeStyle -> Directive[Opacity[.3], Black],
GraphLayout -> Automatic,
VertexLabels -> Placed["Name", Center],
VertexSize -> .3,
EdgeShapeFunction -> ef,
ImageSize -> 800]
felgut
(Peanut Butter)
December 17, 2014, 9:44am
6
Comes a little late, but thank you that was exactly what i was looking for!
jaebum
(Jaebum Jung)
December 17, 2014, 3:24pm
7
Or you can specify Arrowheads in EdgeStyle options:
RandomGraph[{50, 500}, DirectedEdges -> True,
EdgeStyle -> Directive[Arrowheads[.01], Opacity[.3], Black],
GraphLayout -> Automatic, VertexLabels -> Placed["Name", Center],
VertexSize -> .3, ImageSize -> 800]