Created
January 16, 2015 02:50
-
-
Save stephentu/65b0f971edd8aa2d3124 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static inline SDP | |
ConstructMaxCutSDPFromGraph(const UndirectedGraph& g) | |
{ | |
SDP sdp(g.NumVertices(), g.NumVertices(), 0); | |
g.Laplacian(sdp.SparseC()); | |
sdp.SparseC() *= -1; | |
for (size_t i = 0; i < g.NumVertices(); i++) | |
{ | |
sdp.SparseA()[i].zeros(g.NumVertices(), g.NumVertices()); | |
sdp.SparseA()[i](i, i) = 1.; | |
} | |
sdp.SparseB().ones(); | |
return sdp; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment