Euler's loop of a hybrid Graph

Source: Internet
Author: User

Hybrid graph:That is to say, some sides have direction, and some sides have no direction.

Definition:

For a loop in Figure G, if it passes through every edge in G, it is calledEuler's (Euler) loop. An image with Euler's loop is calledEurope(E chart ).

Theorem:

An undirected graph is Euclidean, and only when all vertices in the graph are even.

A directed graph is Euclidean, and only when all vertices of the graph are 0.

A sufficient condition for a directed graph to have an Euler Loop: The base graph (the graph obtained after the directed edge is changed to the undirected edge) is connected, and the outbound degree of each vertex is equal to the inbound degree.

Therefore, the key to finding a hybrid graph is to determine whether a ing exists so that the inbound degree of each node is equal to the outbound degree.

 

Therefore, you can use network streams. There are two ways to build the edge: black books. Here we will talk about the second method, which is better. The number of points in the graph is n + 2, and the number of edges is m + n. Where, N indicates the number of origins, and M indicates the number of original edges.

I didn't understand what I said in the black book. Based on my own understanding, I would like to explain the graph creation process.

In the source image, each undirected edge is first directed randomly to form a directed graph. The degree deg of each vertex is calculated, the inbound degree is positive, and the outbound degree is negative, if the deg of a certain point is an odd number, there is obviously no Euler loop. Because the original directed edge cannot be changed, it is useless and deleted. It is a directed graph formed after the undirected edge in the source image. If the vertex I to J has an arc, arc <I, j> capacity plus 1 (when I to J has multiple edges, there is a duplicate edge, one edge can be added, multiple capacities can be replaced) Increase source point S, sink point t, for each vertex I, if deg <0, that is, the outbound degree is greater than the inbound degree, an arc is introduced from S to I, and the capacity is (-deg)/2; If deg> 0, that is, the inbound degree is greater than the outbound degree, leading an arc from I to t, and the capacity is deg/2. If deg = 0, edge creation is not required. Find the maximum stream of the new network. If all the arcs starting from S are fully loaded, the Euler loop exists and all the arcs with streaming are reversed (if the size of a side is greater than 1, the traffic is, A few sides in the reverse direction). After adding the directed edge in the source image again, a directed Euler loop is obtained.

Full load is used to balance the traffic, so that the inbound and outbound degrees of each vertex are equal.

Why can we get an Euler loop by turning the stream edge back?

Think about it: if there is a stream edge <u, v> reverse, then deg [u] increases by 2, deg [v] reduces by 2, this is why DEG is divided by 2 when the arc is started. Each traffic increase has a path from the start point to the end point, and all vertices in the path are reversed, the degree of the starting point increases by 2, the degree of the ending point decreases by 2, and the degree of the intermediate point remains unchanged. If the starting point has this traffic, it indicates that the outbound traffic is large and the inbound traffic is small, you need to change the edge so that the final exit is equal to the inbound. The nature of the maximum stream is exactly the same. If all the s-to-v arcs are full, then the above operation is performed, the exit degree of the V point must be equal to the inbound degree. If all the arcs starting from S are full, a directed Euler's loop is obtained for the source image.

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.