0
$\begingroup$

Let $G$ be a simple undirected graph. Let the set of vertices be $V=\lbrace 1, 2, 3, 4, 5, 6, 7, 8, 9, 10\rbrace $, and let the edges set be $E=\lbrace (a, b): a\text{ divides }b\text{ or }b\text{ divides }a;\text{ and }a\neq b~\forall a, b\in V\rbrace $.

How to draw the graph of this type?

$\endgroup$
1
  • 3
    $\begingroup$ A very similar question is answered in the documentation for RelationGraph. Here's one way to do it: RelationGraph[ Unequal[#1, #2] && (Divisible[#1, #2] || Divisible[#2, #1]) &, Range[10], VertexLabels -> "Name"] - note if you use CoprimeQ instead of both Divisibles then 1 is not handled quite the same. $\endgroup$
    – flinty
    Apr 5, 2021 at 10:15

1 Answer 1

1
$\begingroup$

Something like:

a = Tuples[Range[10], {2}];
edges = Select[a, (Mod[#[[1]], #[[2]]] == 0 && #[[1]] =!= #[[2]]) &]
Graph[edges, VertexLabels -> Automatic]

enter image description here

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.