refactor EndoRelation into Graph