Skip to main content
edited body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

Update 2: Hiding the edges within the same community for general (not-necessarily tri-partite) graphs:

ClearAll[insideEdges]
insideEdges[g_, c_]:=Select[EdgeList[g], Or @@ (Function[cFunction[x, SubsetQ[cSubsetQ[x, {##}] ]/@c)& @@ #&]

Examples:

zkc = ExampleData[{"NetworkGraph", "ZacharyKarateClub"}];

CommunityGraphPlot[zkc,  CommunityRegionStyle -> {LightRed, LightGreen, LightBlue},
 EdgeStyle -> {Alternatives @@ insideEdges[zkc, FindGraphCommunities[zkc]] :> Opacity[0]}]

enter image description here

dsn= ExampleData[{"NetworkGraph", "DolphinSocialNetwork"}];

CommunityGraphPlot[dsn,  CommunityRegionStyle -> 97,
 EdgeStyle -> {Alternatives @@ insideEdges[dsn, FindGraphCommunities[dsn]] :> Opacity[0]}]

enter image description here

Update 1:

athreepartitegraph = CompleteGraph[{10, 7, 3}, 
  GraphLayout -> {"MultipartiteEmbedding",  "VertexPartition" -> {10, 7, 3}},
  ImageSize -> 400, VertexLabels -> "Name", ImagePadding -> 20];

cgp = CommunityGraphPlot[athreepartitegraph, 
       {Range[10], Range[11, 17], Range[18, 20]}, Method -> "Hierarchical"];
Row[{athreepartitegraph, cgp}] 

enter image description here

or

CommunityGraphPlot[athreepartitegraph, 
  {Range[10], Range[11, 17], Range[18, 20]}, Method -> "SpringElectrical"]

enter image description here

to compare with alternative vertex layouts:

Row[SetProperty[athreepartitegraph, 
    GraphLayout -> #] & /@ {{"CircularEmbedding"}, 
      {"CircularMultipartiteEmbedding", "VertexPartition" -> {10, 7, 3}}}]

enter image description here


Original post:

Maybe something like:

g2 = ExampleData[{"NetworkGraph", "ZacharyKarateClub"}];
g2 = SetProperty[g2, {VertexLabels -> "Name", ImagePadding -> 20, ImageSize -> 400}];

fgp = FindGraphPartition[GraphComplement[g2], 3];
mpg = Graph[Flatten@fgp, EdgeList[g2], 
   GraphLayout -> {"MultipartiteEmbedding", "VertexPartition" -> (Length /@ fgp)},
   VertexLabels -> "Name", 
   ImagePadding -> 20, ImageSize -> 400];

Row[{g2, mpg}]

enter image description here

CommunityGraphPlot[g2, fgp, Method -> "Hierarchical"]

enter image description here

Update 2: Hiding the edges within the same community for general (not-necessarily tri-partite) graphs:

ClearAll[insideEdges]
insideEdges[g_, c_]:=Select[EdgeList[g], Or @@ (Function[c, SubsetQ[c, {##}] ]/@c)& @@ #&]

Examples:

zkc = ExampleData[{"NetworkGraph", "ZacharyKarateClub"}];

CommunityGraphPlot[zkc,  CommunityRegionStyle -> {LightRed, LightGreen, LightBlue},
 EdgeStyle -> {Alternatives @@ insideEdges[zkc, FindGraphCommunities[zkc]] :> Opacity[0]}]

enter image description here

dsn= ExampleData[{"NetworkGraph", "DolphinSocialNetwork"}];

CommunityGraphPlot[dsn,  CommunityRegionStyle -> 97,
 EdgeStyle -> {Alternatives @@ insideEdges[dsn, FindGraphCommunities[dsn]] :> Opacity[0]}]

enter image description here

Update 1:

athreepartitegraph = CompleteGraph[{10, 7, 3}, 
  GraphLayout -> {"MultipartiteEmbedding",  "VertexPartition" -> {10, 7, 3}},
  ImageSize -> 400, VertexLabels -> "Name", ImagePadding -> 20];

cgp = CommunityGraphPlot[athreepartitegraph, 
       {Range[10], Range[11, 17], Range[18, 20]}, Method -> "Hierarchical"];
Row[{athreepartitegraph, cgp}] 

enter image description here

or

CommunityGraphPlot[athreepartitegraph, 
  {Range[10], Range[11, 17], Range[18, 20]}, Method -> "SpringElectrical"]

enter image description here

to compare with alternative vertex layouts:

Row[SetProperty[athreepartitegraph, 
    GraphLayout -> #] & /@ {{"CircularEmbedding"}, 
      {"CircularMultipartiteEmbedding", "VertexPartition" -> {10, 7, 3}}}]

enter image description here


Original post:

Maybe something like:

g2 = ExampleData[{"NetworkGraph", "ZacharyKarateClub"}];
g2 = SetProperty[g2, {VertexLabels -> "Name", ImagePadding -> 20, ImageSize -> 400}];

fgp = FindGraphPartition[GraphComplement[g2], 3];
mpg = Graph[Flatten@fgp, EdgeList[g2], 
   GraphLayout -> {"MultipartiteEmbedding", "VertexPartition" -> (Length /@ fgp)},
   VertexLabels -> "Name", 
   ImagePadding -> 20, ImageSize -> 400];

Row[{g2, mpg}]

enter image description here

CommunityGraphPlot[g2, fgp, Method -> "Hierarchical"]

enter image description here

Update 2: Hiding the edges within the same community for general (not-necessarily tri-partite) graphs:

ClearAll[insideEdges]
insideEdges[g_, c_]:=Select[EdgeList[g], Or @@ (Function[x, SubsetQ[x, {##}] ]/@c)& @@ #&]

Examples:

zkc = ExampleData[{"NetworkGraph", "ZacharyKarateClub"}];

CommunityGraphPlot[zkc,  CommunityRegionStyle -> {LightRed, LightGreen, LightBlue},
 EdgeStyle -> {Alternatives @@ insideEdges[zkc, FindGraphCommunities[zkc]] :> Opacity[0]}]

enter image description here

dsn= ExampleData[{"NetworkGraph", "DolphinSocialNetwork"}];

CommunityGraphPlot[dsn,  CommunityRegionStyle -> 97,
 EdgeStyle -> {Alternatives @@ insideEdges[dsn, FindGraphCommunities[dsn]] :> Opacity[0]}]

enter image description here

Update 1:

athreepartitegraph = CompleteGraph[{10, 7, 3}, 
  GraphLayout -> {"MultipartiteEmbedding",  "VertexPartition" -> {10, 7, 3}},
  ImageSize -> 400, VertexLabels -> "Name", ImagePadding -> 20];

cgp = CommunityGraphPlot[athreepartitegraph, 
       {Range[10], Range[11, 17], Range[18, 20]}, Method -> "Hierarchical"];
Row[{athreepartitegraph, cgp}] 

enter image description here

or

CommunityGraphPlot[athreepartitegraph, 
  {Range[10], Range[11, 17], Range[18, 20]}, Method -> "SpringElectrical"]

enter image description here

to compare with alternative vertex layouts:

Row[SetProperty[athreepartitegraph, 
    GraphLayout -> #] & /@ {{"CircularEmbedding"}, 
      {"CircularMultipartiteEmbedding", "VertexPartition" -> {10, 7, 3}}}]

enter image description here


Original post:

Maybe something like:

g2 = ExampleData[{"NetworkGraph", "ZacharyKarateClub"}];
g2 = SetProperty[g2, {VertexLabels -> "Name", ImagePadding -> 20, ImageSize -> 400}];

fgp = FindGraphPartition[GraphComplement[g2], 3];
mpg = Graph[Flatten@fgp, EdgeList[g2], 
   GraphLayout -> {"MultipartiteEmbedding", "VertexPartition" -> (Length /@ fgp)},
   VertexLabels -> "Name", 
   ImagePadding -> 20, ImageSize -> 400];

Row[{g2, mpg}]

enter image description here

CommunityGraphPlot[g2, fgp, Method -> "Hierarchical"]

enter image description here

edited body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

Update 2: Hiding the edges within the same community for general, not (not-necessarily tri-partite,) graphs:

ClearAll[insideEdges]
insideEdges[g_, c_]:=Select[EdgeList[g], Or @@ (Function[c, SubsetQ[c, {##}] ]/@c)& @@ #&]

Examples:

zkc = ExampleData[{"NetworkGraph", "ZacharyKarateClub"}];

CommunityGraphPlot[zkc,  CommunityRegionStyle -> {LightRed, LightGreen, LightBlue},
 EdgeStyle -> {Alternatives @@ insideEdges[zkc, FindGraphCommunities[zkc]] :> Opacity[0]}]

enter image description here

dsn= ExampleData[{"NetworkGraph", "DolphinSocialNetwork"}];

CommunityGraphPlot[dsn,  CommunityRegionStyle -> 97,
 EdgeStyle -> {Alternatives @@ insideEdges[dsn, FindGraphCommunities[dsn]] :> Opacity[0]}]

enter image description here

Update 1:

athreepartitegraph = CompleteGraph[{10, 7, 3}, 
  GraphLayout -> {"MultipartiteEmbedding",  "VertexPartition" -> {10, 7, 3}},
  ImageSize -> 400, VertexLabels -> "Name", ImagePadding -> 20];

cgp = CommunityGraphPlot[athreepartitegraph, 
       {Range[10], Range[11, 17], Range[18, 20]}, Method -> "Hierarchical"];
Row[{athreepartitegraph, cgp}] 

enter image description here

or

CommunityGraphPlot[athreepartitegraph, 
  {Range[10], Range[11, 17], Range[18, 20]}, Method -> "SpringElectrical"]

enter image description here

to compare with alternative vertex layouts:

Row[SetProperty[athreepartitegraph, 
    GraphLayout -> #] & /@ {{"CircularEmbedding"}, 
      {"CircularMultipartiteEmbedding", "VertexPartition" -> {10, 7, 3}}}]

enter image description here


Original post:

Maybe something like:

g2 = ExampleData[{"NetworkGraph", "ZacharyKarateClub"}];
g2 = SetProperty[g2, {VertexLabels -> "Name", ImagePadding -> 20, ImageSize -> 400}];

fgp = FindGraphPartition[GraphComplement[g2], 3];
mpg = Graph[Flatten@fgp, EdgeList[g2], 
   GraphLayout -> {"MultipartiteEmbedding", "VertexPartition" -> (Length /@ fgp)},
   VertexLabels -> "Name", 
   ImagePadding -> 20, ImageSize -> 400];

Row[{g2, mpg}]

enter image description here

CommunityGraphPlot[g2, fgp, Method -> "Hierarchical"]

enter image description here

Update 2: Hiding the edges within the same community for general, not-necessarily tri-partite, graphs:

ClearAll[insideEdges]
insideEdges[g_, c_]:=Select[EdgeList[g], Or @@ (Function[c, SubsetQ[c, {##}] ]/@c)& @@ #&]

Examples:

zkc = ExampleData[{"NetworkGraph", "ZacharyKarateClub"}];

CommunityGraphPlot[zkc,  CommunityRegionStyle -> {LightRed, LightGreen, LightBlue},
 EdgeStyle -> {Alternatives @@ insideEdges[zkc, FindGraphCommunities[zkc]] :> Opacity[0]}]

enter image description here

dsn= ExampleData[{"NetworkGraph", "DolphinSocialNetwork"}];

CommunityGraphPlot[dsn,  CommunityRegionStyle -> 97,
 EdgeStyle -> {Alternatives @@ insideEdges[dsn, FindGraphCommunities[dsn]] :> Opacity[0]}]

enter image description here

Update 1:

athreepartitegraph = CompleteGraph[{10, 7, 3}, 
  GraphLayout -> {"MultipartiteEmbedding",  "VertexPartition" -> {10, 7, 3}},
  ImageSize -> 400, VertexLabels -> "Name", ImagePadding -> 20];

cgp = CommunityGraphPlot[athreepartitegraph, 
       {Range[10], Range[11, 17], Range[18, 20]}, Method -> "Hierarchical"];
Row[{athreepartitegraph, cgp}] 

enter image description here

or

CommunityGraphPlot[athreepartitegraph, 
  {Range[10], Range[11, 17], Range[18, 20]}, Method -> "SpringElectrical"]

enter image description here

to compare with alternative vertex layouts:

Row[SetProperty[athreepartitegraph, 
    GraphLayout -> #] & /@ {{"CircularEmbedding"}, 
      {"CircularMultipartiteEmbedding", "VertexPartition" -> {10, 7, 3}}}]

enter image description here


Original post:

Maybe something like:

g2 = ExampleData[{"NetworkGraph", "ZacharyKarateClub"}];
g2 = SetProperty[g2, {VertexLabels -> "Name", ImagePadding -> 20, ImageSize -> 400}];

fgp = FindGraphPartition[GraphComplement[g2], 3];
mpg = Graph[Flatten@fgp, EdgeList[g2], 
   GraphLayout -> {"MultipartiteEmbedding", "VertexPartition" -> (Length /@ fgp)},
   VertexLabels -> "Name", 
   ImagePadding -> 20, ImageSize -> 400];

Row[{g2, mpg}]

enter image description here

CommunityGraphPlot[g2, fgp, Method -> "Hierarchical"]

enter image description here

Update 2: Hiding the edges within the same community for general (not-necessarily tri-partite) graphs:

ClearAll[insideEdges]
insideEdges[g_, c_]:=Select[EdgeList[g], Or @@ (Function[c, SubsetQ[c, {##}] ]/@c)& @@ #&]

Examples:

zkc = ExampleData[{"NetworkGraph", "ZacharyKarateClub"}];

CommunityGraphPlot[zkc,  CommunityRegionStyle -> {LightRed, LightGreen, LightBlue},
 EdgeStyle -> {Alternatives @@ insideEdges[zkc, FindGraphCommunities[zkc]] :> Opacity[0]}]

enter image description here

dsn= ExampleData[{"NetworkGraph", "DolphinSocialNetwork"}];

CommunityGraphPlot[dsn,  CommunityRegionStyle -> 97,
 EdgeStyle -> {Alternatives @@ insideEdges[dsn, FindGraphCommunities[dsn]] :> Opacity[0]}]

enter image description here

Update 1:

athreepartitegraph = CompleteGraph[{10, 7, 3}, 
  GraphLayout -> {"MultipartiteEmbedding",  "VertexPartition" -> {10, 7, 3}},
  ImageSize -> 400, VertexLabels -> "Name", ImagePadding -> 20];

cgp = CommunityGraphPlot[athreepartitegraph, 
       {Range[10], Range[11, 17], Range[18, 20]}, Method -> "Hierarchical"];
Row[{athreepartitegraph, cgp}] 

enter image description here

or

CommunityGraphPlot[athreepartitegraph, 
  {Range[10], Range[11, 17], Range[18, 20]}, Method -> "SpringElectrical"]

enter image description here

to compare with alternative vertex layouts:

Row[SetProperty[athreepartitegraph, 
    GraphLayout -> #] & /@ {{"CircularEmbedding"}, 
      {"CircularMultipartiteEmbedding", "VertexPartition" -> {10, 7, 3}}}]

enter image description here


Original post:

Maybe something like:

g2 = ExampleData[{"NetworkGraph", "ZacharyKarateClub"}];
g2 = SetProperty[g2, {VertexLabels -> "Name", ImagePadding -> 20, ImageSize -> 400}];

fgp = FindGraphPartition[GraphComplement[g2], 3];
mpg = Graph[Flatten@fgp, EdgeList[g2], 
   GraphLayout -> {"MultipartiteEmbedding", "VertexPartition" -> (Length /@ fgp)},
   VertexLabels -> "Name", 
   ImagePadding -> 20, ImageSize -> 400];

Row[{g2, mpg}]

enter image description here

CommunityGraphPlot[g2, fgp, Method -> "Hierarchical"]

enter image description here

added 853 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

Update 2: Hiding the edges within the same community for general, not-necessarily tri-partite, graphs:

ClearAll[insideEdges]
insideEdges[g_, c_]:=Select[EdgeList[g], Or @@ (Function[c, SubsetQ[c, {##}] ]/@c)& @@ #&]

Examples:

zkc = ExampleData[{"NetworkGraph", "ZacharyKarateClub"}];

CommunityGraphPlot[zkc,  CommunityRegionStyle -> {LightRed, LightGreen, LightBlue},
 EdgeStyle -> {Alternatives @@ insideEdges[zkc, FindGraphCommunities[zkc]] :> Opacity[0]}]

enter image description here

dsn= ExampleData[{"NetworkGraph", "DolphinSocialNetwork"}];

CommunityGraphPlot[dsn,  CommunityRegionStyle -> 97,
 EdgeStyle -> {Alternatives @@ insideEdges[dsn, FindGraphCommunities[dsn]] :> Opacity[0]}]

enter image description here

Update 1:

athreepartitegraph = CompleteGraph[{10, 7, 3}, 
  GraphLayout -> {"MultipartiteEmbedding",  "VertexPartition" -> {10, 7, 3}},
  ImageSize -> 400, VertexLabels -> "Name", ImagePadding -> 20];

cgp = CommunityGraphPlot[athreepartitegraph, 
       {Range[10], Range[11, 17], Range[18, 20]}, Method -> "Hierarchical"];
Row[{athreepartitegraph, cgp}] 

enter image description here

or

CommunityGraphPlot[athreepartitegraph, 
  {Range[10], Range[11, 17], Range[18, 20]}, Method -> "SpringElectrical"]

enter image description here

to compare with alternative vertex layouts:

Row[SetProperty[athreepartitegraph, 
    GraphLayout -> #] & /@ {{"CircularEmbedding"}, 
      {"CircularMultipartiteEmbedding", "VertexPartition" -> {10, 7, 3}}}]

enter image description here


Original post:

Maybe something like:

g2 = ExampleData[{"NetworkGraph", "ZacharyKarateClub"}];
g2 = SetProperty[g2, {VertexLabels -> "Name", ImagePadding -> 20, ImageSize -> 400}];

fgp = FindGraphPartition[GraphComplement[g2], 3];
mpg = Graph[Flatten@fgp, EdgeList[g2], 
   GraphLayout -> {"MultipartiteEmbedding", "VertexPartition" -> (Length /@ fgp)},
   VertexLabels -> "Name", 
   ImagePadding -> 20, ImageSize -> 400];

Row[{g2, mpg}]

enter image description here

CommunityGraphPlot[g2, fgp, Method -> "Hierarchical"]

enter image description here

Update:

athreepartitegraph = CompleteGraph[{10, 7, 3}, 
  GraphLayout -> {"MultipartiteEmbedding",  "VertexPartition" -> {10, 7, 3}},
  ImageSize -> 400, VertexLabels -> "Name", ImagePadding -> 20];

cgp = CommunityGraphPlot[athreepartitegraph, 
       {Range[10], Range[11, 17], Range[18, 20]}, Method -> "Hierarchical"];
Row[{athreepartitegraph, cgp}] 

enter image description here

or

CommunityGraphPlot[athreepartitegraph, 
  {Range[10], Range[11, 17], Range[18, 20]}, Method -> "SpringElectrical"]

enter image description here

to compare with alternative vertex layouts:

Row[SetProperty[athreepartitegraph, 
    GraphLayout -> #] & /@ {{"CircularEmbedding"}, 
      {"CircularMultipartiteEmbedding", "VertexPartition" -> {10, 7, 3}}}]

enter image description here


Original post:

Maybe something like:

g2 = ExampleData[{"NetworkGraph", "ZacharyKarateClub"}];
g2 = SetProperty[g2, {VertexLabels -> "Name", ImagePadding -> 20, ImageSize -> 400}];

fgp = FindGraphPartition[GraphComplement[g2], 3];
mpg = Graph[Flatten@fgp, EdgeList[g2], 
   GraphLayout -> {"MultipartiteEmbedding", "VertexPartition" -> (Length /@ fgp)},
   VertexLabels -> "Name", 
   ImagePadding -> 20, ImageSize -> 400];

Row[{g2, mpg}]

enter image description here

CommunityGraphPlot[g2, fgp, Method -> "Hierarchical"]

enter image description here

Update 2: Hiding the edges within the same community for general, not-necessarily tri-partite, graphs:

ClearAll[insideEdges]
insideEdges[g_, c_]:=Select[EdgeList[g], Or @@ (Function[c, SubsetQ[c, {##}] ]/@c)& @@ #&]

Examples:

zkc = ExampleData[{"NetworkGraph", "ZacharyKarateClub"}];

CommunityGraphPlot[zkc,  CommunityRegionStyle -> {LightRed, LightGreen, LightBlue},
 EdgeStyle -> {Alternatives @@ insideEdges[zkc, FindGraphCommunities[zkc]] :> Opacity[0]}]

enter image description here

dsn= ExampleData[{"NetworkGraph", "DolphinSocialNetwork"}];

CommunityGraphPlot[dsn,  CommunityRegionStyle -> 97,
 EdgeStyle -> {Alternatives @@ insideEdges[dsn, FindGraphCommunities[dsn]] :> Opacity[0]}]

enter image description here

Update 1:

athreepartitegraph = CompleteGraph[{10, 7, 3}, 
  GraphLayout -> {"MultipartiteEmbedding",  "VertexPartition" -> {10, 7, 3}},
  ImageSize -> 400, VertexLabels -> "Name", ImagePadding -> 20];

cgp = CommunityGraphPlot[athreepartitegraph, 
       {Range[10], Range[11, 17], Range[18, 20]}, Method -> "Hierarchical"];
Row[{athreepartitegraph, cgp}] 

enter image description here

or

CommunityGraphPlot[athreepartitegraph, 
  {Range[10], Range[11, 17], Range[18, 20]}, Method -> "SpringElectrical"]

enter image description here

to compare with alternative vertex layouts:

Row[SetProperty[athreepartitegraph, 
    GraphLayout -> #] & /@ {{"CircularEmbedding"}, 
      {"CircularMultipartiteEmbedding", "VertexPartition" -> {10, 7, 3}}}]

enter image description here


Original post:

Maybe something like:

g2 = ExampleData[{"NetworkGraph", "ZacharyKarateClub"}];
g2 = SetProperty[g2, {VertexLabels -> "Name", ImagePadding -> 20, ImageSize -> 400}];

fgp = FindGraphPartition[GraphComplement[g2], 3];
mpg = Graph[Flatten@fgp, EdgeList[g2], 
   GraphLayout -> {"MultipartiteEmbedding", "VertexPartition" -> (Length /@ fgp)},
   VertexLabels -> "Name", 
   ImagePadding -> 20, ImageSize -> 400];

Row[{g2, mpg}]

enter image description here

CommunityGraphPlot[g2, fgp, Method -> "Hierarchical"]

enter image description here

added 307 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
added 512 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
added 140 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading