1
$\begingroup$

GraphUnion doesn't seem to produce the correct result. The output should be four blocks connected in a chain, but it's not. This appears to be another bug in version 13.3.0.

Is this a bug and is there a workaround?

enter image description here

gList = {Graph[{2, 0}, {Null, {{2, 1}, {2, 1}}, Automatic}, {FormatType -> TraditionalForm, ImageSize -> {279.74999999999795, Automatic}, ImageSize -> {546., Automatic}, VertexLabels -> {"Name"}}], 
    Graph[{4, 1}, {Null, {{2, 1}, {2, 1}}}, {FormatType -> TraditionalForm, ImageSize -> {334.1249999999994, Automatic}, ImageSize -> {546., Automatic}, VertexLabels -> {"Name"}}], 
    Graph[{1, 3}, {Null, {{1, 2}, {1, 2}}, Automatic}, {FormatType -> TraditionalForm, ImageSize -> {363.1874999999984, Automatic}, ImageSize -> {546., Automatic}, VertexLabels -> {"Name"}}], 
    Graph[{3, 0}, {Null, {{2, 1}, {2, 1}}, Automatic}, {FormatType -> TraditionalForm, ImageSize -> {210.3749999999963, Automatic}, ImageSize -> {546., Automatic}, VertexLabels -> {"Name"}}]}; 
GraphUnion @@ gList
$\endgroup$
2
  • 1
    $\begingroup$ Same output in v 14.2.1 $\endgroup$ Commented May 4 at 14:51
  • $\begingroup$ It is better if the code is simplified. $\endgroup$ Commented May 5 at 0:57

1 Answer 1

2
$\begingroup$

[...] is there a workaround?

Yes, use edge tags.

{Graph[{2, 0}, {UndirectedEdge[2, 0, 1], UndirectedEdge[2, 0, 2]}, {VertexLabels -> {"Name"}}], 
 Graph[{4, 1}, {UndirectedEdge[4, 1, 1], UndirectedEdge[4, 1, 2]}, {VertexLabels -> {"Name"}}], 
 Graph[{1, 3}, {UndirectedEdge[1, 3, 1], UndirectedEdge[1, 3, 2]}, {VertexLabels -> {"Name"}}], 
 Graph[{3, 0}, {UndirectedEdge[3, 0, 1], UndirectedEdge[3, 0, 2]}, {VertexLabels -> {"Name"}}]}

GraphPlot[GraphUnion @@ gList2, VertexLabels -> "Name"]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.