Assume that $(G,G^0,r,s)$ is a smooth groupoid such that $G$ is a compact connected manifold.

The graph of "source" and "range" maps $s, r: G \to G^0$ are compact submanifolds $S$ and $R$ of $G\times G$. To our smooth groupoid we associate the quantity

$$q= S\ \#\ R,$$

the intersection number of $S$ with $R$.

This quantity vanishes for the particular case that $G$ is a Lie group and $G^0=\{e\}$, the neutral element.

On the other hand, for a given compact manifold $M$, this quantity for the trivial groupoid structure $(M,M, Id, Id)$ is equal to the Euler characteristic of $M$. Hence this quantity may be non zero.

But I search for some nontrivial smooth groupoids for which this quantity is non-zero. What are some examples of this situation?

Furthermore can this quantity be realised and be reintroduced via some quite algebraic formulation that would be defined for more abstract (not necessarily smooth) groupoids? In the other word, and with some abuse of terminology, how can one "Noncommutativize" the above quantity "q"?