Are a mug and a donut the same? For Topology, yes!
We all know that it’s impossible to drink coffee in a donut. However, imagine that this donut is made of very malleable rubber. Then we can deform this donut without tearing/puncturing it until it becomes a mug. Conversely, we can deform the mug until it turns into a donut.
Topology is a subfield of mathematics, informally known as the geometry of rubber objects. It studies properties that remain when we crush and/or stretch an object without tearing or puncturing it.
For Topology, the mug and the donut are equivalent. Equivalent objects from the point of view of Topolgia are called homeomorphs. The mug is homeomorphic to a donut, but both are not homeomorphic to a solid sphere, for example.
Note that both the mug and the donut have a “hole”, which does not occur with the solid sphere. More generally, as the permitted deformations do not tear or puncture the objects, it is natural to expect that homeomorphic objects have the same number of holes. The solid sphere is homeomorphic to a cube (both have no holes).
The number of holes in an object is an example of a topological invariant. Another topological invariant is the “number of pieces” of an object.