End-to-End Graph Flattening Method for Large Language Models