The increasing availability of human trajectory and social data, fueled by GPS and social networks, presents a unique opportunity for scientific discovery. However, existing data analysis methods struggle to provide robust, efficient, and generalizable graph representations, hindering their applicability in urban and social sciences. This research addresses this challenge by developing novel machine learning algorithms specifically tailored for graph-structured data in these domains. This research tackles three key challenges: (1) Sparse Data and Data Distribution Heterogeneity: Current methods often struggle with sparse data and varying data distributions, limiting their ability to capture diverse patterns and hindering scalability. This research proposes novel approaches for flexible, adaptive, and generalizable representations in urban planning and social sciences. (2) Non-General Representation and Difficulty Adapting to New Data: Existing methods often lack the ability to generalize across different datasets and struggle to adapt to new data, hindering their effectiveness in real-world applications. This research aims to develop methods that can learn robust and efficient representations that generalize across different datasets and adapt to new data. (3) Trade-off Between Efficiency and Effectiveness: Balancing processing speed, accuracy, and reliability is crucial in urban and social science data analysis. This research addresses this challenge by developing innovative algorithms that optimize for both efficiency and effectiveness. This research leverages contrastive learning and information bottleneck techniques to develop robust and efficient graph representation learning methods for spatial-temporal data and recommender systems. The developed methods have demonstrated significant improvements in downstream tasks such as traffic prediction, crime prediction, and anomaly detection. This research lays a strong foundation for future work in graph-structured data analysis across various domains, including urban science, social science, and scientific discovery. Future research will focus on extending these methods to multi-modal datasets, enabling zero-shot learning, and developing novel approaches for understanding complex biological systems.