Accessibility query based on the number of two-dimensional Topologies

Source: Internet
Author: User
1. Basic Concepts

In a directed acyclic graph, R (u, v) indicates whether there is a path between u and v. When there is a path between U and V, R (u, v) returns true, that is, u to V is reachable; otherwise, false is returned, that is, not reachable.

Any directed graph can be converted to a directed acyclic graph. For detailed conversion methods, see (http://blog.csdn.net/woniu317/article/details/23658301 ). After the nodes in the same strongly connected component are converted, the nodes become a node. When querying the accessibility, You can first convert them to nodes in the acyclic graph and then query them. Therefore, you only need to study Directed Acyclic graphs for all accessible queries.

2. Basic Ideas

To analyze any topology sequence of an image, you can obtain the following information:

If the node u reaches the node V, the topological sequence number of the u must be smaller than that of the V. That is to say, when the topological sequence number of the node u is greater than that of the V, then u cannot reach v.

As shown in Table 2-1, T1 is a topological sequence of the graph. For example, the sequence numbers from A to H can be reached, and the sequence numbers of A are smaller than h. The serial numbers of G are greater than H, so g cannot be H, which can be verified from Figure 2-1. It is worth noting that even if the serial number of U is smaller than the serial number of V, u may not necessarily reach V, such as node A and B.

It is not difficult to find that there are many node pairs that cannot be trimmed using the topological order in table 2-1, such as (A, B), (A, G), (A, F ). The same situation occurs even if you change the topological order. Therefore, it is better to use both topological order for trimming. But how to obtain the two topological orders so that the pruning effect is better than the NPC problem, so we use an approximate method to obtain the second topological sequence.

Figure 2-1 Figure G

Table 2-1 Figure 2-1 topological Sequence

When the second topology sequence is solved, the first node number with a large topological number is given for all nodes with a 0 inbound level, which enhances the filtering effect of the two-dimensional topology sequence. Figure 2-1 shows the topological sequence number of the second request, as shown in column T2 in Table 2-1.

If u reaches V, the two topological numbers of u must correspond to the topological numbers smaller than v. Similarly, if neither of the two topological sequence numbers of u is smaller than that of V, u cannot reach v.

3. Accessibility Query

Accessibility query uses the depth-first Traversal method. The Query Process is 3-1.

Figure 3-1 Flowchart

References

Reachabilityqueries in very large graphs a fast refined online search approach

Accessibility query based on the number of two-dimensional Topologies

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.