Flexible antenna technology has recently emerged as a key enabler for next-generation wireless communications, which can effectively exploit the spatial degrees of freedom (DoF). However, existing conventional metrics (e.g., spectral and energy efficiency) cannot directly measure the variability for different flexible antenna structures for the spatial DoF. To objectively analyze and compare the spatial DoF of different flexible antennas, the effective rank is introduced as a metric for two major flexible antenna technologies, i.e., movable antenna (MA) and pinching antenna (PA)-enabled wireless systems, optimizing their antenna positions over multi-time slots. However, the inherent non-convexity and high computational complexity of the resulting effective rank maximization problems in MA and PA systems render them hard to solve. To circumvent these problems, we propose the graph attention implicit quantile network (GAIQN) and multi-agent graph attention Q-network (MAGAQN) algorithms to enhance the effective rank of MA and PA systems through antenna positioning, respectively. Meanwhile, the novel top-k action selection methods are designed to ensure collision-free between multiple MAs on the two-dimensional array plane or multiple PAs on the same waveguide. Simulation results validate the effectiveness and advancement of our proposed GAIQN and MAGAQN algorithms compared with benchmarks, which enhance the effective rank by at least 1.6% and 1.3%, respectively, while consistently ensuring collision-free between flexible antennas. Besides, under the same number of flexible antennas, the MA system supports a higher effective rank than the PA system, whereas the PA system offers greater stability in terms of achievable spatial DoF.