Skip to main content
added 265 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
edglst2 = Join @@ (Tally[edglst] /. 
           {Rule[a_, b_], 2} :> {Rule[a, b], Rule[b, a]} /. {x_Rule, 1} :> {x});
vopts = {VertexStyle -> LightYellow, VertexSize -> 0.20, 
         VertexLabels -> Placed["Name", {1/2, 1/2}], 
         VertexLabelStyle -> Directive[20, Red, Bold, Italic]};

gg = Graph[edglst2, vopts, GraphLayout -> "CircularEmbedding", 
           VertexLabels -> "Name", ImagePadding -> 20, ImageSize -> 500, 
           EdgeShapeFunction -> "Line", BaseStyle -> Thick];
gg2 = HighlightGraph[gg, (EdgeList[Subgraph[gg, #]] & /@ blocks), 
                     ImageSize -> 500, BaseStyle -> Thick];
Row[{gg, gg2}]

enter image description hereenter image description here

eS = Property[DirectedEdge[#, #2], EdgeShapeFunction -> 
       GraphElementData[{"FilledArrow", "ArrowSize" -> #3, "ArrowPositions" -> #4}]] &;

edglstb = Join @@ (Tally[edglst] /. 
       {Rule[a_, b_], 2} :> 
                                     {eS[aesf[a, b, .03, 1.]9], eS[besf[b, a, -.03, 0.]1]} /. 
                                 {Rule[a_, b_], 1} :> {eS[aesf[a, b, .03, 1.]98]});
ggb = Graph[edglstb, vopts,GraphLayout -> "CircularEmbedding", VertexLabels -> "Name",
            ImagePadding -> 20, ImageSize -> 500, BaseStyle -> Thick];
ggb2 = HighlightGraph[ggb, EdgeList[Subgraph[ggb, #]] & /@ blocks, 
                      ImageSize -> 500, BaseStyle -> Thick];
Row[{ggb, ggb2}]

enter image description hereenter image description here

edglst2 = Join @@ (Tally[edglst] /. 
           {Rule[a_, b_], 2} :> {Rule[a, b], Rule[b, a]} /. {x_Rule, 1} :> {x});

gg = Graph[edglst2, GraphLayout -> "CircularEmbedding", 
           VertexLabels -> "Name", ImagePadding -> 20, ImageSize -> 500, 
           EdgeShapeFunction -> "Line", BaseStyle -> Thick];
gg2 = HighlightGraph[gg, (EdgeList[Subgraph[gg, #]] & /@ blocks), 
                     ImageSize -> 500, BaseStyle -> Thick];
Row[{gg, gg2}]

enter image description here

eS = Property[DirectedEdge[#, #2], EdgeShapeFunction -> 
       GraphElementData[{"FilledArrow", "ArrowSize" -> #3, "ArrowPositions" -> #4}]] &;

edglstb = Join @@ (Tally[edglst] /. 
       {Rule[a_, b_], 2} :> {eS[a, b, .03, 1.], eS[b, a, -.03, 0.]} /.
       {Rule[a_, b_], 1} :> {eS[a, b, .03, 1.]});
ggb = Graph[edglstb, GraphLayout -> "CircularEmbedding", VertexLabels -> "Name",
            ImagePadding -> 20, ImageSize -> 500, BaseStyle -> Thick];
ggb2 = HighlightGraph[ggb, EdgeList[Subgraph[ggb, #]] & /@ blocks, 
                      ImageSize -> 500, BaseStyle -> Thick];
Row[{ggb, ggb2}]

enter image description here

edglst2 = Join @@ (Tally[edglst] /. 
           {Rule[a_, b_], 2} :> {Rule[a, b], Rule[b, a]} /. {x_Rule, 1} :> {x});
vopts = {VertexStyle -> LightYellow, VertexSize -> 0.20, 
         VertexLabels -> Placed["Name", {1/2, 1/2}], 
         VertexLabelStyle -> Directive[20, Red, Bold, Italic]};

gg = Graph[edglst2, vopts, GraphLayout -> "CircularEmbedding", 
           VertexLabels -> "Name", ImagePadding -> 20, ImageSize -> 500, 
           EdgeShapeFunction -> "Line", BaseStyle -> Thick];
gg2 = HighlightGraph[gg, (EdgeList[Subgraph[gg, #]] & /@ blocks), 
                     ImageSize -> 500, BaseStyle -> Thick];
Row[{gg, gg2}]

enter image description here

eS = Property[DirectedEdge[#, #2], EdgeShapeFunction -> 
       GraphElementData[{"FilledArrow", "ArrowSize" -> #3, "ArrowPositions" -> #4}]] &;

edglstb = Join @@ (Tally[edglst] /. {Rule[a_, b_], 2} :> 
                                     {esf[a, b, .03, .9], esf[b, a, -.03, .1]} /. 
                                 {Rule[a_, b_], 1} :> {esf[a, b, .03, .98]});
ggb = Graph[edglstb, vopts,GraphLayout -> "CircularEmbedding", VertexLabels -> "Name",
            ImagePadding -> 20, ImageSize -> 500, BaseStyle -> Thick];
ggb2 = HighlightGraph[ggb, EdgeList[Subgraph[ggb, #]] & /@ blocks, 
                      ImageSize -> 500, BaseStyle -> Thick];
Row[{ggb, ggb2}]

enter image description here

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

 blocks = {{0, 1, 2, 3}, {0, 1, 4, 5}, {0, 2, 4, 6}, {0, 3, 7, 8}, 
           {0, 5, 7, 9}, {0, 6, 8, 9}, {1, 2, 7, 8}, {1, 3, 6, 9},
           {1, 4, 7, 9}, {1, 5, 6, 8}, {2, 3, 5, 9}, {2, 4, 8, 9}, 
           {2, 5, 6, 7}, {3, 4, 5, 8}, {3, 4, 6, 7}};
edglst = {0 -> 1, 1 -> 2, 2 -> 3, 0 -> 1, 1 -> 4, 4 -> 5, 0 -> 2, 
          2 -> 4, 4 -> 6, 0 -> 3, 3 -> 7, 7 -> 9, 0 -> 6, 6 -> 8, 8 -> 9, 
          1 -> 2, 2 -> 7, 7 -> 8, 1 -> 3, 3 -> 6, 6 -> 9, 1 -> 4, 4 -> 7, 
          7 -> 9, 1 -> 5, 5 -> 6, 6 -> 8, 2 -> 3, 3 -> 5, 5 -> 9, 2 -> 4, 
          4 -> 8, 8 -> 9, 2 -> 5, 5 -> 6, 6 -> 7, 3 -> 4, 4 -> 5, 5 -> 8, 
          3 -> 4, 4 -> 6, 6 -> 7};

The following trick works in Version 9 if the number of edges between a pair of vertices is at most 2:

edglst2 = Join @@ (Tally[edglst] /. 
           {Rule[a_, b_], 2} :> {Rule[a, b], Rule[b, a]} /. {x_Rule, 1} :> {x});

gg = Graph[edglst2, GraphLayout -> "CircularEmbedding", 
           VertexLabels -> "Name", ImagePadding -> 20, ImageSize -> 500, 
           EdgeShapeFunction -> "Line", BaseStyle -> Thick];
gg2 = HighlightGraph[gg, (EdgeList[Subgraph[gg, #]] & /@ blocks), 
                     ImageSize -> 500, BaseStyle -> Thick];
Row[{gg, gg2}]

enter image description here

To "mimic" the edge directions in the original graph, one can use EdgeShapeFunction as follows:

eS = Property[DirectedEdge[#, #2], EdgeShapeFunction -> 
       GraphElementData[{"FilledArrow", "ArrowSize" -> #3, "ArrowPositions" -> #4}]] &;

edglstb = Join @@ (Tally[edglst] /. 
       {Rule[a_, b_], 2} :> {eS[a, b, .03, 1.], eS[b, a, -.03, 0.]} /.
       {Rule[a_, b_], 1} :> {eS[a, b, .03, 1.]});
ggb = Graph[edglstb, GraphLayout -> "CircularEmbedding", VertexLabels -> "Name",
            ImagePadding -> 20, ImageSize -> 500, BaseStyle -> Thick];
ggb2 = HighlightGraph[ggb, EdgeList[Subgraph[ggb, #]] & /@ blocks, 
                      ImageSize -> 500, BaseStyle -> Thick];
Row[{ggb, ggb2}]

enter image description here