Yes, a router is necessary. Technically speaking, a router works differently than a switch. When a switch transmits data from one physical port to another, the router does that between different networks. To be more specific, a switch uses MAC while the router uses IP addresses to transmit data. Being two entirely different functional elements of the networking system, both are important. These two devices work at different levels for data transmission. Hence a router is always necessary, even if you have a switch.