Measure the distance between the over-locking nuts on the wheel and the distance between the rear forks.
As for the tires and rims, the bead seat diameter has to match. Easiest way to check is to read the side wall of the tire. Should say two numbers, the first is the tire width the second is the bead seat diameter. Example: a 26x2 tire might say 55-559, 55mm for the width(2 inch, about) and the bsd of 26 inch mtb tires is 559 mm.
A gravel bike or a 29er may have a 53-622. 53mm width, 622 bsd, after inflated the actual diameter is about 29 inches.