Traffic forecasting is crucial in the realm of intelligent urban planning, playing an essential role in route optimization, arrival time estimation, and the prevention of congestion-related incidents. Deep learning has catalyzed the development of advanced spatio-temporal graph neural networks (STGNNs) for traffic prediction tasks. A key advantage of STGNNs is their ability to capture complex spatial correlations, thereby improving prediction precision. Nevertheless, the existing methodologies, including attention-based architectures and dynamical graph-based networks, often incur substantial computational costs, which could be a bottleneck for practical applications. Moreover, these methods tend to overlook frequent traffic patterns, leading to overly complex neural networks with less interpretability. To address the challenge, we propose a lightweight and user-friendly dynamic adaptive graph generator, termed the Vector-Quantized Graph Generator (VQGG), which can autonomously identify prevalent spatial patterns and efficiently constuct the corresponding adaptive graphs for enhanced traffic forecasting. We have extensively tested the VQGG against two benchmark datasets by integrating it as a substitute for the adaptive graphs in baseline models with minor modifications. Extensive experimental results demonstrate that VQGG can reduce forecast errors by up to 2.59%, indicating a significant improvement in predictive performance.