Constructing a graph using the vertex