A graph contains vertices connected by edges. Operations: Graph()- creates new,
ID: 3843325 • Letter: A
Question
A graph contains vertices connected by edges. Operations: Graph()- creates new, empty graph, G adjacent(G, x, y): true if there is an edge from the vertices x to y neighbors(G, x): lists vertices y with an edge to x add_vertex(G, x): adds new vertex x, if not present remove_vertex(G, x): removes the vertex x, if present add_edge(G, x, y): adds edge from the vertex x to vertex y, if not present remove_edge(G, x, y): removes edge from the vertex x to vertex y, if present get_vertex_value(G, x): returns value associated with vertex x set_vertex_value(G, x, v): sets the value associated with vertex x to v Ddepending on implementation: get_edge_value(G, x, y): returns value associated with edge (x, y) set_edge_value(G, x, y, v): sets value associated with edge (x, y) to v Write psuedocode for the BFS traversal of an undirected graph. Don't forget to use the other data type we have learned! Write psuedocode for the DFS traversal of an undirected graph. Don't forget to use the other data type we have learned!Explanation / Answer
Below is the required code segment:-
Thank you.