Algorithm for constructing support tree of connected graph

By obtaining the vertex subset S of the connected graph and constructing the support tree T using the breadth priority algorithm, the problem of degree consistent support tree of the connected graph is solved, and the rapid finding of multiple degree consistent vertices in network design is realized, reducing the usage of the hydraulic gauge, and improving design efficiency.

CN120562081APending Publication Date: 2025-08-29NANTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510665591.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-22
Publication Date
2025-08-29

AI Technical Summary

Technical Problem

There is a lack of a method to solve the problem of consistent support tree for connectivity maps in the prior art, which makes it difficult to reduce the number of installations of hydraulic gauges.

Method used

By obtaining the vertex subset S of the connected graph, and using the breadth priority algorithm to construct the support tree T, combined with the transformation of the support tree, ensuring that each vertex in S is a degree-consistent vertex, and then constructing another support tree T' of G.

Benefits of technology

It realizes the rapid search for as many degree consistent vertices as possible in network design, reduces the use of hydraulic gauge, and improves design efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120562081A_ABST
    Figure CN120562081A_ABST
Patent Text Reader

Abstract

The invention relates to the field of connectivity and the technical field of network design, and discloses an algorithm for constructing a support tree of a connected graph. Comprising the steps that a connected graph G is acquired, the number of vertexes of the connected graph G is n, and the maximum degree is delta; for a vertex u of G, recording a vertex set adjacent to u as N (u), and letting N [u] = N (u) U {u}; the number of the vertexes in N (u) is called the degree of u, and the maximum value of the degrees of all the vertexes in G is called the maximum degree of G; a vertex subset S = {v1, v2,..., vk} of the connected graph G is obtained, so that for any vertex vi (i > = 2) in the vertex subset S, N (vi) nN (Si-1) < = 1 exists, and Si-1 = {v1, v2,..., vi-1}; calculating the number of vertexes # imgabs0 # contained in the vertex set S, using a breadth-first algorithm to obtain a support tree T of a connected graph G, and constructing another support tree T'of the connected graph G from T by using the transformation of the support tree, so that each vertex in the S is a vertex with consistent degree; the method has the advantage that degree consistent vertexes of T are as many as possible.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of connectivity in a network and the technical field of network design, and in particular to an algorithm for constructing a spanning tree of a connectivity graph. Background Art

[0002] The spanning tree of a connected graph is a connected, acyclic, and supported subgraph of the graph. It maintains connectivity while maintaining a simple structure. Spanning trees of connected graphs have important applications in computer science, communications engineering, network design, and other fields. For example, the minimum spanning tree can be used to solve optimal path planning problems. In network design, spanning trees can be used to determine network topology to minimize communication costs or maximize network capacity.

[0003] One application of the degree-consistent spanning tree of a connected graph involves the problem of installing water pressure gauges in a water network. To control water flow in a water network, how can one install water pressure gauges in a way that minimizes the number of gauges used? This problem can be solved using graph theory. Consider a water network as a connected graph G. Then, label each edge of G with the direction and flow rate of the water flow. With the exception of the source and confluence, the amount of water flowing into a vertex is equal to the amount flowing out. Therefore, by measuring the flow rate of the edges of a co-tree of a spanning tree of G, the flow rate of all edges can be determined. Since each edge is associated with two vertices, water pressure gauges can be installed at vertices to control the edges of those co-trees, thereby reducing the number of water pressure gauges used. It is not difficult to see that the fewer vertices selected, the fewer water pressure gauges are used. Given that the number of edges associated with a vertex is at most its degree in G, the problem of installing water pressure gauges in a water network can be transformed into the problem of finding a spanning tree T of G with as many degree-consistent vertices as possible. This is the degree-consistent spanning tree problem of G. The prior art lacks a method for solving the degree-consistent spanning tree problem of connected graphs.

[0004] Therefore, an algorithm for constructing a spanning tree of a connected graph is provided to solve the above problem. Summary of the Invention

[0005] The main purpose of the present invention is to solve the problem that there is a lack of a method for solving the problem of uniform spanning tree of connected graph in the prior art.

[0006] The present invention provides an algorithm for constructing a spanning tree of a connected graph, the algorithm for constructing a spanning tree of a connected graph comprising:

[0007] S101. Obtain a vertex subset S of a connected graph G = {v1, v2, ..., v k}, so that for any vertex v in S i (i≥2), all have |N(v i )∩N(S i-1)|≤1, where S i-1 ={v1,v2,…,v i-1};

[0008] S102. Calculate the number of vertices contained in the vertex set S

[0009] S103. Use the breadth-first algorithm to obtain a spanning tree T of the connected graph G. Starting from T, use the transformation of the spanning tree to construct another spanning tree T' of G, so that each vertex in S is a vertex with consistent degree.

[0010] Furthermore, the acquisition of a vertex subset S of a connected graph G = {v1, v2, ..., v k}, so that for any vertex v in S i (i≥2), all have |N(v i )∩N(S i-1 )|≤1, where S i-1 ={v1,v2,…,v i-1 The specific process includes:

[0011] Suppose the number of vertices in the connected graph G is n and the maximum degree is Δ;

[0012] For a vertex u in G, the set of vertices adjacent to u is denoted as N(u), let N[u]=N(u)∪{u};

[0013] The number of vertices in N(u) is called the degree of u, and the maximum degree of all vertices in G is called the maximum degree of G;

[0014] Get a vertex subset S of the connected graph G = {v1,v2,…,v k}, so that for any vertex v in the vertex subset S i (i≥2), all have |N(v i )∩N(S i-1 )|≤1, where S i-1 ={v1,v2,…,v i-1}.

[0015] Furthermore, the acquisition of a vertex subset S of the connected graph G = {v1, v2, ..., v k Specifically include:

[0016] Select a vertex v1 in G; let S1 = {v1}, and then let S'1 = V(G)-N[v1];

[0017] When i≥1, if S i , S' i Already obtained, then S i+1 , S'i+1 The construction is as follows:

[0018] From S' i Select one that satisfies the following conditions|N(v i+1 )∩N(S i )|≤1 vertex v i+1 ;

[0019] Let S i+1 =S i ∪{v i+1}, S' i+1 =S' i -N[v i+1 ];

[0020] Until a certain step k, the vertex set S is obtained k 、S' k , so that S' k Until it is an empty set;

[0021] Let S = S k , then S={v1,v2,…,v k} is the desired set.

[0022] Furthermore, the condition |N(v i+1 )∩N(S i )|≤1 is used to ensure that 2,1 There exists an edge that is neither adjacent to v1 nor adjacent to v2.

[0023] Furthermore, the number of vertices contained in the computing vertex set S is include:

[0024] Let Y = N[S k ], then let Y'=V(G)-Y; since the maximum degree of G is Δ,

[0025] So we get formula 1: |Y|≤|S k |+|N(S k )|≤k+kΔ=k(1+Δ);

[0026] Because each vertex in Y' is adjacent to at least two vertices in Y, and the vertices in Y' are only adjacent to N(S k ) are adjacent, so 2|Y'|≤kΔ(Δ-1);

[0027] This gives Formula 2:

[0028] Since |Y|+|Y'|=n, we get Formula 3:

[0029] This gives Formula 4:

[0030] Furthermore, the breadth-first algorithm is used to obtain a spanning tree T of the connected graph G. Starting from T, another spanning tree T' of G is constructed by using the transformation of the spanning tree, so that every vertex in S has the same degree. Vertices include:

[0031] Let T1 be a spanning tree of G obtained by the breadth-first algorithm, and v1 be the root of T1; in this case, v1 is a degree-consistent vertex;

[0032] set up is the set of edges of v2 in the cotree of T1; determine whether E2 is an empty set; if not, first add edge e 2,1 Added to T1, the only circle C appears in the resulting graph 2,1 , and this circle passes through e 2,1 ; Then, delete C 2,1 If there is an edge in G that is neither adjacent to v1 nor to v2, we get another spanning tree T2 of G;

[0033] The edge e 2,2 Add to T2, repeat for e 2,1 the operations performed; Repeat the process for e 2,1 The operation is performed; a new spanning tree of G is obtained, so that v1 and v2 are both vertices with the same degree;

[0034] Vertices v3, v4, …, v t Perform the same operations on v2 in sequence; finally, obtain a spanning tree T' of G, such that every vertex in S is a degree-consistent vertex.

[0035] The present invention provides an algorithm for constructing a spanning tree of a connected graph, which can effectively solve the problem of a degree-consistent spanning tree of G. It has applications in network design, social network analysis, and computer science, and is particularly applicable to the setting of surveillance cameras in road networks. It can improve design efficiency, reduce design difficulty, and quickly find a spanning tree with as many degree-consistent vertices as possible in a connected graph. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 It is a schematic diagram of the process of the present invention;

[0037] Figure 2 is a schematic diagram of an embodiment of the present invention;

[0038] Figure 3 A schematic diagram of a spanning tree obtained by a breadth-first algorithm according to an embodiment of the present invention;

[0039] Figure 4This is a schematic diagram of a spanning tree with three degree-consistent vertices obtained by spanning tree transformation of S according to an embodiment of the present invention. DETAILED DESCRIPTION

[0040] The embodiment of the present invention provides an algorithm for constructing a spanning tree of a connected graph, comprising: S101, obtaining a vertex subset S of a connected graph G = {v1, v2, ..., v k}, so that for any vertex v in S i (i≥2), all have |N(v i )∩N(S i-1 )|≤1, where S i-1 ={v1,v2,…,v i-1}; S102, calculate the number of vertices contained in the vertex set S S103. Use the breadth-first algorithm to obtain a spanning tree T of the connected graph G. Starting from T, use the transformation of the spanning tree to construct another spanning tree T' of G, so that each vertex in S is a degree-consistent vertex. The main purpose of the present invention is to solve the problem that there is a lack of a method for solving the problem of degree-consistent spanning trees for connected graphs in the prior art.

[0041] The terms "first," "second," "third," "fourth," and the like (if any) in the description and claims of the present invention and in the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to these processes, methods, products, or apparatus.

[0042] To facilitate understanding, the specific process of an embodiment of the present invention is described below. The first embodiment of the algorithm for constructing a spanning tree of a connected graph provided by the present invention includes:

[0043] S101. Obtain a vertex subset S of a connected graph G = {v1, v2, ..., v k}, so that for any vertex v in S i (i≥2), all have |N(v i )∩N(S i-1 )|≤1, where S i-1 ={v1,v2,…,v i-1};

[0044] S102. Calculate the number of vertices contained in the vertex set S

[0045] S103. Use the breadth-first algorithm to obtain a spanning tree T of the connected graph G. Starting from T, use the transformation of the spanning tree to construct another spanning tree T' of G, so that each vertex in S is a vertex with consistent degree.

[0046] The method of obtaining a vertex subset S of a connected graph G is as follows: k}, so that for any vertex v in S i (i≥2), all have |N(v i )∩N(S i-1 )|≤1, where S i-1 ={v1,v2,…,v i-1 The specific process includes:

[0047] Suppose the number of vertices in the connected graph G is n and the maximum degree is Δ;

[0048] For a vertex u in G, the set of vertices adjacent to u is denoted as N(u), let N[u]=N(u)∪{u};

[0049] The number of vertices in N(u) is called the degree of u, and the maximum degree of all vertices in G is called the maximum degree of G;

[0050] Get a vertex subset S of the connected graph G = {v1,v2,…,v k}, so that for any vertex v in the vertex subset S i (i≥2), all have |N(v i )∩N(S i-1 )|≤1, where S i-1 ={v1,v2,…,v i-1}.

[0051] The method of obtaining a vertex subset S of the connected graph G is as follows: {v1, v2, ..., v k Specifically include:

[0052] Select a vertex v1 in G; let S1 = {v1}, and then let S'1 = V(G)-N[v1];

[0053] When i≥1, if S i , S' i Already obtained, then S i+1 , S' i+1 The construction is as follows:

[0054] From S' i Select one that satisfies the following conditions|N(v i+1)∩N(S i )|≤1 vertex v i+1 ;

[0055] Let S i+1 =S i ∪{v i+1}, S' i+1 =S' i -N[v i+1 ];

[0056] Until a certain step k, the vertex set S is obtained k 、S' k , so that S' k Until it is an empty set;

[0057] Let S = S k , then S={v1,v2,…,v k} is the desired set.

[0058] Condition|N(v i+1 )∩N(S i )|≤1 is used to ensure that 2,1 There exists an edge that is neither adjacent to v1 nor adjacent to v2.

[0059] The number of vertices contained in the calculation vertex set S include:

[0060] Let Y = N[S t ], then let Y'=V(G)-Y; since the maximum degree of G is Δ,

[0061] So we get formula 1: |Y|≤|S k |+|N(S k )|≤k+kΔ=k(1+Δ);

[0062] Because each vertex in Y' is adjacent to at least two vertices in Y, and the vertices in Y' are only adjacent to N(S k ) are adjacent, so 2|Y'|≤kΔ(Δ-1);

[0063] This gives Formula 2:

[0064] Since |Y|+|Y'|=n, we get Formula 3:

[0065] This gives Formula 4:

[0066] The breadth-first algorithm is used to obtain a spanning tree T of the connected graph G. Starting from T, another spanning tree T' of G is constructed by using the transformation of the spanning tree, so that every vertex in S has the same degree. Vertices include:

[0067] Let T1 be a spanning tree of G obtained by the breadth-first algorithm, and v1 be the root of T1; in this case, v1 is a degree-consistent vertex;

[0068] set up is the set of edges of v2 in the cotree of T1; determine whether E2 is an empty set; if so, consider v3; if not, first add edge e 2,1 Added to T1, the only circle C appears in the resulting graph 2,1 , and this circle passes through e 2,1 ; Then, delete C 2,1 If there is an edge in G that is neither adjacent to v1 nor to v2, we get another spanning tree T2 of G;

[0069] The edge e 2,2 Add to T2, repeat for e 2,1 the operations performed; Repeat the process for e 2,1 The operation is performed; a new spanning tree of G is obtained, so that v1 and v2 are both vertices with the same degree;

[0070] Vertices v3, v4, …, v t Perform the same operations on v2 in sequence; finally, obtain a spanning tree T' of G, such that every vertex in S is a degree-consistent vertex.

[0071] This embodiment is a second embodiment of an algorithm for constructing a spanning tree of a connected graph, including:

[0072] Step 1. For a connected graph G, use the breadth-first algorithm to find a spanning tree T1 of G.

[0073] Step 2. Give an algorithm to find a vertex subset S = {v1, v2, ..., v k}, so that for any vertex v in S i (i≥2), all have |N(v)∩N(S i-1 )|≤1, where S i-1 ={v1,v2,…,v i-1}.

[0074] Step 3. Give an algorithm, starting from the spanning tree T1, using the transformation of the spanning tree of S, to construct a spanning tree so that every vertex in S is a degree-consistent vertex

[0075] like Figure 2As shown, the present invention provides an embodiment, which is a connected graph G with 10 vertices: x1, x2, ..., x 10 , and the maximum degree Δ=7.

[0076] like Figure 3 As shown, by using the breadth-first algorithm, a spanning tree of the embodiment can be obtained.

[0077] For the embodiment, using the following algorithm, a vertex subset S = {x1, x9, x4} of the embodiment can be obtained.

[0078] The specific algorithm is as follows:

[0079] 1. Let S1 = {x1}, then let S'1 = V(G)-N[v1] = {x3,x4,x7,x8,x9,x 10}.

[0080] 2. In S'1, it is obvious from T1 that the vertices closest to x1 are x3, x7, x9, x 10 .

[0081] 3. Among the four vertices above, only vertex x9,x 10 The following conditions are met: |N(x9)∩N(x1)|≤1, |N(x 10 )∩N(x1)|≤1.

[0082] 4. Select vertex x9, let S2 = {x1, x9}, and then let S'2 = S1'-N[x9] = {x3, x4, x7, x8}.

[0083] 5. In S'2, from T1, we see that x3 and x7 are vertices with a distance of 1 from S2. However, |N(x3)∩N(S2)|=2 and |N(x7)∩N(S2)|=2. Therefore, neither x3 nor x7 can be selected. Consider x4 and x8, whose distances from S2 are 2, and |N(x4)∩N(S2)|=0 and |N(x8)∩N(S2)|=0. Select vertex x4.

[0084] 6. Let S3 = {x1, x9, x4}, and then let S'3 = S'2-N[x4], then S'3 is an empty set, and the process ends.

[0085] 7. Let S = S3, then S is the required vertex set.

[0086] Obviously, |S|=3. So, Here n=10, Δ=7.

[0087] like Figure 4 As shown, the present invention provides an algorithm for forming a spanning tree in which all vertices in S are degree-consistent vertices.

[0088] 1. Take the following example Figure 3 The spanning tree shown is denoted as T1. At this time, in T1, x1 is a degree-consistent vertex.

[0089] 2. Make the side x9x 10 Add to T1 and get the only circle x6x9x 10 x6, delete side x 10 x6, we get another spanning tree T2 in the embodiment. In T2, x1 and x9 are both degree-consistent vertices.

[0090] 3. Add the edge x4x8 to T2 to obtain a unique cycle x3x4x8x3. Delete the edge x3x8 to obtain a spanning tree T3 in the embodiment.

[0091] 4. Add the edge x4x7 to T3 to obtain a unique cycle x2x3x4x7x2. Delete the edge x7x2 to obtain a spanning tree T4 in the embodiment. In T4, x1, x9, and x4 are all degree-consistent vertices.

[0092] 5.T4 is the desired supporting tree. End.

[0093] In T4, every vertex in S is a degree-consistent vertex of the embodiment. In addition, Figure 4 It can be seen that S is also a control set of the embodiment.

[0094] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that the technical solutions described in the above embodiments can still be modified, or some of the technical features thereof can be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. An algorithm for constructing a spanning tree of a connected graph, characterized in that The algorithm for constructing a connected graph spanning tree includes: S101. Obtain a vertex subset S of a connected graph G = {v1, v2, ..., v k }, so that for any vertex v in S i (i≥2), all have |N(v i )∩N(S i-1 )|≤1, where S i-1 ={v1,v2,…,v i-1 }; S102. Calculate the number of vertices contained in the vertex set S S103. Use the breadth-first algorithm to obtain a spanning tree T of the connected graph G. Starting from T, use the transformation of the spanning tree to construct another spanning tree T' of G, so that each vertex in S is a vertex with consistent degree.

2. The algorithm for constructing a spanning tree of a connected graph according to claim 1, characterized in that The method of obtaining a vertex subset S of a connected graph G is as follows: k }, so that for any vertex v in S i (i≥2), all have |N(v i )∩N(S i-1 )|≤1, where S i-1 ={v1,v2,…,v i-1 The specific process includes: Suppose the number of vertices in the connected graph G is n and the maximum degree is Δ; For a vertex u in G, the set of vertices adjacent to u is denoted as N(u), let N[u]=N(u)∪{u}; The number of vertices in N(u) is called the degree of u, and the maximum degree of all vertices in G is called the maximum degree of G; Get a vertex subset S of the connected graph G = {v1,v2,…,v k }, so that for any vertex v in the vertex subset S i (i≥2), all have |N(v i )∩N(S i-1 )|≤1, where S i-1 ={v1,v2,…,v i-1 }.

3. The algorithm for constructing a spanning tree of a connected graph according to claim 1, wherein: The method of obtaining a vertex subset S of the connected graph G is as follows: {v1, v2, ..., v k }specific include: Select a vertex v1 in G; let S1 = {v1}, and then let S'1 = V(G)-N[v1]; When i≥1, if S i , S′ i Already obtained, then S i+1 , S′ i+1 The construction is as follows: From S′ i Select one that satisfies the following conditions|N(v i+1 )∩N(S i )|≤1 vertex v i+1 ; Let S i+1 =S i ∪{v i+1 }, S′ i+1 =S' i -N[v i+1 ]; Until a certain step k, the vertex set S is obtained k 、S' k , so that S' k Until it is an empty set; Let S = S k , then S={v1,v2,…,v k } is the desired set.

4. The algorithm for constructing a spanning tree of a connected graph according to claim 3, wherein: Condition|N(v i+1 )∩N(S i )|≤1 is used to ensure that 2,1 There exists an edge that is neither adjacent to v1 nor adjacent to v2.

5. The algorithm for constructing a spanning tree of a connected graph according to claim 1, characterized in that The number of vertices contained in the calculation vertex set S include: Let Y = N[S k ], then let Y'=V(G)-Y; since the maximum degree of G is Δ, So we get formula 1: |Y|≤|S k |+|N(S k )|≤k+kΔ=k(1+Δ); Because each vertex in Y' is adjacent to at least two vertices in Y, and the vertices in Y' are only adjacent to N(S k ) are adjacent, so 2|Y'|≤kΔ(Δ-1); This gives Formula 2: Since |Y|+|Y'|=n, we get Formula 3: This gives Formula 4:

6. The algorithm for constructing a spanning tree of a connected graph according to claim 1, wherein: The breadth-first algorithm is used to obtain a spanning tree T of the connected graph G. Starting from T, another spanning tree T' of G is constructed by using the transformation of the spanning tree, so that every vertex in S has the same degree. Vertices include: Let T1 be a spanning tree of G obtained by the breadth-first algorithm, and v1 be the root of T1; in this case, v1 is a degree-consistent vertex; set up is the set of edges of v2 in the cotree of T1; determine whether E2 is an empty set; if not, first add edge e 2,1 Added to T1, the only circle C appears in the resulting graph 2,1 , and this circle passes through e 2,1 ; Then, delete C 2,1 If there is an edge in G that is neither adjacent to v1 nor to v2, we get another spanning tree T2 of G; The edge e 2,2 Add to T2, repeat for e 2,1 the operations performed; Repeat the process for e 2,1 The operation is performed; a new spanning tree of G is obtained, so that v1 and v2 are both vertices with the same degree; Vertices v3, v4, …, v t Perform the same operations on v2 in sequence; finally, obtain a spanning tree T' of G, such that every vertex in S is a degree-consistent vertex.

7. The algorithm for constructing a spanning tree of a connected graph according to claim 6, characterized in that: If E2 is an empty set, then consider v3.