Refactor get_application_graph.