0
$\begingroup$

Is there a way to avoid the edges and vertices 'overlapping' in a graph with custom styling? That is, the edges should stop once they reach the 'border' of the shape representing the vertex (in this case, an ellipse). Here's what I get now:

Bad Graph

And here is how I called Graph (here transitionRules represents a list of rules):

Graph[transitionRules, 

  VertexLabels -> Table[i[[1]] -> Placed[Style[i[[1]], Bold, 10], Center], {i,transitionRules}],
  VertexSize ->Table[Which[i[[2]] >= 1.6, i[[1]] -> 1.6,  i[[2]] <= 0.6,i[[1]] -> 0.6, True, i], {i, nOfCases}],
  GraphLayout -> "RadialEmbedding",
  EdgeStyle -> Join[Table[(transitionRules[[i]]) -> Thickness[weights[[i]]], {i, Length@transitionRules}], {Opacity[0.5, Blue]}],
  VertexShape ->Graphics[{ Opacity[0.6, Hue[0.53, 0.27, 1]], EdgeForm[Blue],Ellipsoid[{0, 0}, {8, 4}]}]]
 ]

Here is the data in transitionRules:

{"C-M" -> "D-Dom7", "D-Dom7" -> "G-Dom7", "G-Dom7" -> "C-M", 
 "C-M" -> "A-m", "A-m" -> "D-Dom7", "D-Dom7" -> "G-M", 
 "G-M" -> "C-M7M", "C-M7M" -> "A-Dom7", "A-Dom7" -> "D-Dom7", 
 "G-M" -> "E-d7d", "E-d7d" -> "D-m", "D-m" -> "D-d7d", 
 "D-d7d" -> "C-M", "C-M" -> "F-M7M", "F-M7M" -> "D-Dom7", 
 "C-M" -> "C-Dom7", "C-Dom7" -> "F-M7M", "F-M7M" -> "F#/G\[Flat]-d7d",
  "F#/G\[Flat]-d7d" -> "C-m7M", "C-m7M" -> "F-d7d", 
 "F-d7d" -> "G-Dom7", "C-M" -> "G-Dom7", "G-Dom7" -> "C-d7d", 
 "C-d7d" -> "C-M", "G-Dom7" -> "C-Dom7", "C-Dom7" -> "F-M", 
 "F-M" -> "D-Dom7"}
$\endgroup$
  • 2
    $\begingroup$ try PerformanceGoal->"Quality"? and please provide the data for transitionRules; without it, it is more difficult for people to answer your question. $\endgroup$ – kglr Jul 10 '18 at 2:16
1
$\begingroup$

You better use VertexShapeFunction than VertexShape option for this and set PerformanceGoal -> "Quality". Also you might need to tweak VertexSize computation:

Graph[transitionRules, 
 VertexLabels -> 
  Table[i[[1]] -> Placed[Style[i[[1]], Bold, 10], Center], {i, 
    transitionRules}], 
 VertexSize -> 
  Thread[nOfCases[[All, 1]] -> 
    Rescale[nOfCases[[All, 2]], 
     MinMax[nOfCases[[All, 2]]], {0.3, 0.6}]], 
 GraphLayout -> "RadialEmbedding", 
 EdgeStyle -> 
  Join[Table[(transitionRules[[i]]) -> Thickness[weights[[i]]], {i, 
     Length@transitionRules}], {Opacity[0.5, Blue]}],
 VertexStyle -> 
  Directive[Opacity[0.6, Hue[0.53, 0.27, 1]], EdgeForm[Blue]], 
 VertexShapeFunction -> (Ellipsoid[#1, {2, 1} #3] &), 
 PerformanceGoal -> "Quality"]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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