chap graphs triangular matrices the re-implement the adjacency matrix representation of figure to implement undirected graphs using triangular array while the underlying implementation (whether adjacency matrix or adjacency listis hidden behind the graph adtthese two implementations can have an impact on the efficiency of the resulting program for dijkstra' shortest paths algorithmtwo different implementations were given in section that provide different ways for determining the next closest vertex at each iteration of the algorithm the relative costs of these two variants depend on who sparse or dense the graph is they might also depend on whether the graph is implemented using an adjacency list or adjacency matrix design and implement study to compare the effects on performance for three variables(ithe two graph representations (adjacency list and adjacency matrix)(iithe two implementations for djikstra' shortest paths algorithm (searching the table of vertex distances or using priority queue to track the distances)and (iiisparse versus dense graphs be sure to test your implementations on variety of graphs that are sufficiently large to generate meaningful times the example implementations for dfs and bfs show calls to functions previsit and postvisit re-implement the bfs and dfs functions to make use of the visitor design pattern to handle the pre/post visit functionality write program to label the connected components for an undirected graph in other wordsall vertices of the first component are given the first component' labelall vertices of the second component are given the second component' labeland so on your algorithm should work by defining any two vertices connected by an edge to be members of the same equivalence class once all of the edges have been processedall vertices in given equivalence class will be connected use the union/find implementation from section to implement equivalence classes