Suppose I have generated the two graphs g1 and g2 below in a separate Mathematica notebook with the node colors as shown.
I then would like to copy the two graphs into a new Mathematica notebook and take their graph union; that is GraphUnion[g1,g2,VertexLabels->Automatic]; however, the graph union loses the original node colors and only produces the default grey nodes. Any recommendations?
edges1 = {NS <-> N1, NS <-> N2, N2 <-> N3, N3 <-> N1};
edges2 = {NS <-> S1, S1 <-> S3, S2 <-> N2, N2 <-> NS};
g1 = Graph[edges1, VertexLabels -> "Name", VertexLabels -> Automatic,
VertexSize -> 0.2, VertexStyle -> {NS | N1 | N2 -> Red, N3 -> Blue}]
g2 = Graph[edges2, VertexLabels -> "Name", VertexLabels -> Automatic,
VertexSize -> 0.2,
VertexStyle -> {S1 | S2 | S3 -> Yellow}]