Graph constructor