How do you implement the following graph ADT in c++ ? (WITH STRINGS) all functions take strings ● Graph constructor ● Gr
Posted: Tue Jul 12, 2022 8:15 am
How do you implement the following graph ADT in c++ ?
(WITH STRINGS)
all functions take strings
● Graph constructor
● Graph deconstructor
● e.endVertices(): a list of the two end vertices of e● e.opposite(v): the vertex opposite of v on e● u.isAdjacentTo(v): true if and only if u and v are adjacent● *v: reference to element associated with vertex v● *e: reference to element associated with edge eUpdate methods:● insertVertex(o): insert a vertex storing element o● insertEdge(v, w, o): insert an edge (v, w) storing element o● eraseVertex(v): remove vertex v (and its incident edges)● eraseEdge(e): remove edge eIterable collection methods:● incidentEdges(v): list of edges incident to v● adjacentVertices(v): lists all vertices that share an edge from the vertex v● vertices(): list of all vertices in the graph● edges(): list of all edges in the graph
(WITH STRINGS)
all functions take strings
● Graph constructor
● Graph deconstructor
● e.endVertices(): a list of the two end vertices of e● e.opposite(v): the vertex opposite of v on e● u.isAdjacentTo(v): true if and only if u and v are adjacent● *v: reference to element associated with vertex v● *e: reference to element associated with edge eUpdate methods:● insertVertex(o): insert a vertex storing element o● insertEdge(v, w, o): insert an edge (v, w) storing element o● eraseVertex(v): remove vertex v (and its incident edges)● eraseEdge(e): remove edge eIterable collection methods:● incidentEdges(v): list of edges incident to v● adjacentVertices(v): lists all vertices that share an edge from the vertex v● vertices(): list of all vertices in the graph● edges(): list of all edges in the graph