3
$\begingroup$

I have a graph with 189 vertices, more than 10,000 edges and 20 cliques. As one can imagine, this graph is a mess when trying to display it. I'd really like to display the graph, separated into cliques.

I can find the cliques easy enough, but I'm lost when it comes to displaying. I've played around with GraphicsRow, but I then lose the edges between cliques. I also have seen the VertexCoordinateRules option in GraphPlot, but the idea of explicitly setting each vertex coordinate makes me nauseous.

Any help would be greatly appreciated.

$\endgroup$
4
  • $\begingroup$ Are your cliques disjoint, that is, no vertex belongs in more than one clique? Also, it would be nice if you could provide some example data. $\endgroup$
    – user484
    Nov 16 '14 at 9:16
  • $\begingroup$ Instead of separating the cliques physically, have you considered colouring them using HighlightGraph, like in the example for FindGraphPartition? $\endgroup$
    – user484
    Nov 16 '14 at 9:20
  • $\begingroup$ No, the cliques are not disjoint. $\endgroup$
    – shellhead
    Nov 16 '14 at 10:05
  • $\begingroup$ Sorry, hit enter too quickly. I haven't considered the HighlightGraph, it looks interesting, thank you for pointing it out. However, I wanted to separate the cliques so it was easier to visualize. Even highlighting the edges wouldn't make it much easier to read. $\endgroup$
    – shellhead
    Nov 16 '14 at 10:12
5
$\begingroup$

If you have V9 or V10, you can try CommunityGraphPlot:

g = ExampleData[{"NetworkGraph", "ZacharyKarateClub"}]

enter image description here

cliques = FindClique[g, Infinity, All]
(* {{2, 1, 3, 4, 14}, {2, 1, 3, 4, 8}, {24, 30, 33, 34}, {9, 31, 33,  34}, 
    {26, 25, 32}, {6, 7, 17}, {3, 9, 33}, {1, 4, 13}, {1, 3, 9}, {1, 6, 11}, 
    {1, 6, 7}, {1, 5, 11}, {1, 5, 7}, {2, 1, 22}, {2, 1, 20}, {2, 1, 18},
    {30, 27, 34}, {29, 32, 34}, {24, 28, 34}, {33, 23, 34}, {33, 21, 34}, 
    {33, 19, 34}, {33, 16, 34}, {33, 15, 34}, {32, 33, 34}, {25, 28}, {26, 24}, 
    {3, 29}, {3, 28}, {3, 10}, {1, 32}, {1, 12}, {2, 31}, {20, 34}, {14, 34}, {10, 34}} *)

CommunityGraphPlot[g, cliques, Method -> "Hierarchical", 
 CommunityRegionStyle -> Opacity[.1], 
 PlotLegends -> (Row[#, ","] & /@ cliques), ImageSize -> 500]

enter image description here

$\endgroup$
2
  • $\begingroup$ This does help visualize the cliques a bit better. Plus, I haven't seen the PlotLegends before, this will help. Thanks! $\endgroup$
    – shellhead
    Nov 16 '14 at 22:16
  • $\begingroup$ @shellhead, my pleasure. Thank you for the accept. $\endgroup$
    – kglr
    Nov 16 '14 at 22:27

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.