Adding a factory layer to create graphs