Bug introduced in 10.0 and fixed in 12.1
TransitiveReductionGraph
is new in 10.0.
In Mathematica 10.0 and 10.1, according to the documentation of TransitiveReductionGraph
:
The transitive reduction h of a graph g is a graph that has the same transitive closure as g, with a minimal number of edges.
But please look at the following example:
g = Graph[
{1 -> 4, 1 -> 2, 2 -> 3, 3 -> 4},
VertexLabels -> "Name", EdgeStyle -> Arrowheads[.2],
GraphLayout -> "LayeredDigraphEmbedding"
]
The transitive reduction of g
given by TransitiveReductionGraph
is g
itself:
mmaTRG =
TransitiveReductionGraph[g,
VertexLabels -> "Name", EdgeStyle -> Arrowheads[.2],
GraphLayout -> "LayeredDigraphEmbedding"
]
But apparently there is a graph with less number of edges which has the same transitive closure as g
:
betterTRG =
Graph[Range[4], {1 -> 2, 2 -> 3, 3 -> 4},
VertexLabels -> "Name", EdgeStyle -> Arrowheads[6],
GraphLayout -> "LayeredDigraphEmbedding"
]
FindGraphIsomorphism @@ (
TransitiveClosureGraph /@ {mmaTRG, betterTRG}
) // Column
<| 1 -> 1, 4 -> 4, 2 -> 2, 3 -> 3 |>
So why does Mathematica gives mmaTRG
while betterTRG
seems to be the true solution?
Or maybe I misunderstand the documentation and/or the concept of transitive reduction?
Update:
As more than one user suspect this to be a bug of TransitiveReductionGraph
, I have reported it to WRI. The case ID is 3345230.
Update 2:
The Wolfram Technical Support has confirmed it as "a known issue", but no workaround is given.
g = Graph[{1 -> 4, 1 -> 2, 2 -> 3, 3 -> 4}]
$\endgroup$