Starting with this article, we introduce the graph-related algorithms, which is also the first lesson note for the second part of the algorithms online course.
The application of graphs is very extensive, there are many useful algorithms, of course, there are many problems to be solved, according to the nature, the graph can be divided into the direction of the graph and the map. In this paper, we introduce the direction-free graph first.
The reason to study the graph is that it is widely used in life:
Non-direction graph
A graph is a plurality of vertices (vertices) and edges (Edges) interconnected. The side is connected only by two vertices, and a graph without direction is called a freeform graph. Before studying the graph, there are some definitions that need to be clear, and the following illustration shows the meaning of some of the basic attributes of the graph, which is not much explained here.
The API representation of the graph
Before the study of the graph, we need to choose the appropriate data structure to represent the graph, sometimes, we are often deceived by our intuition, the following figure, these two are actually the same, this is actually a research question, is how to determine the shape of the graph.
To use a computer to process a graph, we can abstract the following APIs for representing graphs: