Algorithms for graphs and graphs:
The definition of a graph consists of a set of edges and a set of vertices.
For example, the map, each town is the vertex, the road is the edge, by the vertex pair to define (town 1, Town 2) short (V1,V2) vertex also has the weight--cost.
Basic concepts:
Forward graph: The vertex pairs of graphs are ordered. --With arrows (common flowchart)
No map: The graph is unordered. --No arrows pointing.
Path: A series of vertices in the graph.
Path Length: The number representation between the first vertex and the last vertex in the path.
Ring: The path that points to the vertex of itself. The length of the ring is 0;
Circle: The path of at least one edge, and the first and last vertex of the path are the same.
Simple circle: Whether it is a graph or a non-graphic, as long as there is no repeating edge or repeating the vertex circle.
Ordinary circle: The other vertices of the path have a repeating circle except the first and last vertices.
Strong connectivity: There are paths between the two vertices, which are strongly connected and vice versa.
Strongly connected graphs: all vertices of a forward graph are strongly connected.
First, the graph class:
Figure and tree, the binary tree is very similar. A diagram can be created in a number of ways, and the node represents a vertex. But dealing with an object-based approach can cause problems because the graph grows to a very large extent. The structure of the tree will be inefficient.
Diagram of javascript--data structure and algorithm