# graph drawing peculiarities

Consider the following graph: vertices are integers between $1$ and $n,$ where $a$ is connected to $b$ if $a$ divides $b.$ This is easily constructed in Mathematica thus:

divGraph[n_] :=
With[{pairs = Subsets[Range[n], {2}]},
With[{divis = Select[pairs, Mod[#[[2]], #[[1]]] == 0 &]},
Graph[Apply[Rule, #] & /@ divis, VertexLabels -> "Name"]]]


OK, let's now look at divGraph[8]:

You will notice that you cannot see the edge connecting $1$ to every other vertex, though we all know there should be such an edge. Is this a bug? Can it be worked around?

PS: If you are curious about why one might want to look at such a thing, see this MO question.

• Which edge is missing (besides 1$\to$1)? Commented Sep 12, 2017 at 23:45
• Yeah.... What's the problem? Commented Sep 13, 2017 at 0:45
• an alternative way to define divGraph : divGraph[n_] := RelationGraph[UnsameQ @ ## && Divisible[#2, #]&, Range @ n]
– kglr
Commented Sep 13, 2017 at 1:28

I'm not sure what edges you're having trouble seeing.

To highlight the edges connecting 1 to everyone else you can use Highlight.

divGraph[8]~ HighlightGraph ~ (1 -> # & /@ Range[2, 8])


Maybe you'll like the layout better of:

Graph[divGraph[8], GraphLayout -> "RadialDrawing"] //
HighlightGraph[#, 1 -> # & /@ Range[2, 8]] &


• Hmm. Perhaps temporary blindness, but on the other hand, the radial drawing looks way better, so I am glad I asked! Commented Sep 13, 2017 at 0:58