JAVA Data Structure - FIG.

Figure:

Compared with the linear structure and a tree structure diagram is a more complex data structure, so it more fun because of the complexity. Online data structure, the elements and can only be related to his predecessor or successor; in the tree structure, only the elements and its parent node or a child node related; however map, he can be associated with any other element, which is Figure charm.

Figure applications:

So we learn map what's the use? We in discrete mathematics and data structures are in contact with a concept map, but the map application in life over there too? Figure applications everywhere all things in our lives, such as: We go to the supermarket to buy chocolate, rice, oil three things, if we think it will in the brain in the case of water and soil do not want the quickest, most shortcut way to buy things, in this way is to find a shortcut to an application map, of course, you want to learn drawing, food delivery can be faster than others. So the best practitioners of good food delivery brother are drawing applications.

Above so much nonsense, how we go the shortest path? We have practical applications in non-Kruskal algorithm and Prim's algorithm. Here we introduce the Kruskal algorithm.

Kruskal algorithm:

A first construct containing only n vertices, edges and sub-picture set is empty, the handle of each vertex as the root FIG on each tree, then select from a minimum weight of network edge set E side, if two vertices belonging to different sides of the piece of tree, it is added submap, i.e. a synthesis tree the two trees, on the contrary, if the strip edges of two vertices on the same tree has fallen it is desirable, but should remove the minimum edge of a weight again. And so on, until only a forest tree, i.e. subgraph containing n-1 until the edges.

Simply put, is to find the shortest path between any point in the figure, followed by a link to the shortest path, minimum spanning tree process is finally formed. This sentence may have BUG but probably thinking that's it.

Path length between each point in turn linked by a short length according to the last generates the minimum number generator.

 

Published 69 original articles · won praise 142 · Views 150,000 +

Guess you like

Origin blog.csdn.net/qq_37857921/article/details/104987599