Make Graph component more reusable