How to compute Euler characteristic from polygonal presentation? How can I compute the Euler characteristic of a compact surface from its polygonal presentation $\langle S | W_1 , \ldots , W_k \rangle$? I guess that the number of edges is the number of different symbols in $S$, but how to get the number of vertices and the number of faces?
 A: If the polygonal presentation contains only one word, the following algorithm works:


*

*Add vertex symbols. Then, for each pair of edges with the same edge symbol, build one set containing the two initial vertices and one set containing the two terminal vertices.

*Build the union of all vertex sets that have at least one vertex in common until all resulting sets are disjoint.

*The number of vertices is the number of disjoint sets obtained in step 2. The number of edges is the number of different edge symbols and the number of faces is one.


Example:
Cube: $S = \langle a, b, c, d, e, f \mid aa^{-1}e^{-1}dd^{-1}gcc^{-1}g^{-1}e f bb^{-1}f^{-1} \rangle$ (c.f. A.P.'s answer)
Adding vertex symbols: $AaBa^{-1}Ce^{-1}DdEd^{-1}FgGcHc^{-1}Ig^{-1}KeLfM bNb^{-1}Of^{-1}A$
Building vertex sets:
Edge $a$: $\lbrace A, C \rbrace$, $\lbrace B, B \rbrace$;
Edge $b$: $\lbrace M, O \rbrace$, $\lbrace N, N \rbrace$;
Edge $c$: $\lbrace G, I \rbrace$, $\lbrace H, H \rbrace$;
Edge $d$: $\lbrace D, F \rbrace$, $\lbrace E, E \rbrace$;
Edge $e$: $\lbrace D, K \rbrace$, $\lbrace C, L \rbrace$;
Edge $f$: $\lbrace L, A \rbrace$, $\lbrace M, O \rbrace$;
Edge $g$: $\lbrace F, K \rbrace$, $\lbrace G, I \rbrace$
Building unions:
$\lbrace A, C \rbrace \cup \lbrace C, L \rbrace \cup \lbrace L, A \rbrace =
\lbrace A, C, L \rbrace$, 
$\lbrace D, F \rbrace \cup \lbrace D, K \rbrace \cup \lbrace F, K \rbrace =
\lbrace D, F, K \rbrace$
Resulting disjoint vertex sets:
$\lbrace A, C, L \rbrace$, $\lbrace D, F, K \rbrace$, $\lbrace M, O \rbrace$,
$\lbrace G, I \rbrace$, $\lbrace B \rbrace$, $\lbrace E \rbrace$,
$\lbrace H \rbrace$, $\lbrace N \rbrace$
The number of disjoint vertex sets is 8. Thus, the number of vertices is 8.
A: You can explicitly count the number of equivalence classes of vertices (where two vertices are considered equivalent iff they are to be identified). Edges appear in pairs-to-be-identified, so you get the number of edges by dividing the number of edges on the polygon by $2$ (equivalently, by counting the number of distinct letters appearing in the word). Finally there is a single face (the interior of the polygon).
For example, take this polygonal presentation of a cube (sphere):

There are $8$ equivalence classes of vertices, and $7$ pairs of edges. So the Euler characteristic of the cube is $8 - 7 + 1 = 2.$

Equivalently, by an explicit algorithm you can reduce the presentation to a canonical form (corresponding to the compact surface of genus $g$, orientable or not), and compute the Euler characteristic there (or even use the fact that $\chi(S_1 \# S_2) = \chi(S_1) + \chi(S_2) - 2$, so that you only need the characteristic of the sphere, torus, and projective plane).
