Figure study

Author: Wang Xiaodong great general
Source: CSDN
Original: https://blog.csdn.net/wangdd_199326/article/details/72463567
thanks! thank!

1, on each side of FIG communication weights are not the same, then the graph of the minimum spanning tree is unique.

(Free tree, that is the root of uncertainty)


2, with vertices in the graph represents the number of n, e represents the number of edges or arcs:

(1) For an undirected graph, in the range of e is 0 ~ N (N-1) / 2; there are N (N-1) / 2 edges without completely called directed graph.

(2) For the range to FIG, e is 0 ~ N (N-1); with a corresponding N (N-1) have edges directed to FIG called complete FIG.

(3) an undirected graph, for any two points in the drawing are in communication, called FIG communication; connected components refers to non-maximal connected subgraph FIG;

(4) In a directed graph, when the vertices are present for each path, said strongly connected graph in FIG. There are strongly connected graph is called the maximum subgraph the strongly connected component;

A spanning tree with n vertices and only n-1 edges;
if a graph with n vertices and edges is smaller than n-1, the non-connected graph;
if a surplus FIGS n-1 edges, then must have a ring;
have the n-1 sides of the drawings are not necessarily spanning tree;


FIG storage structure:

1) the adjacency matrix (without a configured e n vertices and edges with the complexity of the timing chart is O (n ^ 2 + e * n)), in which the adjacency matrix initialization takes O (n ^ 2),

2) adjacent to the table (or tables when creating adjacency inverse adjacency table, if the input information is the vertex vertex numbers, the time complexity is established adjacency list is O (n + e); or by the need to find to find vertices in FIG. the location, time complexity is O (ne)),

3) the adjacent multi-table (the table that the difference between adjacent edges in abutment with a table with two nodes represented, while in the adjacent multi-node table is only one),

4) Cross linked list (the adjacency table to establish the same time complexity).




Traversing Graph essence procedure for each vertex finder adjacent points. When the storage structure with the adjacency matrix mapping, the time required to find each vertex adjacent to O (n ^ 2); when using the mapping table storage structure adjacent to find the time required for the adjacent point O (e ); when used as a storage structure adjacent table, depth-first search traversal time complexity of FIG. O (n + e).

The cost of a spanning tree is the price of each side of the tree and.

Multi-use configuration of the minimum spanning tree algorithm MST properties. The main use Prim's algorithm (time complexity of O (n ^ 2), regardless of the number of edges in the network for the required dense edge minimum spanning tree) and Kruskal's algorithm (time complexity of O (e log e), adapted to demand side of the minimum spanning tree sparse).



3, FIG topological sort only, it is the number of arcs than n-1 (n is a diagram of the top points)

4, the presence of topological sort to the drawings, the loop does not exist in FIG.

5, having vertices to FIG. 7 should be at least seven sides could become a strongly connected graph.

Analysis: strong graph can be returned to any place from the starting point, each node must have at least one way (except single node) at least n edges, just to form a ring.


N vertices strongly connected graph bar up to (N-1) N sides, a minimum of N edges.

(Strongly connected graph is arbitrarily refers to a two to FIG v1, v2 FIG path exists between the path and v2 to v1.)


Up case: i.e. the n vertices connected to every two excluding method, n points twenty-two coupled with a N (N-1) / 2 edges, and as strongly connected graph is a directed graph, each edge so that there are two directions, N (N-1) / 2 * 2 = N (N-1 ), the strong graph vertices at most N N (N-1) edges;

Minimum conditions: i.e. N vertices in a circle, and each circle on the same direction, i.e., both clockwise or counterclockwise, then there are N edge.


6, to ensure communication without having to FIG apex 10, at least 37 edges.

Analysis One: To ensure communication without having vertices to FIG. 10, the focus is the need to ensure communication, it is necessary 9 is connected to the front twenty-two vertices, the vertex 10 can be added to ensure that the first time a communication guarantee edge. That is, from 9 arbitrarily selected two nodes link nodes, the need C (9,2) edges, plus the last edge, then the total number of edges: C (9,2) + 1 = (9 8) / (1 2) = 36, plus 1 equals 37.

Analysis II:

A minimum number of edges connected graph in this figure is the case where the circuit is not, in fact, this figure is a tree for a tree, the branch node, and the relationship is: 1 less than the number of branches of nodes.

supplement:

Total undirected graph, edges 1) having up to 10 vertices:

10*(10-1)/2=45;

2) G is a non-connected undirected graph, a total of 28 sides, the vertices of at least 9 in FIG.

Analysis: Suppose there are at least N vertices, since a non-connected graph, and to meet the edges 28, the top edge points N = +1 FIG completely (minimum vertex) 28 (FIG completely does not communicate with). FIG 28 is a complete number of edges, solution n (n-1) / 2 = 28, to obtain n = 8, and therefore N = 8 + 1 = 9;

7, the bit map method is used: free disk block allocation and recovery plate.

8, can be arranged to have any nodes of FIG topological sorting, and topological sort sequence is not unique. (Error, there is a ring will not work, directed acyclic graph to topological sorting)

Topological Sort:
1) selectively into a directed graph of vertices and from the output of 0;
2) deleting the vertex and all edges from the drawing, until there is the degree of the vertex 0.
After the cycle, if the output is smaller than the number of vertices number of vertices in the network, there are loops, or the sequence of vertexes is a kind of topological output.

Added: Is there a ring How to find a figure?


1) sorted by the topology, the loop is finished, the number of vertices if the output is smaller than the number of vertices in the network, there are loop, otherwise, the output sequence of vertexes is the topological sequence. (Also not output vertex, but has no predecessor vertex does not exist). Topological sorting using the premise is to have a complete graph.

2) undirected graph, when the depth-first traversal encountered back side (i.e., side vertex points that have been accessed), then there must be a ring; digraph with more complex dfs.


9, the minimum spanning tree of the graph G G1, the weight may be more than one edge side of the non-selected weights. (Correct, the minimum spanning tree is referred to as the minimum weight spanning tree, only to ensure that the minimum ownership, easy to find each path has minimum weight and value)



10, without having to n vertices, the use of a directed graph adjacency list is stored in the header size of the array of nodes: n.

Analysis: Properties of the adjacent table, the number of array head node there exist many nodes, the first node of each array point to the node directly connected to the node in FIG.
FIG adjacent table shows not only that the table node links related to the order;


11, in the absence = (V, E) containing the vertices of graph G 7, G is guaranteed in FIG communication any case, the minimum number of edges is required: 16.

Analysis: As with Question 6 analysis. The minimum number of edges in any case communication of the number of edges divided side edges without the most minimal waste, taking a full count is decreased FIG namely:
6
(6-1) / 2 = 15, together with an edge 16. The results obtained
*


Number of edges strongly connected graph 12, N vertices at least N.

Guess you like

Origin blog.csdn.net/weixin_40688217/article/details/94616832