Identifying the two-hole torus with an octagon

I am aware that the 2-hole torus can be identified with the octagon with the equivalence relation as given in this picture:

https://www.quantamagazine.org/wp-content/uploads/2012/09/Haken_sized_Figure02.jpg

However, today in a topology revision lecture, the lecturer said the 2-hole torus can be represented by the octagon with opposite sides identified. This is different to the picture, so was our lecturer wrong? If so what surface is given by the octagon with opposite sides identified?


Edit/disclaimer:

Although the solution below does indeed identify the two-hole torus with an octagon, it does not answer OP's question which was the two-hole torus can be represented by the octagon with opposite sides identified. I do not explain how to identify the opposites sides of an octagon, but rather how to glue two representations of a torus to get a two-hole torus.


Original answer:

Basically, what you want to do is to glue two tori.

Both tori can be identified with the following representation: enter image description here

Now to glue them together, you want to cut a small piece of each torus, and glue them in a certain way on the area you cut. We are going to cut a small triangle at points $p$ and $q$ as following way:

Note that $p$ and $q$ are note at the same place in both tori!

Now we glue them together, $p$ goes on $p$ and $q$ goes on $q$ which gives:

enter image description here

Redrawing it as an octagon, it gives:

enter image description here


The space resulting from gluing opposite edges of an octagon naturally depends on the orientation of the gluing, but assuming "antipodal edges" are glued with the same orientation, as when building a torus from a square, the result is indeed a two-holed torus.

Gluing opposite edges of an octagon

It's easy to see that

  • Two vertices that are endpoints of a dashed segment are identified, so all eight vertices are identified. Consequently, the interior angles of the octagon are joined cyclically; after identification, the vertex has a disk neighborhood.

Vertex identifications of an octagon

  • Each edge is identified with the opposite edge, and no others, in a manner compatible with the orientation of the octagon.

It follows that the identification space is an orientable surface having a cellular decomposition with one vertex, four edges, and one $2$-cell. The Euler characteristic is $\chi = 1 - 4 + 1 = -2$. By the classification of surfaces, the glued octagon is a two-holed torus.

(Presumably the same conclusion can be reached by surgery, modifying the octagon to the "conventional" gluing, though I haven't checked carefully.)