Skip to main content
added 33 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

TransitiveReductionGraph (version 10+)

Using the examples from @Kuba's answer:

dag1 = {DirectedEdge[a, b], DirectedEdge[b, c], DirectedEdge[a, c]};
dag2 = DirectedEdge @@@ {{a, b}, {b, c}, {a, c}, {e, b}, {e, c}};
dag3 = DirectedEdge @@@ {{a, b}, {b, c}, {a, c}, {e, b}, {e, c}, {e,  f}, {f, c}};
dag4 = DirectedEdge @@@ {{2, 1}, {3, 1}, {3, 2}, {4, 1}, {4, 2}, {4, 3},
  {5, 1}, {5, 2}, {5, 3}, {5, 4}};
options = {VertexLabels -> Placed["Name", Center], VertexSize -> Large, ImageSize -> Small}
    
Grid[Prepend[Through[{Graph[#, options]&, TransitiveReductionGraph[#, options]&}@#] & /@ 
  {dag1, dag2, dag3, dag4},
 {Style["g", 16, Bold], Style["TransitiveReductionGraph[g]", 16, Bold] }],
 Dividers -> All, ItemSize -> {{Scaled[.3], Scaled[.3]}, {Scaled[.1], 5, 5, 5, 5}}]

enter image description here

Note: Although it works as expected in the cases considered here, as noted by Szabolcs, TransitiveReductionGraph has stillhad unresolved issues before version 12.1.

TransitiveReductionGraph (version 10+)

Using the examples from @Kuba's answer:

dag1 = {DirectedEdge[a, b], DirectedEdge[b, c], DirectedEdge[a, c]};
dag2 = DirectedEdge @@@ {{a, b}, {b, c}, {a, c}, {e, b}, {e, c}};
dag3 = DirectedEdge @@@ {{a, b}, {b, c}, {a, c}, {e, b}, {e, c}, {e,  f}, {f, c}};
dag4 = DirectedEdge @@@ {{2, 1}, {3, 1}, {3, 2}, {4, 1}, {4, 2}, {4, 3},
  {5, 1}, {5, 2}, {5, 3}, {5, 4}};
options = {VertexLabels -> Placed["Name", Center], VertexSize -> Large, ImageSize -> Small}
    
Grid[Prepend[Through[{Graph[#, options]&, TransitiveReductionGraph[#, options]&}@#] & /@ 
  {dag1, dag2, dag3, dag4},
 {Style["g", 16, Bold], Style["TransitiveReductionGraph[g]", 16, Bold] }],
 Dividers -> All, ItemSize -> {{Scaled[.3], Scaled[.3]}, {Scaled[.1], 5, 5, 5, 5}}]

enter image description here

Note: Although it works as expected in the cases considered here, as noted by Szabolcs, TransitiveReductionGraph has still unresolved issues.

TransitiveReductionGraph (version 10+)

Using the examples from @Kuba's answer:

dag1 = {DirectedEdge[a, b], DirectedEdge[b, c], DirectedEdge[a, c]};
dag2 = DirectedEdge @@@ {{a, b}, {b, c}, {a, c}, {e, b}, {e, c}};
dag3 = DirectedEdge @@@ {{a, b}, {b, c}, {a, c}, {e, b}, {e, c}, {e,  f}, {f, c}};
dag4 = DirectedEdge @@@ {{2, 1}, {3, 1}, {3, 2}, {4, 1}, {4, 2}, {4, 3},
  {5, 1}, {5, 2}, {5, 3}, {5, 4}};
options = {VertexLabels -> Placed["Name", Center], VertexSize -> Large, ImageSize -> Small}
    
Grid[Prepend[Through[{Graph[#, options]&, TransitiveReductionGraph[#, options]&}@#] & /@ 
  {dag1, dag2, dag3, dag4},
 {Style["g", 16, Bold], Style["TransitiveReductionGraph[g]", 16, Bold] }],
 Dividers -> All, ItemSize -> {{Scaled[.3], Scaled[.3]}, {Scaled[.1], 5, 5, 5, 5}}]

enter image description here

Note: Although it works as expected in the cases considered here, as noted by Szabolcs, TransitiveReductionGraph had unresolved issues before version 12.1.

Commonmark migration
Source Link

TransitiveReductionGraph (version 10+)

Using the examples from @Kuba's answer:

dag1 = {DirectedEdge[a, b], DirectedEdge[b, c], DirectedEdge[a, c]};
dag2 = DirectedEdge @@@ {{a, b}, {b, c}, {a, c}, {e, b}, {e, c}};
dag3 = DirectedEdge @@@ {{a, b}, {b, c}, {a, c}, {e, b}, {e, c}, {e,  f}, {f, c}};
dag4 = DirectedEdge @@@ {{2, 1}, {3, 1}, {3, 2}, {4, 1}, {4, 2}, {4, 3},
  {5, 1}, {5, 2}, {5, 3}, {5, 4}};
options = {VertexLabels -> Placed["Name", Center], VertexSize -> Large, ImageSize -> Small}
    
Grid[Prepend[Through[{Graph[#, options]&, TransitiveReductionGraph[#, options]&}@#] & /@ 
  {dag1, dag2, dag3, dag4},
 {Style["g", 16, Bold], Style["TransitiveReductionGraph[g]", 16, Bold] }],
 Dividers -> All, ItemSize -> {{Scaled[.3], Scaled[.3]}, {Scaled[.1], 5, 5, 5, 5}}]

enter image description here

Note: Although it works as expected in the cases considered here, as noted by Szabolcs, TransitiveReductionGraph has still unresolved issues.

TransitiveReductionGraph (version 10+)

Using the examples from @Kuba's answer:

dag1 = {DirectedEdge[a, b], DirectedEdge[b, c], DirectedEdge[a, c]};
dag2 = DirectedEdge @@@ {{a, b}, {b, c}, {a, c}, {e, b}, {e, c}};
dag3 = DirectedEdge @@@ {{a, b}, {b, c}, {a, c}, {e, b}, {e, c}, {e,  f}, {f, c}};
dag4 = DirectedEdge @@@ {{2, 1}, {3, 1}, {3, 2}, {4, 1}, {4, 2}, {4, 3},
  {5, 1}, {5, 2}, {5, 3}, {5, 4}};
options = {VertexLabels -> Placed["Name", Center], VertexSize -> Large, ImageSize -> Small}
    
Grid[Prepend[Through[{Graph[#, options]&, TransitiveReductionGraph[#, options]&}@#] & /@ 
  {dag1, dag2, dag3, dag4},
 {Style["g", 16, Bold], Style["TransitiveReductionGraph[g]", 16, Bold] }],
 Dividers -> All, ItemSize -> {{Scaled[.3], Scaled[.3]}, {Scaled[.1], 5, 5, 5, 5}}]

enter image description here

Note: Although it works as expected in the cases considered here, as noted by Szabolcs, TransitiveReductionGraph has still unresolved issues.

TransitiveReductionGraph (version 10+)

Using the examples from @Kuba's answer:

dag1 = {DirectedEdge[a, b], DirectedEdge[b, c], DirectedEdge[a, c]};
dag2 = DirectedEdge @@@ {{a, b}, {b, c}, {a, c}, {e, b}, {e, c}};
dag3 = DirectedEdge @@@ {{a, b}, {b, c}, {a, c}, {e, b}, {e, c}, {e,  f}, {f, c}};
dag4 = DirectedEdge @@@ {{2, 1}, {3, 1}, {3, 2}, {4, 1}, {4, 2}, {4, 3},
  {5, 1}, {5, 2}, {5, 3}, {5, 4}};
options = {VertexLabels -> Placed["Name", Center], VertexSize -> Large, ImageSize -> Small}
    
Grid[Prepend[Through[{Graph[#, options]&, TransitiveReductionGraph[#, options]&}@#] & /@ 
  {dag1, dag2, dag3, dag4},
 {Style["g", 16, Bold], Style["TransitiveReductionGraph[g]", 16, Bold] }],
 Dividers -> All, ItemSize -> {{Scaled[.3], Scaled[.3]}, {Scaled[.1], 5, 5, 5, 5}}]

enter image description here

Note: Although it works as expected in the cases considered here, as noted by Szabolcs, TransitiveReductionGraph has still unresolved issues.

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

TransitiveReductionGraph (version 10+)

Using the examples from @Kuba's answer:

dag1 = {DirectedEdge[a, b], DirectedEdge[b, c], DirectedEdge[a, c]};
dag2 = DirectedEdge @@@ {{a, b}, {b, c}, {a, c}, {e, b}, {e, c}};
dag3 = DirectedEdge @@@ {{a, b}, {b, c}, {a, c}, {e, b}, {e, c}, {e,  f}, {f, c}};
dag4 = DirectedEdge @@@ {{2, 1}, {3, 1}, {3, 2}, {4, 1}, {4, 2}, {4, 3},
  {5, 1}, {5, 2}, {5, 3}, {5, 4}};
options = {VertexLabels -> Placed["Name", Center], VertexSize -> Large, ImageSize -> Small}
    
Grid[Prepend[Through[{Graph[#, options]&, TransitiveReductionGraph[#, options]&}@#] & /@ 
  {dag1, dag2, dag3, dag4},
 {Style["g", 16, Bold], Style["TransitiveReductionGraph[g]", 16, Bold] }],
 Dividers -> All, ItemSize -> {{Scaled[.3], Scaled[.3]}, {Scaled[.1], 5, 5, 5, 5}}]

enter image description here

Note: Although it works as expected in the cases considered here, as noted by Szabolcs, TransitiveReductionGraph has still unresolved issues.

TransitiveReductionGraph (version 10+)

Using the examples from @Kuba's answer:

dag1 = {DirectedEdge[a, b], DirectedEdge[b, c], DirectedEdge[a, c]};
dag2 = DirectedEdge @@@ {{a, b}, {b, c}, {a, c}, {e, b}, {e, c}};
dag3 = DirectedEdge @@@ {{a, b}, {b, c}, {a, c}, {e, b}, {e, c}, {e,  f}, {f, c}};
dag4 = DirectedEdge @@@ {{2, 1}, {3, 1}, {3, 2}, {4, 1}, {4, 2}, {4, 3},
  {5, 1}, {5, 2}, {5, 3}, {5, 4}};
options = {VertexLabels -> Placed["Name", Center], VertexSize -> Large, ImageSize -> Small}
    
Grid[Prepend[Through[{Graph[#, options]&, TransitiveReductionGraph[#, options]&}@#] & /@ 
  {dag1, dag2, dag3, dag4},
 {Style["g", 16, Bold], Style["TransitiveReductionGraph[g]", 16, Bold] }],
 Dividers -> All, ItemSize -> {{Scaled[.3], Scaled[.3]}, {Scaled[.1], 5, 5, 5, 5}}]

enter image description here

TransitiveReductionGraph (version 10+)

Using the examples from @Kuba's answer:

dag1 = {DirectedEdge[a, b], DirectedEdge[b, c], DirectedEdge[a, c]};
dag2 = DirectedEdge @@@ {{a, b}, {b, c}, {a, c}, {e, b}, {e, c}};
dag3 = DirectedEdge @@@ {{a, b}, {b, c}, {a, c}, {e, b}, {e, c}, {e,  f}, {f, c}};
dag4 = DirectedEdge @@@ {{2, 1}, {3, 1}, {3, 2}, {4, 1}, {4, 2}, {4, 3},
  {5, 1}, {5, 2}, {5, 3}, {5, 4}};
options = {VertexLabels -> Placed["Name", Center], VertexSize -> Large, ImageSize -> Small}
    
Grid[Prepend[Through[{Graph[#, options]&, TransitiveReductionGraph[#, options]&}@#] & /@ 
  {dag1, dag2, dag3, dag4},
 {Style["g", 16, Bold], Style["TransitiveReductionGraph[g]", 16, Bold] }],
 Dividers -> All, ItemSize -> {{Scaled[.3], Scaled[.3]}, {Scaled[.1], 5, 5, 5, 5}}]

enter image description here

Note: Although it works as expected in the cases considered here, as noted by Szabolcs, TransitiveReductionGraph has still unresolved issues.

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