The Software for Constructing Trails with Local Restrictions in Graphs

The present research considers the problem of covering a graph with minimal number of trails satisfying the pre-defined local restrictions. The research is devoted to the problem of graph covering by minimal number of trails satisfying some local restrictions. Algotithm of allowed Eulerian cycle construction is considered. The authors showed that it is possible to recognize the system of transitions and solve the problem of constructing the allowable path by linear time. It’s also possible to find allowable Eulerian cycle for Eulerian graph or to proclaim that such a cycle does not exist by the time      O V G E G   . All presented algorithms have the software realization.


Introduction
Lots of problems of finding paths satisfying the different restrictions can be applied to some practical problems.For example for sheet material cutting problem plane graph represents the model of cutting plan, and a path covering all its edges defines the trajectory of cutter.The restriction defined for this problem is lack of intersection of any initial part of path with edges that are not passed yet [1].Creating the control systems using non-oriented graphs the following problems of constructing the paths with different restrictions can arise.Among them are straight-ahead paths [2]; paths the next edge of which is defined by the given cyclic order on the set of incident edges [3][4][5]; paths for which it's necessary to pass some edges in pre-defined order [5].
The restrictions on the order of vertices and edges can be classified as local (the next edge of a path is defined by conditions established at the current vertex or edge [2][3][4][5][6][7][8]), and global (Eulerian, Hamiltonian cycles, bidirectional double tracing etc.).Most of researches are devoted to algorithms with local restrictions of edges order in a path.The present research considers the problem of covering a graph with minimal number of trails satisfying the pre-defined local restrictions.

Constructing of T G -Compatible Path
The generalization of most of particular cases for prob-lem of simple trail with local restrictions construction and analysis of its computing complexity is made by S.Szeider [7].
Let's quote the basic definitions and results of this research to make the further statements clear.Let's confine with finite simple graphs.Let's designate as   V G and   E G the sets of vertices and edges of graph G correspondingly.For vertex let's define the set The degree of vertex v let be designated as ; for let Definition 2. The system of allowed transitions (or shortly, system of transitions) G is called the set T v is full multipartite graph then a trail can be constructed by the following algorithm.

Algorithm -Compatible Path
Output:  The sequence of edges corresponding to G T -compatible trail between vertices x and y or the message that such a path does not exist.
Step 1.If vertex x or vertex y is isolated then stop: path does not exist.
Step 2. Delete all isolated vertices from graph G.
Step 3. Construct the supplementary graph G as following (Figure 1): where   , and edge    Step 5. Find the alternate sequence between vertices x and y that enlarges the cardinality of matching for graph G .If it's impossible to find such a sequence then stop (matching

 
M G has maximal cardinality and graph has no G -compatible path).Otherwise all the edges of found enlarging path except of additional edges of graph T G produce the -compatible path between vertices x and y.Stop.

G T
Let's admit that there is open question in research [7].This question is about recognition the multipartiteness of graphs   G T v .Problems of constructing the allowed path or set of paths covering all the edges of given graph are not also considered.
Let's illustrate an example of graph G (Figure 2) that algorithm G -COMPATIBLE PATH cannot be used for constructing of paths covering all edges of graph G. Let the following system of transitions is defined for the graph: Supplementary graph for finding of -compatible path between vertices and which construction is reviewed on step 3 of algorithm is shown at Figure 3.
The initial matching   M G is marked by thick lines.
The alternate enlarging sequence of edges for this matching be Edges of this sequence not belonging the initial matching are represented by dash line.These edges form the set    All edges of this set belonging to graph G i.e.    For exam e, for graph G presented on Figure 2 the path pl in principle cannot be received by constructing the matching of maximal weight for graph .This path G begins from edge 2 1 v v and ends by edge 5 2 v v .These edges form forbidden transition  

Algorithm for Co
In the previous section the restrictions for paths were sta lowed transitions system [7].It's ted in the terms of al shown that the problem of constructing the allowed path in graph G can be solved by polynomial time if a system of transitions G T consists only of matchings and full multipartite graphs.It's trivial to recognize if graph of allowed transitions belongs to the class of matchings.If we want recognize if transitions graph belongs to class of full multipartite graphs it's expedient to use the definition of partition system [3][4][5]8].
The conception of partition system is used for definition of allowed trail in terms of forbidden transitions.:

 
v which is the complement of allowed trans graph to full graph.Thus, using definitions 1-3 the problem either with use of allowed transitions or forbidden transitions can be stated.So the partition system is defined on the set of If edges e and e be 1 2 long to one subset then edge 2 e cannot be placed after the edge 1 e in a trail.Let graph   , G V E be defined b the adjacency list.Its elements are the structures.Each element of this structure consists of two fields: vertex number i v (this vertex is adjacent to the current one); the number of partition element i c .To define the degree of the current vertex it is enough to count the number of elements of adjacency list.
Let's admit that each edge e belongs to two adjacency lists of vertices i v and y j v (the ends of an edge).But for each vertex edge e belongs to different partition systems.
Input data are represented by the following list vector < list < pair <string, int> > > Graph; es, each All data are represented by a vector of vertic first el pair of ea dden transitions ement of this vector is a list of pairs.The ch list is a vertex number, the second one is its degree.The other pairs represent the numbers of adjacent vertices and number of corresponding partition set.
On the other side, graph of allowed transitions defined by partition system G P cannot be arbitrary, and belongs to class M of full multipartite graphs: the elements of partition  , and set of its edges Ob ously, complexity of checking the con Step 4. Find any edges   x. e 2 Step 6.5.
Step 7. Define the valu r of edges is a constant value and the number of vertices is increased by 1.
Step 8.If Step 10.Get vertices 1 v and 2 v from a list of marked and unmarked vertices of graph Step 11.Choose edges   All other ed are incident to vertex 1,2 v and go to step 9.
The following theorem i proved in [9].
Thus, the constructed algorithms are resolved by the polynomial time and can be simply realized using standard computing facilities.
Let's consider the allowed trail construction for a graph on Figure 5.Let its transitions system is as shown in a table below.The numbers in white circles show the number of partition system the edge belongs for each vertex.
Let's construct allowed Eulerian cycle beginning and ending at vertex 1.At the first iteration the first vertex is split.To simplify the illustration let's consider the "short version" of vertex splitting (the example of "full version" is presented on Figure 3).Figure 6 and table show graph with split vertex 1 and a list of connectivity where

1 .
the subgraph received of graph G by deleting of one set of vertices and only all edges incident to vertices of this set.Restrictions for paths in graph G can be defined in terms of allowed transitions graph.Definition Let vertices of which are the edges incident to vertex v i.e.G , and set of edges consists of allowed transitions.

Figure 1 .
Figure 1.Illustration how supplementary graph G is constructed.

Figure 3 .
Figure 3. Graph G' received of graph G by additional constructions.
G T -compatible path from .Using algor m -COMPATIBLE PATH bl re 4 shows the software realization of the represe G T a e to construct only simple trail between two different vertices (i.e. a trail where each vertex is presented only once).Figu nted algorithm.The bold line marks the found trail between vertices 1 and 4.This trail corresponds the system

Figure 4 .
Figure 4. Software for compatible path algorithm.

1 v
, consequently, graph G v s not contain the alternate path with both of these edges.Thus, the question of multipartite the set of paths covering all the edges of initial graph G.
 .Otherwise go to step 9. Step 9. Choose any vertex v and mark all achievable vertices.If there are unmarked ve go to step 10 otherwise stop the received graph 1 k G  is Eulerian trail without forbidden transitions.

Theorem 3 .
Algorithm G P -compa le Eulerian trail correctly solves the problem of constructing the co ges s tib G P mpatible Eulerian trail.That paper also shows that computing complexity of this algorithm is If all graphs of transitions belong either class M of full multipartite graphs or class P of matchings then the problem of GT -compatible trail constructing can be solved by the time Theorem 1 [S.Szeider].