2

I have the following Layered Graph Plot:

titles = {"Medical & Health Services Managers", "Registered Nurses", 
   "Physical Therapist Assistants", "Respiratory Therapists", 
   "Dental Hygienists", "Emergency Medical Technicians & Paramedics", 
   "Medical Records & Health Information Technicians", 
   "Licensed Practical & Licensed Vocational Nurses", 
   "Medical Assistants", "Radiologic Technologists", 
   "Pharmacy Technicians", 
   "Cardiovascular Technologists & Technicians", "Dental Assistants", 
   "Nursing Assistants", "Home Health Aides", "Medical Secretaries", 
   "Personal Care Aides"};

LayeredGraphPlot[{1 -> 1, 2 -> 1, 2 -> 3, 3 -> 2, 3 -> 1, 3 -> 4, 
  4 -> 3, 4 -> 1, 4 -> 5, 5 -> 4, 5 -> 1, 5 -> 6, 6 -> 5, 6 -> 1, 
  7 -> 1, 6 -> 7, 7 -> 6, 8 -> 2, 8 -> 3, 8 -> 4, 8 -> 5, 8 -> 6, 
  8 -> 7, 8 -> 9, 9 -> 8, 9 -> 2, 9 -> 3, 9 -> 4, 9 -> 5, 9 -> 6, 
  9 -> 7, 9 -> 10, 10 -> 9, 10 -> 2, 10 -> 3, 10 -> 4, 10 -> 5, 
  10 -> 6, 10 -> 7, 10 -> 11, 11 -> 10, 11 -> 2, 11 -> 3, 11 -> 4, 
  11 -> 5, 11 -> 6, 11 -> 7, 11 -> 12, 12 -> 11, 12 -> 2, 12 -> 3, 
  12 -> 4, 12 -> 5, 12 -> 6, 12 -> 7, 12 -> 13, 13 -> 12, 13 -> 2, 
  13 -> 3, 13 -> 4, 13 -> 5, 13 -> 6, 13 -> 7, 13 -> 14, 14 -> 13, 
  14 -> 2, 14 -> 3, 14 -> 4, 14 -> 5, 14 -> 6, 14 -> 7, 14 -> 15, 
  15 -> 14, 15 -> 2, 15 -> 3, 15 -> 4, 15 -> 5, 15 -> 6, 15 -> 7, 
  15 -> 16, 16 -> 15, 16 -> 2, 16 -> 3, 16 -> 4, 16 -> 5, 16 -> 6, 
  16 -> 7, 16 -> 17, 17 -> 16, 17 -> 2, 17 -> 3, 17 -> 4, 17 -> 5, 
  17 -> 6, 17 -> 7}, 
 VertexCoordinateRules -> {{20, 39}, {10, 23}, {14, 23}, {18, 
    23}, {22, 23}, {26, 23}, {30, 23}, {2, 7}, {6, 7}, {10, 7}, {14, 
    7}, {18, 7}, {22, 7}, {26, 7}, {30, 7}, {34, 7}, {38, 7}}, 
 VertexRenderingFunction -> (Text[
     Style[titles[[#2]], Background -> White]~
      Rotate~(-30 \[Degree]), #] &), ImageSize -> 1600]

How can I suppress the edge (i.e.; the loop) associated with the first vertex (i.e.; the vertex with vertex label = "Medical & Health Services Managers")?

Thank you.

Kuba
  • 136,707
  • 13
  • 279
  • 740

1 Answers1

3

As bill says, you need to remove the 1->1 edge to get rid of the loop, but this ruins the ordering of the vertices. One workaround is to explicitly provide the list of vertices to Graph and then feed that result into LayeredGraphPlot:

LayeredGraphPlot[
 Graph[Range[17], {2 -> 1, 2 -> 3, 3 -> 2, 3 -> 1, 
   3 -> 4, 4 -> 3, 4 -> 1, 4 -> 5, 5 -> 4, 5 -> 1, 5 -> 6, 6 -> 5, 
   6 -> 1, 7 -> 1, 6 -> 7, 7 -> 6, 8 -> 2, 8 -> 3, 8 -> 4, 8 -> 5, 
   8 -> 6, 8 -> 7, 8 -> 9, 9 -> 8, 9 -> 2, 9 -> 3, 9 -> 4, 9 -> 5, 
   9 -> 6, 9 -> 7, 9 -> 10, 10 -> 9, 10 -> 2, 10 -> 3, 10 -> 4, 
   10 -> 5, 10 -> 6, 10 -> 7, 10 -> 11, 11 -> 10, 11 -> 2, 11 -> 3, 
   11 -> 4, 11 -> 5, 11 -> 6, 11 -> 7, 11 -> 12, 12 -> 11, 12 -> 2, 
   12 -> 3, 12 -> 4, 12 -> 5, 12 -> 6, 12 -> 7, 12 -> 13, 13 -> 12, 
   13 -> 2, 13 -> 3, 13 -> 4, 13 -> 5, 13 -> 6, 13 -> 7, 13 -> 14, 
   14 -> 13, 14 -> 2, 14 -> 3, 14 -> 4, 14 -> 5, 14 -> 6, 14 -> 7, 
   14 -> 15, 15 -> 14, 15 -> 2, 15 -> 3, 15 -> 4, 15 -> 5, 15 -> 6, 
   15 -> 7, 15 -> 16, 16 -> 15, 16 -> 2, 16 -> 3, 16 -> 4, 16 -> 5, 
   16 -> 6, 16 -> 7, 16 -> 17, 17 -> 16, 17 -> 2, 17 -> 3, 17 -> 4, 
   17 -> 5, 17 -> 6, 17 -> 7}], 
 VertexCoordinateRules -> {{20, 39}, {10, 23}, {14, 23}, {18, 
    23}, {22, 23}, {26, 23}, {30, 23}, {2, 7}, {6, 7}, {10, 7}, {14, 
    7}, {18, 7}, {22, 7}, {26, 7}, {30, 7}, {34, 7}, {38, 7}}, 
 VertexRenderingFunction -> (Text[
     Style[titles[[#2]], Background -> White]~
      Rotate~(-30 °), #] &), ImageSize -> 1600]

Mathematica graphics

Jason B.
  • 68,381
  • 3
  • 139
  • 286
  • That works! I didn't know that Graph[ ] and LayeredGraphPlot[ ] can be combined in such manner. Thank you! – Gilmar Rodriguez Pierluissi Aug 11 '16 at 20:48
  • 1
    @GilmarRodriguezPierluissi Glad to help! I notice that you've asked a few questions here, and have gotten some good answers, like this, this, and the two answers here. If you find an answer helpful, you can show appreciation by upvoting it with the arrow just to the left of the answer. And if it solves your problem, go ahead and mark the question as solved with the little check mark. – Jason B. Aug 11 '16 at 20:52