Data structure_graph_definition/classification/relationship between vertices and edges/connected graph/storage structure/basic operations

        A graph is composed of a finite set of vertices and a set between vertices, usually expressed as: G(V, E), where G represents a graph, V is the set of vertices in G (and a poor non-empty set) , E is the set (which can be empty) of edges in the graph G. Also, graphs are a more complex data structure than linear tables and trees.

Classification of graphs:

        Undirected graph: An edge between any two vertices in the graph is an undirected edge (representation: (A, D) or (D, A))

        Undirected complete graph: In an undirected graph, any two vertices have edges (number of edges: count = n*(n - 1)/2 )

        Directed graph: The edge between any two vertices in the graph is a directed edge (notation <A, D>: A means the end of the arc ; D means the head of the arc -> Note: the order cannot be changed casually)

        Directed complete graph: In a directed graph, there are two arcs in opposite directions between any two vertices

        Simple graph: In the graph, if there is no edge from a vertex to itself, and the same edge does not appear repeatedly

        Sparse graph: a graph with few edges or arcs

        Dense graphs: graphs with many edges or arcs (as opposed to sparse graphs)

        Net: weighted graph

        Subgraph: Suppose two graphs G = (V, {E}) and G' = (V', {E'}), if V' belongs to V and E' belongs to E then G' is called a subgraph of G


The relationship between graph vertices and edges:

         ① In an undirected graph, the degree of a vertex is the total number of edges associated with the vertex TD(v)

         ② In a directed graph, the degree of a vertex includes: in-degree ID(v) and out-degree OD(v)

         ③ The path between the root node of the tree and any node is unique, but the path between vertices in the graph is not unique


Connected graph related definitions:

        Undirected graph: connected graph: there is a path between any two vertices

                      Connected components: maximally connected subgraphs in undirected graphs (subgraphs, subgraph connectivity, subgraphs with a maximum number of vertices, and all edges attached to vertices)

                      Spanning tree: is an extremely small connected subgraph, containing all n vertices in the graph, and n-1 edges

        Directed graph: Strongly connected graph: There is an arc V -> W and W -> V between any two vertices V and W

                      Strongly Connected Components of Directed Graphs: Maximally Connected Subgraphs in Directed Graphs

                      Directed tree: A directed graph has exactly one vertex with an in-degree of 0, and all other vertices with an in-degree of 1


The storage structure of the graph:


Basic operations of the graph:





Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325711939&siteId=291194637