The Euler characteristic i.e., the difference between the number of vertices |V| and edges |E| is the most important topological characteristic of a graph. However, to describe spectral properties of differential equations with mixed Dirichlet and Neumann vertex conditions it is necessary to introduce a new spectral invariant, the generalized Euler characteristic chi G:=|V|-|VD|-|E|, with |VD| denoting the number of Dirichlet vertices. We demonstrate theoretically and experimentally that the generalized Euler characteristic chi G of quantum graphs and microwave networks can be determined from small sets of lowest eigenfrequencies. If the topology of the graph is known, the generalized Euler characteristic chi G can be used to determine the number of Dirichlet vertices. That makes the generalized Euler characteristic chi G a new powerful tool for studying of physical systems modeled by differential equations on metric graphs including isoscattering and neural networks where both Neumann and Dirichlet boundary conditions occur.