+#define ESHIFT (YBITS+XBITS)
+
+class Graph { }; // this is a dummy as our graph has no actual representation
+
+using namespace boost;
+
+/*
+ * We iterate over edges in the following order:
+ *
+ * \#0 /1#
+ * \ /
+ * ___ 0 __
+ * #2 1 #3
+ * / \
+ * #4/ #5\ and finally #6 is V6
+ *
+ *
+ * This ordering permits the order-4 nodes at the strip's edge
+ * to have a contiguous edge iterator values. The iterator
+ * starts at #0 which is edge 2 (see mgraph.h), or #2 (edge 3).
+ */
+static const int oei_edge_delta[V6]=
+ /* 0 1 2 3 4 5 initial e
+ * #3 #1 #0 #2 #4 #5 initial ix
+ * #4 #2 #1 #3 #5 #6 next ix
+ * 4 3 1 0 5 V6 next e
+ */ {
+ 4<<ESHIFT, 2<<ESHIFT, -1<<ESHIFT,
+ -3<<ESHIFT, 1<<ESHIFT, (V6-5)<<ESHIFT
+};
+
+class OutEdgeIterator :
+ public iterator_facade<
+ OutEdgeIterator,
+ int const,
+ forward_traversal_tag
+> {
+ int f;
+ public:
+ void increment() {
+ //printf("incrementing f=%03x..",f);
+ f += oei_edge_delta[f>>ESHIFT];
+ //printf("%03x\n",f);
+ }
+ bool equal(OutEdgeIterator const& other) const { return f == other.f; }
+ int const& dereference() const { return f; }
+ OutEdgeIterator() { }
+ OutEdgeIterator(int _f) : f(_f) { }
+ OutEdgeIterator(int v, int e) : f(e<<ESHIFT | v) {
+ //printf("constructed v=%x e=%x f=%03x\n",v,e,f);
+ }
+
+ static int voe_min(int _v) { return (_v & YMASK) ? 2 : 3; }
+ static int voe_max(int _v) { return (~_v & YMASK) ? V6 : 4; }
+ static int voe_degree(int _v) { return (_v & YMASK | ~_v & YMASK) ? 4 : V6; }
+};
+
+typedef counting_iterator<int> VertexIterator;