TITLE: Elementary topology of surfaces
QUESTION [13 upvotes]: Let $S$ be a compact connected orientable bordered surface of genus $g$ with $n$ holes (a hole is a component of the border homeomorphic to a circle). Consider a cell decomposition (the closure of each cell is a closed disk of the same dimension as the cell) with $f$ faces, $e_i$ interior edges, $e_b$ boundary edges, $v_i$ interior vertices and $v_b$ boundary vertices. Is there a function $F$ such that $g=F(f,e_i,e_b,v_i,v_b)$? If the answer is positive what is this function $F$?
The Euler characteristic gives me $2g+n$, and I want to recover $g$ and $n$
separately from $f,e_i,e_b,v_i,v_b$. A negative answer would be an example of two non-homeomorphic surfaces with cell decompositions for which the five numbers $f,e_i,e_b,v_i,v_b$ are the same.

REPLY [12 votes]: The answer is negative. First, take two hexagons $A_1 B_1 C_1 D_1 E_1 F_1$ and $A_2 B_2 C_2 D_2 E_2 F_2$ and identify vertices $(A_1,A_2), (B_1,B_2)$, as well as glue the pairs of edges $(F_1A_1,F_2A_2), (B_1C_1, B_2C_2)$. Now add edges $D_1D_2, E_1E_2$ and a $2$-cell $D_1D_2E_2E_1$. You obtain a cell decomposition with $g=0, n=3$ and $(f,e_i,e_b,v_i,v_b)=(3,4,8,0,8)$.
On the other hand you can cut out a small octagon $ABCDEFGH$ from a torus and draw two non intersecting edges $AD,EH$ along longitudes, as well as two edges $CF, BG$ along meridians. This produces three faces and gives $g=1, n=1$ with the same vector $(f,e_i,e_b,v_i,v_b)=(3,4,8,0,8)$.

If we are given the more refined data of all incidence relations between cells then there are multiple ways to count the number of boundary components. If one doesn't wish to chase the cycles formed by boundary edges, one can take a more algebraic approach. For example, if the matrix $M\in \mathbb R^{v_b\times e_b}$ records incidences between boundary vertices and boundary edges (each entry being $1$ when two cells are incident and $0$ otherwise) then the matrix $MM^{T}$ is equal to $2I+A$, where $I$ is the identity matrix and $A$ is the adjacency graph of the boundary graph. 
Since the number of connected components of a graph is given by the dimension of the nullspace of its Laplacian matrix, this means that the number of boundary components of our original complex is given by $\dim \text{null} (2I-A)=\dim \text{null} (4I-MM^{T})$.