I noticed that the maximum_weight_matching function seems to alter the weight matrix utilized in the matching. When I try to use the original graph in future calculations, I’m getting errors because its adjacency matrix is apparently no longer symmetric. In the following example code, the first “issymetric” function returns true
and the second returns false
.
sources = [1:5;1:5]
destinations = rand(1:5,10)
weights = rand(1:10,10)
fake_graph = SimpleWeightedGraph(sources,destinations,weights)
issymmetric(fake_graph.weights)
match = maximum_weight_matching(SimpleGraph(fake_graph),Gurobi.Optimizer,fake_graph.weights)
issymmetric(fake_graph.weights)
Is there a way to use the maximum_weight_matching function without altering the original graph? The alternative I can think of is to make a copy of the original graph before the matching.