Gigapede has several attacks, most of which can't hurt you if you are standing on an elevated platform.
Lightning pulse: Gigapede causes a wave of electricity to run along the floor. Being off the ground avoids this completely.
Lightning bolts: Several vertical beams of lightning form below Gigapede and try to home in on your position. Staying off the ground floor renders this attack harmless.
Purple orbs: Gigapede fires multiple purple spheres of energy at Dante. These orbs can travel through Gigapede, and can hit Dante even when he is standing on the top level. Move quickly to avoid them, or attack them to send them back at Gigapede.
Strategy:
*** Spoiler - click to reveal ***
First playthrough
The holes scattered throughout its arena are connected, such that Gigapede's entrance will always determine the exit. Also a bright light will emit from the hole it will come through. Memorizing these connections is extremely useful for predicting Gigapede's next move and positioning yourself for minimum battle time, since it cannot be attacked while inside the walls. Attacking the head deals the most damage, but its body segments can be knocked off with enough forced coersion, making its attacks easier to dodge. Occasionally, Gigapede will also twist around, attempting to knock you down to the ground. Simply jump or Air Hike to avoid this. Be careful, because sometimes Gigapede couples this move with an electrical attack, giving you two things to dodge.
The Gigapede is vulnerable to Cerberus' ice attacks, but has a particular weak spot on its head. It flies through the map on several set routes; you can hop down onto it as it emerges from the holes in the walls and attack. Standing on its body for a few moments causes it to flip over in an attempt to knock you off, but standing on and attacking its head will cause it to shriek and fly around more quickly.
Only the orb attack can be reflected with melee attacks to do surprising amounts of damage to the Gigapede. The Swordmaster style is ideal for this: alternating between Flicker and the first two hits of the Cerberus Combos works well, as well as Prop Shredder with Rebellion.
Second playthrough
With Level 3 Royalguard Style and the Spiral, this boss becomes an instant cakewalk. The floor of the map is roughly an L shape (with two of the wall holes on either end); stand on the narrow platform at the corner of the L. As the Gigapede emerges from either hole, fire the Spiral repeatedly at it (you can shorten the long cooldown animation by pressing Guard or by firing a different gun). The bullets will pierce each segment of the Gigapede, thereby dealing fantastic damage for a gun. As long as you're on the platform, the Gigapede's lightning attacks won't reach you, and when it uses the purple orb attack, simply execute Ultimate to absorb all of the hits. Just be careful not to let the recoil from the Spiral knock you off the platform. Gigapede is also vulnerable to Agni & Rudra.