Logical structure of graph

(The picture comes from the course notes of Lazy Cat Teacher "Data Structure")

1. Definition of graph

(1) A graph is a finite non-empty collection of vertices and a collection of edges between vertices. In the graph, the number of vertices cannot be zero, but there can be no edges

(2) Edges with directions or arrows are called directed edges, and edges without arrows are called undirected edges; graphs with directed edges between any two vertices are called directed graphs, and between any two vertices are undirected An edge-directed graph is called an undirected graph

2. Basic terminology of graphs

(1) In the graph, two vertices connected by an edge are adjacent points ; the edge is said to be attached to the two vertices

(2) Undirected complete graph: In an undirected graph, if there is an edge between any two vertices , the graph is called an undirected complete graph.
Directed Complete Graph: In a directed graph, if there are two arcs in opposite directions between any two vertices , the graph is called a directed complete graph

(3)

Degree of vertex: In an undirected graph, the degree of a vertex v refers to the number of edges attached to the vertex, usually recorded as TD (v) In-degree
of a vertex: In a directed graph, the in-degree of a vertex v refers to The number of arcs whose vertex
is the head of the arc is recorded as ID (v ). )

In an undirected graph, the sum of the degrees of each vertex is twice the sum of the number of edges; in a directed graph, the sum of out-degrees of each vertex = sum of in-degrees = sum of edges

(4)

Weight: A meaningful numerical value assigned to an edge, which can be understood as the price to be paid from one vertex to another   

Net: a graph with weights on the edges, that is, a net graph

(5) Path length: 

       Weighted graph: the sum of the weights of the edges on the path

       Unweighted graph: the number of edges on                                                             

(6)

Connected graph: In an undirected graph, there is a path between any two vertices                                                               

Connected component: a very large connected subgraph in an undirected non-connected graph (such as the figure below); for a directed graph, it is a strongly connected graph and a strongly connected component

(7)

Spanning tree : a minimal connected subgraph     containing all vertices of the original connected graph                                                       

Spanning forest: In a disconnected graph, a spanning tree can be obtained from each connected component, and the spanning trees of these connected components form a spanning forest of a disconnected graph  

Guess you like

Origin blog.csdn.net/m0_63223213/article/details/126295015