summaryrefslogtreecommitdiff
path: root/excitation.cpp
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2022-10-11 11:49:46 +0200
committerJaron Kent-Dobias <jaron@kent-dobias.com>2022-10-11 11:49:46 +0200
commit2083cff9581c3953ebdfa9a9ff951016c0ffc8b5 (patch)
treeb79d18e079cd79a97a36c832b7a1399d26dcb027 /excitation.cpp
parente0ee3dad789078dc38f0d0da195cadc1c8ac0479 (diff)
downloadcode-2083cff9581c3953ebdfa9a9ff951016c0ffc8b5.tar.gz
code-2083cff9581c3953ebdfa9a9ff951016c0ffc8b5.tar.bz2
code-2083cff9581c3953ebdfa9a9ff951016c0ffc8b5.zip
More fixes.
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;
}
}