Enhancing RAG-based application accuracy by constructing and leveraging graphs