DOT Layout Forcing Graph Into 2 Levels Only

Hello all!

I am developing a little application to render electrical circuits as graphs so the user can easily visualize the networks. That said, I am having a little bit of an issue while rendering the following .dot file using the DOT layout.

(The following file was simplified. I removed all the styling to keep things simple. The error is the same with or without styling)

graph G {
  1 ;
  2 ;
  3 ;
  4 ;
  5 ;
  6 ;
  7 ;
  8 ;
  9 ;
  10 ;
  11 ;
  12 ;
  13 ;
  14 ;
  15 ;
  16 ;
  17 ;
  18 ;
  19 ;
  20 ;
  21 ;
  22 ;
  23 ;
  24 ;
  25 ;
  26 ;
  27 ;
  28 ;
  29 ;
  30 ;
  31 ;
  32 ;
  33 ;
  34 ;
  35 ;
  36 ;
  37 ;
  38 ;
  39 ;
  40 ;
  41 ;
  42 ;
  43 ;
  44 ;
  45 ;
  46 ;
  47 ;
  48 ;
  49 ;
  50 ;
  51 ;
  52 ;
  1 -- 2 ;
  3 -- 2 ;
  4 -- 2 ;
  5 -- 2 ;
  4 -- 6 ;
  7 -- 6 ;
  7 -- 8 ;
  9 -- 8 ;
  9 -- 10 ;
  11 -- 10 ;
  12 -- 10 ;
  12 -- 13 ;
  11 -- 14 ;
  15 -- 14 ;
  16 -- 14 ;
  17 -- 14 ;
  18 -- 14 ;
  17 -- 19 ;
  20 -- 19 ;
  20 -- 21 ;
  22 -- 21 ;
  23 -- 21 ;
  24 -- 21 ;
  25 -- 21 ;
  26 -- 21 ;
  26 -- 27 ;
  28 -- 27 ;
  28 -- 29 ;
  25 -- 30 ;
  31 -- 30 ;
  32 -- 30 ;
  32 -- 33 ;
  31 -- 34 ;
  35 -- 34 ;
  35 -- 36 ;
  37 -- 36 ;
  37 -- 38 ;
  24 -- 39 ;
  40 -- 39 ;
  40 -- 41 ;
  23 -- 42 ;
  43 -- 42 ;
  43 -- 44 ;
  22 -- 45 ;
  46 -- 45 ;
  46 -- 47 ;
  16 -- 48 ;
  15 -- 49 ;
  50 -- 49 ;
  50 -- 51 ;
  3 -- 52 ;
}

For some reason, the final rendered image looks like this:
graphviz

As you might see, something is causing the graph to be only 2 levels with many edges crossing. How could I prevent those edges from crossing?

Answered on stackoverflow - use neato or twopi and set size=“8,10”

I just saw your answer there. Thank you very much!

For those facing the same issue, here is the link for the answer.