we've used the adjacency matrix approach throughout this you can consult sedgewick (see appendix "further reading"and other writers for examples of graph algorithms using the adjacency list approach summary in weighted graphedges have an associated number called the weightwhich might represent distancescoststimesor other quantities the minimum spanning tree in weighted graph minimizes the weights of the edges necessary to connect all the vertices an algorithm using priority queue can be used to find the minimum spanning tree of weighted graph the minimum spanning tree of weighted graph models real-world situations such as installing utility cables between cities the shortest-path problem in nonweighted graph involves finding the minimum number of edges between two vertices solving the shortest-path problem for weighted graphs yields the path with the minimum total edge weight the shortest-path problem for weighted graphs can be solved with dijkstra' algorithm the algorithms for largesparse graphs generally run much faster if the adjacency list representation of the graph is used rather than the adjacency matrix when to use what overview in this we briefly summarize what we've learned so farwith an eye toward deciding what data structure or algorithm to use in particular situation this comes with the usual caveats of necessity it' very general every realworld situation is uniqueso what we say here may not be the right answer to your problem this is divided into three somewhat arbitrary sectionsgeneral-purpose data structuresarrayslinked liststreesand hash tables specialized data structuresstacksqueuespriority queuesand graphs sorting for detailed information on these topicsrefer to the individual in this book general-purpose data structures if you need to store real-world data such as personnel recordsinventoriescontact listsor sales datayou need general-purpose data structure the structures of this type that we've discussed in this book are arrayslinked liststreesand hash tables we call these general-purpose data structures because they are used to store and retrieve data using