Graph generation and drawing