Home Technique Connectivity

Connectivity



Nature

(1) The subset of the real set is connected, and when it is only one interval;

(2) connectivity by the same embryo Keep, thus the topology of the space;

(3) Ω is a quad set of X, which is the entire space X, an individual in each Ω, and two or two are not separated ( That is, the closure of the two sets is non-empty), referred to as 'X connect';

(4) If X, Y is connected, the product space X × Y is connected.

Other related concepts

Connection Space

Definition 1: Set X is a topology space. If there are two non-empty isolation subsets A and B in X, X = a∪ B is called X is a non-communication space; otherwise, X is a communication space.

Local communication space

Definition 2: Set X is a topological space. If each neighborhood of x∈ X contains an incomputomatic neighborv of X, the topology space is said to be locally connected at point X. If the topological space X is partially connected at each point, it is called a partial communication space.

The topology space of local communication is not necessarily connected. For example, each discrete space is partial communication space, but the discrete space containing more than one point is not a communication space. For example, any of the N-dimensional space

is partially connected (this is because each spherical neighborhood is equipped with embryo to the entire Europian space, which is connected), In particular, the European space itself is partially connected. On the other hand, the European space is not connected by two non-air openings and as sub-spaces.

It can be found according to the definition: Topology Space X At point x

x is partially connected, and only when the X of all communication neighborhoods constitute a neighborhood base.

Road communication space

Definition 3: Set X is a topological space, if there is a road (or curve) from x to y for any x, y, there is a road (or curve) We said that X is a road connectivity space. One subset Y in X is called a road connecting subset in X, and if it is a sub-space of x, it is a road communication space.

Real space R is a road communication, because if X, Y

r, continuous mapping F: [0, 1]
R definition For any T
[0, 1] F (t) = x + t (yx), it is a road in R in the R in the R. It is also easy to verify that any interval is connected.

Connectivity problem

Introduction

Assuming an integer pair, P-Q is interpreted as P and Q communication. As shown in Figure 1. If the new input is paired, it will not be output by the previous input. If it is not possible to connect, this is output. For example, 2-9 is not in the output, since the front pair is in communication with 2-3-4-9.

It can be applied as follows:

(1) integer represents the network node, connects to the network, so the network can determine whether the P and Q should be connected.

(2) grid.

(3) is even more even two equivalent variables defined in the program.

Algorithm implements

First assumes that each node connected in connection is present in an array, each time you select two nodes, and it is determined whether the two nodes are connected.

(1) Quick-Find Algorithm: The program is shown in Figure 2, and the program is met and only when P is in communication with Q, ID [P] is equal to ID [q].

(2) Quick Equipment Algorithm: Compared to the above algorithm, the calculation amount is small, and the amount of operation is large, the calculation is large, and the algorithm is improved. At the same time: Each node is shifted onto the tree, finds the respective root node (root). The specific program is shown in Figure 3.

(3) Rapid settlement algorithm:

The above algorithm, we can't guarantee each case, its speed is more substantive than fast finding. This is a modified version, which uses an additional array SZ to complete the maintenance purpose, indicating that each object is expressed in ID [i] == i, which can organize the growth of the tree. Figure 4 depicts a quick and aggregate algorithm, when connecting two trees, the smaller number of roots is to be attached to a large number of roots. Such a node and the root are short, mostly high in finding efficiency.

As shown in FIG. 4, when processing 1 and 6, let 1, 5, 6 point to 3, the resulting tree is more flat than the above algorithm.

This article is from the network, does not represent the position of this station. Please indicate the origin of reprint
TOP