Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm wondering if anyone has implemented edge bundled graph plotting?

http://www.win.tue.nl/~dholten/papers/forcebundles_eurovis.pdf

share|improve this question
4  
While the paper is nice, can you expound upon it in your question? Links are fragile, so the more information that you add to your question, the longer they will remain relevant. –  rcollyer May 8 '12 at 0:44
    
Looks like a really intricate application of the EdgeRenderingFunction option to GraphPlot. –  Verbeia May 8 '12 at 1:27
1  
@Verbeia it looks like more than that to me. It bundles edges that go in similar directions together, increasing their relative weight, and they peal off from the bundle near their nodes. (Fig. 8 is a good one to look at to see this.) This reduces the visual complexity of network. –  rcollyer May 8 '12 at 2:03

1 Answer 1

CommunityGraphPlot has this feature implemented internally:

g = ExampleData[{"NetworkGraph", "DolphinSocialNetwork"}];
CommunityGraphPlot[g]

Mathematica graphics

The information about bundling is calculated by CommunityGraphPlot (i.e. it is not supplied with the example data), though unfortunately there are no documented options available to finetune the bundling (but see below), only the region (CommunityRegionStyle) and boundary styles (CommunityBoundaryStyle).

Though one can extract from the community graph the BezierCurve that generates the bundled edges (with low opacity EdgeStyle by default), it will contain references to vertex coordinates like DynamicLocation["VertexID$1", Automatic, Center]. Unfortunate again that due to the dynamical nature of a CommunityGraphPlot, ordinary Graph functions like VertexList or PropertyValue[{g, 1}, VertexCoordinates] will fail, so there is no easy way to extract the real vertex coordinates which otherwise could have been matched with the various "VertexID$1" references.

The method to find communities can be customized with FindGraphCommunities.

Undocumented functionality

You have to dig deep to ultimately find any bundling-related code in GraphComputation`GraphCommunitiesPlotDump`communitiesPlot. It accepts the following internal options (above default ones):

 "EdgeLayout" -> Automatic
 "CommunityEdgeWeight" -> Automatic
 "CommunityRegionFunction" -> Automatic

If "EdgeLayout" has the value "DividedEdgeBundling", the following suboptions are available to control the bundling process (with their defaults):

"CoulombConstant" -> 4.5
"VelocityDamping" -> 1
"SmoothEdge" -> True

Examining its internal usage and a bit of experimentation yielded the following results:

SetProperty[g, {GraphLayout -> {"EdgeLayout" -> {"DividedEdgeBundling",
      "CoulombConstant" -> 5, "VelocityDamping" -> .6, "SmoothEdge" -> True},
    "VertexLayout" -> {Automatic}}}]

Mathematica graphics

SetProperty[g, {GraphLayout -> {"EdgeLayout" -> {"DividedEdgeBundling", 
      "CoulombConstant" -> 100, "VelocityDamping" -> .5, "SmoothEdge" -> False}}}]

Mathematica graphics

SetProperty[g, {
  GraphLayout -> {"EdgeLayout" -> {"DividedEdgeBundling", 
      "CoulombConstant" -> 44, "VelocityDamping" -> .87, "SmoothEdge" -> False}}}]

Mathematica graphics

SetProperty[g, {
  GraphLayout -> {"EdgeLayout" -> {"DividedEdgeBundling", 
      "CoulombConstant" -> 100, "VelocityDamping" -> .5, "SmoothEdge" -> False},
    "VertexLayout" -> {"SpringEmbedding", "EdgeWeighted" -> True,
       "Multilevel" -> False}}}]

Mathematica graphics

For larger graphs it really helps to use transparent edges:

sm = SocialMediaData["Facebook", "FriendNetwork"];
{
 SetProperty[sm, {ImageSize -> 300, GraphLayout -> {"EdgeLayout" -> None}}],
 SetProperty[sm,
  {ImageSize -> 300, EdgeStyle -> Opacity@.1,
   GraphLayout -> {"EdgeLayout" -> {"DividedEdgeBundling", 
       "CoulombConstant" -> 500, "VelocityDamping" -> .5, "SmoothEdge" -> False}}}]
 }

Mathematica graphics

share|improve this answer
    
Unfortunately this doesn't work in M10, I don't quite have enough time to spelunk what's changed but I'll come back if possible soon with a comment - your bio say's your on M9 still –  Martin John Hadley Jul 21 at 9:37
    
@Martin I'm on v10 now and it still works exactly the same way (though it generates slightly different graphs for the last example due to changes in my Facebook account). Could you please specify where the discrepancy is at your end? –  István Zachar Jul 21 at 11:34
    
I get this i.imgur.com/dLq6XPa.png in a clean kernel, which is slightly odd. –  Martin John Hadley Jul 21 at 13:06
    
@Martin It seems like something is set prior to plotting with e.g. SetOptions[Graph, ...] or similar. You're missing vertex shapes as well. Is this the result when you start with a fresh kernel? –  István Zachar Jul 21 at 13:29
    
even with a fresh kernel I get this. This is very strange, I'll look into it - thanks for replying. –  Martin John Hadley Jul 21 at 15:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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