Research Article

A Collaborative Framework of Knowledge Graphs and Large Language Models for the Purpose of Carrying Out the Process of Solving Algorithmic Problems

Yukai Wu*
School of Computer and Information Technology, Beijing Jiaotong University, Beijing, China

* Corresponding author: [email protected]

Abstract

The process of solving algorithm problems is a fundamental task within the realm of computer science education and competitive programming. However, in the situation where existing large language models (LLMs) are faced with the task of solving complex problems and generating correct as well as efficient solutions under the condition of strict time and space constraints, they often encounter difficulties. There is still a substantial amount of room that can be improved. In this piece of work, we put forward a new collaborative framework. This framework combines the knowledge graph and the LLM in order to further enhance the capability of dealing with the algorithm problem. In this work, we select 30 challenging algorithmic problems from the Luogu Online Judge platform. We ensure that these problems cover a wide variety of algorithmic categories so as to evaluate the effectiveness of the method that we have proposed. The experimental results show that the validity of the code generated by our approach is significantly higher than that of the baseline methods.

Keywords: Large Language Model (LLM); Knowledge Graph (KG); Retrieval-Augmented Generation (RAG); Competitive Programming; and Algorithm
Published: October 28, 2025
DOI: 10.54254/2755-2721/2025.LD28518
Volume: ACE Vol.196
pp. 144-155
Download PDF

References

  1. Coignion, T., Quinton, C., & Rouvoy, R. (2024, June). A performance study of llm-generated code on leetcode. In Proceedings of the 28th international conference on evaluation and assessment in software engineering (pp. 79-89).
  2. Wei, M., Li, Z., Chen, X., Zheng, M., Qu, Z., Yu, C., ... & Ju, X. (2025). Evaluating and Improving Large Language Models for Competitive Program Generation.  arXiv preprint arXiv: 2506.22954.
  3. Huang, L., Yu, W., Ma, W., Zhong, W., Feng, Z., Wang, H., ... & Liu, T. (2025). A survey on hallucination in large language models: Principles, taxonomy, challenges, and open questions. ACM Transactions on Information Systems, 43(2), 1-55.
  4. OpenAI, R. (2023). Gpt-4 technical report. arxiv 2303.08774. View in Article, 2(5), 1.
  5. Jimenez, C. E., Yang, J., Wettig, A., Yao, S., Pei, K., Press, O., & Narasimhan, K. (2023). Swe-bench: Can language models resolve real-world github issues?. arXiv preprint arXiv: 2310.06770.
  6. Ji, Z., Lee, N., Frieske, R., Yu, T., Su, D., Xu, Y., ... & Fung, P. (2023). Survey of hallucination in natural language generation. ACM computing surveys, 55(12), 1-38.
  7. Liu, X., Yu, H., Zhang, H., Xu, Y., Lei, X., Lai, H., ... & Tang, J. (2023). Agentbench: Evaluating llms as agents.  arXiv preprint arXiv: 2308.03688.
  8. Shinn, N., Cassano, F., Gopinath, A., Narasimhan, K., & Yao, S. (2023). Reflexion: Language agents with verbal reinforcement learning. Advances in Neural Information Processing Systems, 36, 8634-8652.
  9. Wu, Q., Bansal, G., Zhang, J., Wu, Y., Li, B., Zhu, E., ... & Wang, C. (2024, August). Autogen: Enabling next-gen LLM applications via multi-agent conversations. In First Conference on Language Modeling.
  10. Peng, C., Xia, F., Naseriparsa, M., & Osborne, F. (2023). Knowledge graphs: Opportunities and challenges. Artificial intelligence review, 56(11), 13071-13102.
  11. Pote, M. (2024). Survey on embedding models for knowledge graph and its applications.  arXiv preprint arXiv: 2404.09167.
  12. Pan, S., Luo, L., Wang, Y., Chen, C., Wang, J., & Wu, X. (2024). Unifying large language models and knowledge graphs: A roadmap. IEEE Transactions on Knowledge and Data Engineering, 36(7), 3580-3599.
  13. Asai, A., Wu, Z., Wang, Y., Sil, A., & Hajishirzi, H. (2024). Self-rag: Learning to retrieve, generate, and critique through self-reflection.
  14. Gao, L., Dai, Z., Pasupat, P., Chen, A., Chaganty, A. T., Fan, Y., ... & Guu, K. (2022). Rarr: Researching and revising what language models say, using language models.  arXiv preprint arXiv: 2210.08726.
  15. Sarthi, P., Abdullah, S., Tuli, A., Khanna, S., Goldie, A., & Manning, C. D. (2024, May). Raptor: Recursive abstractive processing for tree-organized retrieval. In The Twelfth International Conference on Learning Representations.
  16. Wang, J., He, Y., & Chen, H. (2024). Repogenreflex: Enhancing repository-level code completion with verbal reinforcement and retrieval-augmented generation.  arXiv preprint arXiv: 2409.13122.