szhorvat / IGraphM

IGraph/M is the igraph interface for Mathematica
http://szhorvat.net/mathematica/IGraphM
Other
91 stars 17 forks source link

IGBipartiteProjections mixes up vertex names in the output #132

Open szhorvat opened 7 months ago

szhorvat commented 7 months ago

The vertex names in the result of IGBipartiteProjections are sometimes mixed up, depending on the ordering of the given partitions.

g = IGShorthand["1-a,1-b,1-c,2-a,2-c,3-d,a-3"]
image
Graph[#, VertexLabels -> Automatic] & /@ IGBipartiteProjections[g, {{"a", "d", "c", "b"}, {1, 2, 3}}]
image

Notice that in the result the names/labels of b and d are incorrectly exchanged.

Using IGBipartiteProjections[g, {{"a", "b", "c", "d"}, {1, 2, 3}}] (not the positions of b and d in the input) would be fine.