2

I currently try to make following graph more readable:

layers = {1, 2, 3, 5, 1, 4, 1};
vertices = {17, 11, 12, 14, 15, 16, 6, 7, 8, 9, 10, 13, 2, 3, 4, 5, 1};
edges = {1 -> 1, 2 -> 1, 2 -> 2, 3 -> 3, 3 -> 4, 3 -> 5, 3 -> 1, 
   4 -> 4, 4 -> 1, 5 -> 5, 5 -> 4, 5 -> 3, 5 -> 1, 6 -> 6, 6 -> 7, 
   6 -> 9, 6 -> 3, 6 -> 2, 7 -> 7, 7 -> 8, 7 -> 4, 7 -> 3, 7 -> 2, 
   8 -> 8, 8 -> 4, 8 -> 2, 9 -> 9, 9 -> 8, 9 -> 7, 9 -> 6, 9 -> 5, 
   9 -> 2, 10 -> 10, 10 -> 2, 11 -> 11, 11 -> 12, 11 -> 10, 11 -> 9, 
   11 -> 6, 12 -> 12, 12 -> 10, 12 -> 8, 12 -> 9, 13 -> 13, 13 -> 1, 
   14 -> 14, 14 -> 15, 14 -> 13, 14 -> 5, 15 -> 15, 15 -> 14, 
   15 -> 13, 15 -> 5, 16 -> 16, 16 -> 13, 16 -> 2, 17 -> 17, 17 -> 16,
    17 -> 15, 17 -> 14, 17 -> 9};
g = Graph[vertices, edges,
    EdgeLabels -> {
    (* Loops *)
    (1  -> 1)  -> Placed[ "E1", 0.5],
    (2  -> 2)  -> Placed[ "E3", 0.5],
    (3  -> 3)  -> Placed[ "E5", 0.5],
    (4  -> 4)  -> Placed[ "E9", 0.5],
    (5  -> 5)  -> Placed[ "E13", 0.5],
    (6  -> 6)  -> Placed[ "E16", 0.5],
    (7  -> 7)  -> Placed[ "E22", 0.5],
    (8  -> 8)  -> Placed[ "E26", 0.5],
    (9  -> 9)  -> Placed[ "E32", 0.5],
    (10 -> 10) -> Placed[ "E33", 0.5],
    (11 -> 11) -> Placed[ "E36", 0.5],
    (12 -> 12) -> Placed[ "E41", 0.5],
    (13 -> 13) -> Placed[ "E45", 0.5],
    (14 -> 14) -> Placed[ "E47", 0.5],
    (15 -> 15) -> Placed[ "E52", 0.5],
    (16 -> 16) -> Placed[ "E55", 0.5],
    (17 -> 17) -> Placed[ "E60", 0.5],
    (* Non-loops *)
    (2  -> 1)  -> Placed[ "E2", 0.4],
    (3  -> 1)  -> Placed[ "E4", 0.4],
    (3  -> 4)  -> Placed[ "E6", 0.4],
    (3  -> 5)  -> Placed[ "E7", 0.4],
    (4  -> 1)  -> Placed[ "E8", 0.4],
    (5  -> 1)  -> Placed[ "E10", 0.4],
    (5  -> 3)  -> Placed[ "E11", 0.4],
    (5  -> 4)  -> Placed[ "E12", 0.4],
    (6  -> 2)  -> Placed[ "E14", 0.4],
    (6  -> 3)  -> Placed[ "E15", 0.4],
    (6  -> 7)  -> Placed[ "E17", 0.4],
    (6  -> 9)  -> Placed[ "E18", 0.4],
    (7  -> 2)  -> Placed[ "E19", 0.4],
    (7  -> 3)  -> Placed[ "E20", 0.4],
    (7  -> 4)  -> Placed[ "E21", 0.4],
    (7  -> 8)  -> Placed[ "E23", 0.4],
    (8  -> 2)  -> Placed[ "E24", 0.4],
    (8  -> 4)  -> Placed[ "E25", 0.4],
    (9  -> 2)  -> Placed[ "E27", 0.4],
    (9  -> 5)  -> Placed[ "E28", 0.4],
    (9  -> 6)  -> Placed[ "E29", 0.4],
    (9  -> 7)  -> Placed[ "E30", 0.4],
    (9  -> 8)  -> Placed[ "E31", 0.4],
    (10 -> 2)  -> Placed[ "E34", 0.4],
    (11 -> 10) -> Placed[ "E35", 0.4],
    (11 -> 12) -> Placed[ "E37", 0.4],
    (11 -> 6)  -> Placed[ "E38", 0.4],
    (11 -> 9)  -> Placed[ "E39", 0.4],
    (12 -> 10) -> Placed[ "E40", 0.4],
    (12 -> 8)  -> Placed[ "E42", 0.4],
    (12 -> 9)  -> Placed[ "E43", 0.4],
    (13 -> 1)  -> Placed[ "E44", 0.4],
    (14 -> 13) -> Placed[ "E46", 0.4],
    (14 -> 15) -> Placed[ "E48", 0.4],
    (14 -> 5)  -> Placed[ "E49", 0.4],
    (15 -> 13) -> Placed[ "E50", 0.4],
    (15 -> 14) -> Placed[ "E51", 0.4],
    (15 -> 5)  -> Placed[ "E53", 0.4],
    (16 -> 13) -> Placed[ "E54", 0.4],
    (16 -> 2)  -> Placed[ "E56", 0.4],
    (17 -> 14) -> Placed[ "E57", 0.4],
    (17 -> 15) -> Placed[ "E58", 0.4],
    (17 -> 16) -> Placed[ "E59", 0.4],
    (17 -> 9)  -> Placed[ "E61" 0.4]
    },
   VertexLabels -> 
    MapIndexed[#2[[1]] -> Placed[#1, Center] &, {"V1", "V2", "V3", "V4", "V5", "V6", 
      "V7", "V8", "V9", "V10", "V11", "V12", "V13", "V14", "V15", "V16", "V17"}],
   GraphLayout -> {"MultipartiteEmbedding", "VertexPartition" -> layers},
   EdgeStyle -> Black, EdgeLabelStyle -> Directive[Background -> White], 
   VertexShapeFunction -> "Circle", VertexSize -> .5, VertexStyle -> White,
   ImageSize -> {800, 800}];
g = SetProperty[g, 
  VertexCoordinates -> RotationTransform[-Pi/2][GraphEmbedding[g]]]

enter image description here

I have tried to reduce overlaps between loops and non-loop edges by making the graph a little bit bigger by using ScaleTransform[{10,10}] similarly to the RotationTransform. But nothing happened.

Can someone show me how to increase the distances between vertices?

Other possible changes are

Hotschke
  • 707
  • 3
  • 11
  • Is the question here "How to scale vertex coordinates?" or "How to make this graph look better?" Because the scaling the coordinates the way you mentioned works perfectly. But it doesn't change the appearance of the graph at all from what I see – Jason B. Oct 05 '18 at 15:22
  • Thanks for your interest. Well, I actually have managed to use ScaleTransform{{2,1}]. Only when I scale with {2,2} it looks like nothing happens: also the loops get bigger which I did not expect. Overall I want to improve the readability. I was thinking if I would increase the distances between the nodes, it would help. Does this clarify it a little bit? – Hotschke Oct 05 '18 at 15:25
  • Right - so the scaling transform does scale the coordinates, but the graph drawing routines just rescale all the graphics primitives anyway. So I think the question should be rephrased not to be about rescaling vertex coordinates (which is easy, but doesn't do what you want). – Jason B. Oct 05 '18 at 16:00

0 Answers0