summaryrefslogtreecommitdiff
path: root/excitation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'excitation.cpp')
-rw-r--r--excitation.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/excitation.cpp b/excitation.cpp
index 05cb8c6..be1acc1 100644
--- a/excitation.cpp
+++ b/excitation.cpp
@@ -2,6 +2,10 @@
#include "rbmp.hpp"
+bool edgeMatched(PerfectMatching& pm, const AztecDiamond::Edge& e) {
+ return e.tail->index == pm.GetMatch(e.head->index);
+}
+
int main(int argc, char* argv[]) {
unsigned n = 100;
@@ -18,12 +22,13 @@ int main(int argc, char* argv[]) {
}
Rng r;
- Graph G(n, r);
+ AztecDiamond G(n);
+ G.setWeights(r);
PerfectMatching pm(G.vertices.size(), G.edges.size());
- for (const Edge& e : G.edges) {
- pm.AddEdge(e.halfedges[0].getHead().index, e.halfedges[0].getTail().index, e.weight);
+ for (const AztecDiamond::Edge& e : G.edges) {
+ pm.AddEdge(e.head->index, e.tail->index, e.weight);
}
pm.options.verbose = false;
@@ -83,10 +88,10 @@ int main(int argc, char* argv[]) {
for (unsigned i = 0; i < G.edges.size(); i++) {
if (!matching[i] && edgeMatched(pm, G.edges[i])) {
std::cout
- << G.edges[i].halfedges[0].getTail().coordinate[0] << " "
- << G.edges[i].halfedges[0].getTail().coordinate[1] << " "
- << G.edges[i].halfedges[0].getHead().coordinate[0] << " "
- << G.edges[i].halfedges[0].getHead().coordinate[1] << std::endl;
+ << G.edges[i].tail->coordinate[0] << " "
+ << G.edges[i].tail->coordinate[1] << " "
+ << G.edges[i].head->coordinate[0] << " "
+ << G.edges[i].head->coordinate[1] << std::endl;
}
}