Sei sulla pagina 1di 10

Graph reduction algorithm without information loss

Rafael Rodríguez-Puente and Manuel S. Lazo-Cortés


University of Information Science, Havana, Cuba
rafaelrp@uci.cu , manuellazo55@gmail.com
Summary.Algorithms related to graph theory have been various types of problems and responses in less
extensively studied. Several studies focus on reducing the time Obtaining optimal time.
complexity of these algorithms. The techniques used in this
Keywords. Graph reduction, graph rewriting, shortest
sense, are generally based on a graph or reduce the search
path search.
space solution, eliminating redundant for the specific problem
to be solved information. The reduction process involves
obtaining a graph smaller graphs (with fewer vertices) having
major or important characteristics of the original graph. In the 1. Introduction
case of finding optimal paths, algorithms that make use of
graph reduction or solution search space, do not guarantee Graph theory has been extensively studied in
obtaining optimal in all cases. The same goes for other types recent years, with emphasis on graph algorithms.
of problems such as reduced workflow graph networks, Several of these algorithms have high
computer, etc. This paper presents an algorithm is proposed computational cost and some are designed to solve
graph reduction without loss of information. The proposal has NP or NP-Hard. Therefore, studies are related to
a flexible way to specify how you want to reduce the graph; reducing the computational complexity of these
therefore it can be used in solving various types of problems,
algorithms.
contributing to obtaining optimal responses in less time.
One strategy that has been used is to reduce
Keywords. Graph reduction, graph rewriting, finding the graph considering the problem being solved.
optimal paths. This is supported by the fact that the execution time
of these algorithms generally depends on the
Graph Reduction Algorithm number of vertices in the graph in question.
without Loss of Information The reduction process involves obtaining a
graph smaller graphs (with fewer vertices) having
Abstract. Algorithms related to graph theory Have Been major or important characteristics of the original
Widely Studied. Several studies Deal with the temporary graph.
reduction of complexity of These algorithms. The In the literature review on this subject, it is
techniques used in esta sense are based on Generally
appreciated that various reduction algorithms are
the graph or reducing the search space of solution.
These Approaches remove redundant information for a
focused on keeping the relevant features of graphs
specific kind of problem. The process of reducing a representing road networks. This is done in order
graph is based on Obtaining smaller graphs (with fewer to reduce the time in finding optimal paths.
vertices) with Major or the Relevant Characteristics of In this sense we can mention several papers, for
the original graph. Algorithms That Make use of the example, in [7] Gutman proposes an algorithm in
graph reduction approach (or reduction of solution which an attribute of the vertices called reach
search space) for the shortest path search do not
defined, this attribute is a measure of the relevance
guarantee an optimal path Obtaining in all cases. The
same Applies to other types of problems: such as of the vertex. REACH attribute is calculated using
reduction in workflow graph networks, computer the graph, it helps reduce the execution time in
networks, etc. In This paper we propose a graph finding optimal paths reducing the search space
reduction algorithm without loss of information. Our solution.
method is Characterized by a flexible, way to specify in A significant reduction algorithm proposed in
what manner it desirable to reduce in GIVEN graph.
graphs representing road networks, uses the
THEREFORE, our proposal can be used in solving
network hierarchy reduction criterion. Several

Computing and Systems Vol. 18 No. 1, 2014 pp. 185-194


ISSN 1405-5546
http://dx.doi.org/10.13053/CyS-18-1-2014-027
186 Rafael Rodríguez-Puente and Manuel S. Lazo-Cortés

strategies use this, for example, [18] an algorithm an algorithm that eliminates edges that are not
is proposed to construct hierarchies of networks necessary to solve this problem.
and run queries on it. The authors reach shorter
execution times and show the feasibility of the The above, remove or do not consider
proposal. Another proposal introduces a similar information that is not necessary mechanisms to
proposed by Gutman [1] approach. The authors solve a specific problem, but it may be necessary
use relevant nodes (transit nodes) for long distance to solve other problems.
travel, pre-calculating the optimum paths between In the case of finding optimal paths, algorithms
each pair of nodes and relevant from each source that make use of reduced graphs or solution search
and target potential to these relevant nodes. space, do not guarantee obtaining optimal in all
In [6] the hierarchy of the road network to cases.
partition the network into areas and precompute the Because of this situation, in this paper an
optimum paths in these areas is used. This algorithm graph reduction is proposed without loss
approach utilizes the fact that some streets are of information. The proposal has a flexible way to
busier than others and some drivers prefer to travel specify how you want to reduce the graph;
the longest streets. therefore it can be used in solving various types of
problems, contributing to obtaining optimal
In [5] an approach that uses only the edges that
responses in less time.
connect important nodes is proposed. They are
also designed algorithms that mimic human The paper is organized as follows: first the
behavior using the hierarchy of the road network theoretical foundations used in the proposed
[14]. This approach is based on the idea that to reduction algorithm are presented, then the
calculate long routes (in large networks), only the reduction algorithm is described and pseudocode
higher-level streets (highways, avenues, etc.) are thereof is presented below show the validity of the
needed. This consideration helps to reduce the reduction algorithm is performed and finally the
response time of the algorithm, however, does not conclusions are stated.
guarantee the optimum in all cases. 2. Theoretical Foundations
These mechanisms can be viewed as
algorithms for graph reduction finding optimal paths For the development of this work the following
and consequently to obtain faster response times. conceptual framework is used.
Moreover, the graph reduction has been applied Definition 1.A graph or undirected graph 𝐺 =
in other areas, such as: (𝐺, 𝐺) is defined as a nonempty vertex finite 𝐺 set
and and a multiset 𝐺 of edges, where each edge
- Workflow networks. A method used to remove
𝐺𝐺, 𝐺𝐺 is an unordered pair of vertices (𝐺𝐺, 𝐺𝐺 ∈
structural conflicts based on the graph
𝐺). In this case we say that 𝐺𝐺 and 𝐺𝐺 are
reduction. This method is to identify certain
adjacent. Optionally an edge may have an
structures (eg, cycles) and simplified as shown
associated value that identifies and a list of
in [12, 13, 17]. In [11] a set of rewrite rules that
attributes. When 𝐺 elements have multiplicity one,
reduces a network is proposed workflow.
the graph is called a simple graph.
- Computer networks. In [2] a method called
Network Graph Reduction is introduced, in Definition 2. a graph weighted as a structure 𝐺
which the reduction process is accomplished = (𝐺, 𝐺, 𝐺𝐺), which is defined:
by removing the edges congested. In [3, 19, 20]
- V represents the set of vertices of the graph.
you can be appreciated various models to
reduce graphs. However, in [10] it shows that - E represents the multiset of edges in the graph.
these models still lack the performance needed - The 𝐺𝐺 function: 𝐺 → ℝ + makes it correspond
for a quick response. These authors propose to each edge 𝐺𝐺, 𝐺𝐺 a positive real value
called cost, whose interpretation is the cost of
going from vertex 𝐺𝐺 to 𝐺𝐺 vertex.

Computing and Systems Vol. 18 No. 1, 2014 pp. 185-194


ISSN 1405-5546
http://dx.doi.org/10.13053/CyS-18-1-2014-027
Graph reduction algorithm without information loss 187

Definition 3. A rule graph rewriting on a graph Definition 4. A reduced graph is a tuple


is a tuple of the form where: 𝐺 = (𝑉𝑟, 𝐸𝑟, 𝑓, 𝑅), where:

- Gi = ({vi}, {}) is a graph where vi ∈ V. - 𝑉𝑟 is a set of vertices.


- Gj = (Vj, Ej) is a graph. - 𝐸𝑟 is a set of edges.
- ψin and ψout are two sets of embedded - 𝑓: 𝑉𝑟 × 𝑉𝑟 × 𝑉𝑟 → ℝ + ∪ {0, ∞} is a function for
information, the form (vm, c1, c2, vn), where c1, each (𝑣𝑖, 𝑣𝑗, 𝑣𝑘) returns the cost of going from 𝑣𝑖
c2 ∈ ℝ + vm ∈ Vj, vn ∈ (V - Vj). For ψin, ∃ (vn, vi) to 𝑣𝑘 through 𝑣𝑗 being adjacent 𝑣𝑗 𝑣𝑘 and 𝑣𝑗
∈ E such that fc (vn, vi) = c1, after applying the adjacent to 𝑣𝑖. 𝑓 obviously function defined for
rewrite rule, the graph G1 = (V1, E1, fc1) is
obtained and it holds that ∃ (vn, vm) ∈ E1 such
that fc1 (vn, vm) = c2. Analogously to ψin, ψout
defined, with the only difference of the
orientation of ridges.
The edges connecting the vertex and the vertice
graph preempotradas called edges. After applying
a rewrite rule, the edges joining the vertices in the
a) Example of graph b) Graph reduced
graph with vertices in the graph called post-
recessed edges. Fig. 2. Examples of graph

cases where 𝑣𝑖 = 𝑣𝑗 and / or 𝑣𝑗 = 𝑣𝑘. For trivial


𝑓 (𝑣, 𝑣, 𝑣) = 0.
- 𝑅 is a set of rewrite rules on (𝑉𝑟, 𝐸𝑟, 𝑓𝑐), which
is defined as 𝑓𝑐 𝑓𝑐 (𝑣, 𝑤) = 𝑓 (𝑣, 𝑣, 𝑤).

Definition 5.Sea 𝐺𝐺 = (𝐺𝐺, 𝐺𝐺, 𝐺, 𝐺) a


reduced graph. It is said that 𝐺𝐺 is a graph reduced
Fig. 1. Example rewrite rule. On the left graph is from 𝐺 if applying rewrite rules specified in 𝐺 the
shown on the right of the graph shown and the bottom 𝐺𝐺 graph graph graph 𝐺 is obtained.
recessed information and shown.
Definition 6. Be a 𝐺 = (𝐺, 𝐺) graph and 𝐺
The set transforms the set of preempotradas partition on 𝐺, a vertex is inside 𝐺𝐺 ∈ 𝐺 if ∀ 𝐺𝐺 ∈
𝐺 such that 𝐺𝐺 and 𝐺𝐺 are adjacent, it holds that
edges incident on the vertex edges
𝐺𝐺 𝐺𝐺 and belong to the same class 𝐺. Otherwise
postempotradas in affecting one or more vertices,
it is said that 𝐺𝐺 is outside.
similar
ψ𝑜𝑢𝑡 transforms the preempotradas edges leaving 𝑣𝑖 The big term is diffuse in nature, however, and
in postempotradas edges leaving one or more due to the use of this adjective in various situations,
vertices then an outline of a formal definition of this term,
𝑣𝑗 ∈ 𝑉𝑗. which can be used in the definition of graph
algorithms shown. Sean:
Given the definition of rewriting rule stated
above, in Figure 1 an example rewrite rule shown. - RNF_t, variable representing the non-
It can be checked, then applying that rule to the functional requirement associated response
diagram of Figure 2 (b) according to the NCE [9] time in solving a problem P.
mechanism, the graph of Figure 2 is obtained (a).
.

Computing and Systems Vol. 18 No. 1, 2014 pp. 185-194


ISSN 1405-5546
http://dx.doi.org/10.13053/CyS-18-1-2014-027
188 Rafael Rodríguez-Puente and Manuel S. Lazo-Cortés

- t, variable representing the average response - Two vertices are in the same class of
of an algorithm A on a graph G solved the refined partition if and only if:
problem empirical time P. - They are in the same class 𝐺.
- hardware, variable representing the hardware - They are interior vertices.
features that are available.
- software, variable representing the algorithm A
on a graph G for the solution of the problem P.
𝐺 can define a function that the input
(ℎ 𝐺𝐺𝐺𝐺𝐺𝐺𝐺, 𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺, 𝐺𝐺𝐺𝐺) returns the
value defined 𝐺 average empirical time response,
that is,

𝑇 (ℎ𝑎𝑟𝑑𝑤𝑎𝑟𝑒, 𝑠𝑜𝑓𝑡𝑤𝑎𝑟𝑒, 𝑅𝑁𝐹𝑡) = 𝑡.


To change this time and change feature large
graph, you can change the hardware or software.
You can also change the 𝐺𝐺𝐺𝐺 varying depending
on the problem you want to solve.

3. graph reduction algorithm Fig. 3. Example partition refinement using the inside and
outside corner concepts. In the top graph it can be seen
Thereafter, when the original graph is that the vertices 2 and 7 are outside; for each of said
mentioned, it is referring to the graph that is input vertices a class is created in the new partition
iteration is running. This graph can be different from
- If a vertex is outside, a new class
the existing before executing the reduction
containing only said vertex is created.
algorithm for the first time.
The reduction algorithm reduces a graph In Figure 3 is illustrated with an example using
designed without any loss of information in the the definition of inner and outer apex to refine the
process, contributing to analysis on small and get partition algorithm is input.
the same results obtained in the original graph For each class of refined partition a vertex is
graph. In addition, the fact that there is no loss of created in the reduced graph. If the cardinality is
information makes possible its use in reducing greater than one class, the vertex is created is
various types of graphs. considered small; otherwise it is considered not
reduced.
The proposal takes as input a graph and a
partition of the vertices of the input graph. However, Algorithm 1: 𝐶𝑜𝑛𝑠𝑡𝑟𝑢𝑖𝑟𝑉𝑒𝑟𝑡𝑖𝑐𝑒𝑠𝑅𝑒𝑑𝑢𝑐𝑖𝑑𝑜𝑠
it may be necessary to refine this partition; since for Entry: A partition refined 𝑃=
certain analyzes, for example the search optimal {𝐴1, 𝐴2, ..., 𝐴𝑠}.
paths, and obtain equal to those obtained in the Exit: The set of vertices formed by 𝐺 𝐺𝐺
original graph results, it is necessary that in the vertices.
reduced graph there are no pairs of vertices that
1. 𝑉𝑟 = {}
are adjacent and in turn reduced. To help ensure
this purpose, Definition 6 was introduced. 2. For all 𝐺𝐺 ∈ 𝐺
The first step of reduction algorithm consists of 3. 𝐴𝑑𝑖𝑐𝑖𝑜𝑛𝑎𝑟 (𝑉𝑟, 𝑂𝑏𝑡𝑒𝑛𝑒𝑟𝑁𝑜𝑚𝑏𝑟𝑒 (𝐴𝑖))
refining the partition that is input said algorithm. To 4. End For
do this follow the following strategy: 5. return 𝐺𝐺

Computing and Systems Vol. 18 No. 1, 2014 pp. 185-194


ISSN 1405-5546
http://dx.doi.org/10.13053/CyS-18-1-2014-027
Graph reduction algorithm without information loss 189

Furthermore, the use of ObtenerNombre vertices belonging to the class in question and
function is proposed (see Step 3 of Algorithm 1) existing edges between said vertices in the original
from a kind of the partition, returns a handle to be graph is then created. To create the information
associated with said vertex. If the class has embedded, for each edge of the original graph
cardinality greater than one, the function will return incident on vertices which belong to the class of the
the attribute value used to create the class; if the partition, a quadruple is added to ψ𝐺𝐺 conjunction
cardinality is one, the identifier corresponding to the with information of the same (see Definition 3) and
class in the original graph vertex is returned. The each edge of the graph original exits a vertex class
pseudocode for creating vertices of the reduced towards an apex which does not belong to that
graph shown in Algorithm 1. class in a quadruple ψ𝐺𝐺𝐺 representing the edge
The edges of the reduced graph is created from in question is added.
the classes of the partition and refined the original
graph. For this purpose each pair of classes algorithm 3: 𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺
partition is analyzed; if there is an edge between Entry: A partition 𝐺 = (𝐺1, 𝐴2, ..., 𝐴𝑠) and reduced
two vertices belonging to different classes, it is 𝐺 = (𝑉 graph, 𝐸, 𝑓, 𝑅)
added to the reduced graph. As you are adding to Exit: The set of rewrite rules 𝐺 1. 𝐺 = {} 2. For
the reduced graph edges must be updated 𝐺𝐺 the all 𝐺𝐺 ∈ 𝐺, 𝐺 = 1. 𝐺 such that | 𝐺𝐺 | > 1 to
cost function of the reduced graph 𝐺𝐺 be returned 3. 𝐺𝑖 = ({𝑂𝑏𝑡𝑒𝑛𝑒𝑟𝑁𝑜𝑚𝑏𝑟𝑒 (𝐴𝑖)}, {}), 𝑉𝑗 = 𝐴𝑖,
as output reduction algorithm. The pseudocode for 𝐸𝑗 = {}
creating the edges of the reduced graph is shown
in Algorithm 2. 4. For all 𝐺𝐺, 𝐺𝐺 ∈ 𝐺𝐺, 𝐺 ≠ 𝐺 do
5. Yes (𝐺𝐺, 𝐺𝐺) ∈ 𝐺 then
algorithm 2: 𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺
6. 𝐴𝑑𝑖𝑐𝑖𝑜𝑛𝑎𝑟 (𝐸𝑗, 𝑂𝑏𝑡𝑒𝑛𝑒𝑟𝐴𝑟𝑖𝑠𝑡𝑎 (𝐺, 𝑣𝑚, 𝑣𝑛))
Entry: A partition 𝐺 = {𝐺1, 𝐺2, ..., 𝐺𝐺} and
reduced 𝐺 = graph (𝐺, 𝐺, 𝐺, 𝐺) 7. 𝑓𝑗 (𝑣𝑚, 𝑣𝑚, 𝑣𝑛) = 𝑓 (𝑣𝑚, 𝑣𝑚, 𝑣𝑛)
Exit: The set of edges 𝐺𝐺 8. End yes
1. For all 𝐺𝐺 ∈ 𝐺𝐺, 𝐺𝐺 ∈ 𝐺𝐺, 𝐺 ≠ 𝐺; 9. Yes 𝐺𝐺 is then reduced 𝐺
𝑖, 𝑗 = 1. 𝑠 do 10. For all 𝐺𝐺 ∈ 𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺 (𝐺, 𝐺𝐺) to
2. 𝑣𝑖 = 𝑂𝑏𝑡𝑒𝑛𝑒𝑟𝑁𝑜𝑚𝑏𝑟𝑒 (𝐴𝑖) 11. 𝐺𝐺 (𝐺𝐺, 𝐺𝐺, 𝐺𝐺) = 𝐺 (𝐺𝐺, 𝐺𝐺, 𝐺𝐺)
12. end to
3. 𝑣𝑗 = 𝑂𝑏𝑡𝑒𝑛𝑒𝑟𝑁𝑜𝑚𝑏𝑟𝑒 (𝐴𝑗)
13. End Yes
4. Yes (𝐺𝐺, 𝐺𝐺) ∈ 𝐺 then
14. end to
5. 𝐴𝑑𝑖𝑐𝑖𝑜𝑛𝑎𝑟 (𝐸𝑟, 𝑣𝑖, 𝑣𝑗) 15. 𝑅𝑗 = 𝑂𝑏𝑡𝑒𝑛𝑒𝑟𝑅 (𝑉𝑗, 𝑅) {Gets rewrite rules
6. 𝑓 (𝑣𝑖, 𝑣𝑖, 𝑣𝑗) = 𝑓 (𝑒𝑚, 𝑒𝑚, 𝑒𝑛) associated 𝑉𝑗}
7. End yes 16. 𝐺𝑗 = (𝑉𝑗, 𝐸𝑗, 𝑓𝑗, 𝑅𝑗)
8. end to 17. For all 𝐺𝐺 ∈ 𝐺𝐺 do
9. return 𝐺𝐺
18. 𝑎𝑑𝑦 = 𝐴𝑟𝑖𝑠𝑡𝑎𝑠𝑄𝑢𝑒𝐸𝑛𝑡𝑟𝑎𝑛 (𝑣𝑘, 𝐺 [𝑣𝑘] - 𝑉𝑗)
To construct the rewriting rules of the reduced 19. For all 𝐺 ∈ 𝐺𝐺𝐺 do
graph is part of the definition 3. a rule is created for 20. 𝐴𝑑𝑖𝑐𝑖𝑜𝑛𝑎𝑟 (ψ𝑖𝑛, (𝑣, 𝑓 (𝑣, 𝑣, 𝑣𝑘), 𝑓 (𝑣, 𝑣, 𝑣𝑘),
each vertex reduced (or for each class of the
𝑣𝑘))
partition having cardinality greater than one).
21. end to
First, the graph is created 𝐺𝐺; it consists of a
vertex representing the corresponding class of 22. 𝑎𝑑𝑦 = 𝐴𝑟𝑖𝑠𝑡𝑎𝑠𝑄𝑢𝑒𝑆𝑎𝑙𝑒𝑛 (𝑣𝑘, 𝐺 [𝑣𝑘] - 𝑉𝑗)
refined partition. the 𝐺𝐺 graph formed by all 23. For all 𝐺 ∈ 𝐺𝐺𝐺 do

1. Create an auxiliary graph


𝐺𝑎𝑢𝑥 = (𝑉𝑎𝑢𝑥, 𝐸𝑎𝑢𝑥, 𝑓𝑎𝑢𝑥) = 𝐺𝑗 = (𝐴𝑖, 𝐸𝑖, 𝑓𝑐)

Computing and Systems Vol. 18 No. 1, 2014 pp. 185-194


ISSN 1405-5546
http://dx.doi.org/10.13053/CyS-18-1-2014-027
190 Rafael Rodríguez-Puente and Manuel S. Lazo-Cortés

24. 𝐴𝑑𝑖𝑐𝑖𝑜𝑛𝑎𝑟 (ψ𝑜𝑢𝑡, (𝑣, 𝑓 (𝑣𝑘, 𝑣𝑘, 𝑣), 𝑓 (𝑣𝑘, 𝑣𝑘,


𝑣), 𝑣𝑘))
Algorithm 4: Calculation Function 𝒇
25. end to
Entry: Reduced 𝐺 = (𝐺, 𝐺, 𝐺, 𝐺) subgraphs 𝐺𝐺
26. end to
= ({𝐺𝐺}, {}) and 𝐺𝐺 = (𝐺𝐺, 𝐺𝐺) of the rewrite rule
27. 𝐴𝑑𝑖𝑐𝑖𝑜𝑛𝑎𝑟 (𝑅, (𝐺𝑖, 𝐺𝑗, ψ𝑖𝑛, ψ𝑜𝑢𝑡)) associated with a 𝐺𝐺 class 𝐺 partition graph.
28. end to
Exit: The 𝐺 function for vertex corresponding to
29. return 𝐺 𝐺𝐺 reduced.
2. 𝑣𝑒𝑟𝑡𝑖𝑐𝑒𝑠𝐴𝑑𝑦𝑎𝑐𝑒𝑛𝑡𝑒𝑠 = {} 3. For all 𝑣𝑖, 𝑣𝑗 ∈ 𝐴𝑎𝑢𝑥,
The construction of rewrite rules is an essential
𝑣𝑗 ∈ 𝐴𝑦𝑎𝑐𝑒𝑛𝑡𝑒𝑠 (𝑣𝑖, 𝐺) do
step in the reduction algorithm is allowing no loss
of information on reducing the graph and also 4. Yes 𝐺𝐺 ∉ 𝐺𝐺, then
ensures that you get the original graph from the 5. 𝐴𝑑𝑖𝑐𝑖𝑜𝑛𝑎𝑟𝑉𝑒𝑟𝑡𝑖𝑐𝑒 (𝐺𝑎𝑢𝑥, 𝑣𝑗)
reduced graph. The pseudocode for this step is 6. 𝐴𝑑𝑖𝑐𝑖𝑜𝑛𝑎𝑟𝐴𝑟𝑖𝑠𝑡𝑎 (𝐺𝑎𝑢𝑥, 𝑣𝑖, 𝑣𝑗)
shown in Algorithm 3.
The last step is to calculate the 𝐺 reduced 7. 𝑓𝑎𝑢𝑥𝑣𝑗, 𝑣𝑗, 𝑣𝑖 = 𝑓𝑟 (𝑣𝑗, 𝑣𝑗, 𝑣𝑖) 8. 𝑓𝑎𝑢𝑥𝑣𝑖, 𝑣𝑖, 𝑣𝑗
function graph. This function stores, for each trio of = 𝑓𝑟 (𝑣𝑖, 𝑣𝑖, 𝑣𝑗)
vertices (𝐺𝐺, 𝐺𝐺, 𝐺𝐺), with adjacent 𝐺𝐺 𝐺𝐺 and
𝐺𝐺 adjacent 𝐺𝐺, the cost of going from 𝐺𝐺 to 𝐺𝐺 9. end to
through 𝐺𝐺. Additionally, this function can be 10. For all 𝐺𝐺 ∈
viewed as the mechanism for storing the cost of 𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺 do
passing through a vertex reduced. 11. 𝑑𝑖𝑗𝑘𝑠𝑡𝑟𝑎 (𝑣𝑜, 𝐺𝑎𝑢𝑥)
To calculate the 𝐺 function, an auxiliary network 12. For all 𝐺𝐺 ∈
is created for each reduced from 𝐺𝐺 graph of 𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺, 𝐺𝐺 ≠ 𝐺𝐺
rewriting rule corresponding vertex. The aim of this do
auxiliary graph is to have a graph on which changes
13. 𝑓 (𝑣𝑜, 𝑣𝑑, 𝑣𝑖) = (𝐷 [𝑣𝑑] 𝑐𝑎𝑚𝑖𝑛𝑜 (𝑣𝑜, 𝑣𝑑,
can be made for use in the calculation of the above
𝑃𝑟))
function. After adding the vertices and edges of the
14. end to
graph 𝐺𝐺 the auxiliary graph, vertices adjacent to
15. end to
each vertex belonging to graph 𝐺𝐺 are added.
16. return 𝐺
These adjacent vertices are stored in the
𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺 variable for use in Finally, a graph is created using the reduced
subsequent steps. set of vertices, edges, rewrite rules and the
On the auxiliary graph created Dijkstra's function f. The pseudocode for reducing a graph
algorithm [4] applies, on the vertex of origin (𝐺𝐺) shown in Algorithm 5.
each of the vertices stored in varying algorithm 5: 𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺
𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺; whenever this Entry: A graph weighted reduced
algorithm is invoked must be updated the 𝐺 𝐺 = (𝑉, 𝐸, 𝑓, 𝑅) where 𝑅 is a set of rewrite rules
function.
possibly empty. a partition
The calculated function, plus the cost of going
𝑃 in 𝑉.
from one vertex to another one cut through the road
Exit: A reduced weighted graph
itself stores; ie, the sequence of vertices to follow
so that with this pre-calculated value the time 1. 𝑃 = 𝑅𝑒𝑓𝑖𝑛𝑎𝑟𝑃𝑎𝑟𝑡𝑖𝑐𝑖𝑜𝑛 (𝑃, 𝐺)
required to display the optimal path is reduced. 2. 𝑉𝑟 = 𝐶𝑜𝑛𝑠𝑡𝑟𝑢𝑖𝑟𝑉𝑒𝑟𝑡𝑖𝑐𝑒𝑠𝑅𝑒𝑑𝑢𝑐𝑖𝑑𝑜𝑠 (𝑃)
If necessary, this function can be changed so 3. 𝐸𝑟 = 𝐶𝑜𝑛𝑠𝑡𝑟𝑢𝑖𝑟𝐴𝑟𝑖𝑠𝑡𝑎𝑠 (𝑃, 𝐺)
that store data necessary for solving a particular 4. 𝑅𝑟 = 𝐶𝑜𝑛𝑠𝑡𝑟𝑢𝑖𝑟𝑅𝑟 (𝑃, 𝐺)
problem. The pseudocode for calculating 𝐺
function shown in Algorithm 4. 5. 𝑓𝑟 = φ
6. For all𝐴𝑖 ∈ 𝑃, | 𝐴𝑖 | > 1

Computing and Systems Vol. 18 No. 1, 2014 pp. 185-194


ISSN 1405-5546
http://dx.doi.org/10.13053/CyS-18-1-2014-027
Graph reduction algorithm without information loss 191

7. 𝐶𝑎𝑙𝑐𝑢𝑙𝑎𝑟𝑓 (𝐺, 𝑅𝑟 [𝐴𝑖]. 𝐺𝑖, 𝑅𝑟 [𝐴𝑖]. 𝐺𝑗, 𝑓𝑟)


{Calculate the minimum cost of passing through the
vertex corresponding to the 𝐴𝑖 reduced class 𝑃 (see
Algorithm 4). The 𝑓𝑟 variable is a parameter passed
by address} 8. End To
9. Creating the reduced 𝐺𝐺 = (𝐺𝐺, 𝐺𝐺, 𝐺𝐺, 𝐺𝐺)
graph
10. return𝐺𝑟
The graph reduction algorithm set out in this
work is particularly important in working with maps,
because the same user always shown a certain
scale. Having reduced the proposed allows
network analysis based on a certain scale graph
algorithm. For example, if the graph representing
the road network of a country, province or state, is
reduced by grouping all vertices are in the same
municipality or district, the resulting reduced graph Fig. 4.Example graph reduced
represents the map scale municipality or district; 3.1. Demonstration of the validity of the
This results in simplicity in the analysis performed, algorithm graph reduction proposed
because at a certain scale they could lose some
important geographical objects, because at that Here it is shown that the reduction algorithm no
scale these are not visible or are not relevant to the information loss, or what is the same, the
analysis done. reduction process is reversible, so that from the
an example of reduced graph shown in Figure reduced graph you can get the original graph from
4. Note that between each pair of vertices reduced which reduced .
at least two vertices that are not considered low. For demonstration using triplet Hoare [8], the
An earlier version of the algorithm presented following preconditions and invariants are defined
here reduction was applied in implementing the cycle. The fundamental steps in the reduction
method of graphs dichromatic [16], used in the field process to ensure that there is no loss of
of rational design in mechanical engineering; also information, are those related to the creation of
it was used to divide a model sub-models so that rewrite rules; so invariants associated with the
the analysis of complex models to facilitate creation of such rules show cycle.
mechanical engineers. preconditions:
You can also say that the algorithm proposed
reduction is relevant for finding optimal paths when - 𝐺 = (𝑉, 𝐸, 𝑓, {}) is a graph. - 𝑃 = {𝐴1, 𝐴2, ..., 𝐴𝑠}
graphs are large [15]. is a partition of the vertex set 𝑉.
- 𝐺𝑖 = ({𝑣𝑖}, {}) is the graph of the left side of the
rewrite rule 𝑟𝑖 associated class 𝐴𝑖 ∈ 𝑃, | 𝐴𝑖 | >
1.
- 𝐺𝑗 = (𝑉𝑗, 𝐸𝑗, 𝑓𝑗, 𝑅𝑗) graph on the right side of
the rewrite rule associated with the class 𝑟𝑖
𝐴𝑖 ∈ 𝑃, | 𝐴𝑖 | > 1.
Invariants cycle:

1. Be 𝐺𝐺 ∈ 𝐺𝐺, ∀ 𝐺𝐺 ∈ (𝐺𝐺 - 𝐺𝐺) is satisfied


that

Computing and Systems Vol. 18 No. 1, 2014 pp. 185-194


ISSN 1405-5546
http://dx.doi.org/10.13053/CyS-18-1-2014-027
192 Rafael Rodríguez-Puente and Manuel S. Lazo-Cortés

∃𝑣𝑘, 𝑣𝑗 ∈ 𝐸 → 𝑣𝑘, 𝑓𝑐𝑣𝑘, 𝑣𝑗, 𝑓𝑐𝑣𝑘, 𝑣𝑗, 𝑣𝑗 ∈ ψ𝑖𝑛. It associated vertex 𝐺 ∈ 𝐺𝐺 on 𝐺𝐺 graph, a graph
For all interior vertices (𝐺𝐺), you create is obtained 𝐺𝐺 '= (𝐺𝐺', 𝐺𝐺 '𝐺𝐺', 𝐺𝐺 ') and the
embedded information containing the edges following is true:
incident on them from the outer vertices which Be 𝐺𝐺 ∈ 𝐺𝐺, ∀ 𝐺𝐺 ∈ 𝐺𝐺 such that 𝐺𝐺 and 𝐺𝐺
belong to the same equivalence class belong to the same class of 𝐺, (𝐺𝐺, 𝐺𝐺) ∈ 𝐺 →
(𝑣𝑗 - 𝑉𝑗). Note that 𝑣𝑗 denotes the class 𝑃 (𝑣𝑖, 𝑣𝑘) ∈ 𝐸𝑟 '.
containing 𝑣𝑗.
Demonstration:Is (𝐺𝐺, 𝐺𝐺) ∈ 𝐺 such that 𝐺𝐺,
2. Be 𝐺𝐺 ∈ 𝐺𝐺, ∀ 𝐺𝐺 ∈ (𝐺𝐺 - 𝐺𝐺) is satisfied
𝐺𝐺 ∈ [𝐺], suppose (𝐺𝐺, 𝐺𝐺) ∉ 𝐺𝐺 'after applying
that
the rule associated to vertex 𝐺𝐺 𝐺 reduced. Note
∃𝑣𝑗, 𝑣𝑘 ∈ 𝐸 → 𝑣𝑘, 𝑓𝑐𝑣𝑘, 𝑣𝑗, 𝑓𝑐𝑣𝑘, 𝑣𝑗, 𝑣𝑗 ∈ ψ𝑜𝑢𝑡. that if there is an edge between a vertex of a graph
For all interior vertices (𝐺𝐺), you create and one 𝐺𝐺 graph 𝐺𝐺, said vertices belong to the
embedded information containing the edges same equivalence class.
incident on the outer corners of the same When a rule is applied 𝐺𝐺 graph 𝐺𝐺 = ({𝐺𝐺},
equivalence class (𝐺𝐺 - 𝐺𝐺) and leaving the {}) is replaced by the graph 𝐺𝐺 and connects with
vertices of the graph 𝐺𝐺. 𝐺𝐺 (𝐺 - 𝐺𝐺) as specified in ψ𝐺𝐺 and ψ𝐺𝐺𝐺. Is 𝐺𝐺
The postcondition check is that 𝐺𝐺 is reduced
from 𝐺 graph. In other words, that from 𝐺𝐺 reduced ∈ 𝐺𝐺, ∀ 𝐺𝐺 ∈ ([𝐺𝐺] - 𝐺𝐺), note 𝐺𝐺 ∈ [𝐺𝐺] - 𝐺𝐺
graph, you can get the original graph 𝐺. → 𝐺𝐺 ∈ (𝐺𝐺 - {𝐺𝐺}):

Lemma 1. Be 𝐺𝐺 ∈ 𝐺𝐺, ∀ 𝐺𝐺 ∈ (𝐺𝐺 - 𝐺𝐺) such - If ∃ 𝐺𝐺, 𝐺𝐺 ∈ 𝐺, then


that
𝑣𝑗, 𝑓𝑣𝑘, 𝑣𝑘, 𝑣𝑗, 𝑓𝑣𝑘, 𝑣𝑘, 𝑣𝑗, 𝑣𝑘 ∈ ψ𝑖𝑛, by the
∃𝑣𝑘, 𝑣𝑗 ∈ 𝐸, you must be Lemma 1.
𝑣𝑘, 𝑓𝑣𝑘, 𝑣𝑘, 𝑣𝑗, 𝑓𝑣𝑘, 𝑣𝑘, 𝑣𝑗, 𝑣𝑗 ∈ ψ𝑖𝑛𝑘. - If ∃ 𝐺𝐺, 𝐺𝐺 ∈ 𝐺, then
𝑣𝑗, 𝑓𝑣𝑗, 𝑣𝑗, 𝑣𝑘, 𝑓𝑣𝑗, 𝑣𝑗, 𝑣𝑘, 𝑣𝑘 ∈ ψ𝑜𝑢𝑡, by the
Demonstration: (By induction on 𝐺) Lemma 2.
base case 𝐺 = 0, ψ𝐺𝐺0 = {} For This contradicts our assumption, so
𝐺 + 1: that must be (𝐺𝐺, 𝐺𝐺) ∈ 𝐺𝐺 '.∎

ψ𝑖𝑛𝑘 + 1 = Corollary 1. Sea 𝐺𝐺 = (𝐺𝐺, 𝐺𝐺, 𝐺𝐺, 𝐺𝐺)


reduced from the graph 𝐺 = (𝐺, 𝐺, 𝐺, 𝐺) and 𝐺
ψ𝑖𝑛𝑘 ∪ {𝑣𝑘 + 1, + 1 𝑓𝑣𝑘, 𝑣𝑘 + 1, 𝑣𝑗, 𝑓𝑣𝑘 + 1, + 1 𝑣𝑘,
partition, if the set of rewrite rules 𝐺𝐺 applies graph
𝑣𝑗, 𝑣𝑗}
associated with the vertices 𝐺𝐺 reduced graph, the
(See step 20 of algorithm 3) ∎ graph 𝐺 = (𝐺, 𝐺, 𝐺, 𝐺) is obtained from which 𝐺𝐺
decreased.
Lemma 2. Be 𝐺𝐺 ∈ 𝐺𝐺, ∀ 𝐺𝐺 ∈ ([𝐺𝐺] - 𝐺𝐺),
Thus it is demonstrated that the proposed
such that reduction algorithm graph ensures no loss of
∃𝑣𝑗, 𝑣𝑘 ∈ 𝐸) must be information.
𝑣𝑘, 𝑓𝑐𝑣𝑘, 𝑣𝑗, 𝑓𝑐𝑣𝑘, 𝑣𝑗, 𝑣𝑗 ∈ ψ𝑜𝑢𝑡.
The proof of this motto is similar to that of
Lemma 1.
4. Conclusions

Theorem 1. Sea 𝐺𝐺 = (𝐺𝐺, 𝐺𝐺, 𝐺𝐺, 𝐺𝐺) The graph reduction algorithm presented here
reduced from the graph 𝐺 = (𝐺, 𝐺, 𝐺, 𝐺) and 𝐺 ensures that no information is lost in the reduction
partition graph if the rewrite rule applies process, for it using a graph rewriting mechanism
is made. Also it can be used to solve the problem
𝑟𝑖 = ({𝑣𝑖}, φ), 𝑉𝑗, 𝐸𝑗, 𝑓𝑗, 𝑅𝑗, ψ𝑖𝑛, ψ𝑜𝑢𝑡, 𝑟𝑖 ∈ 𝑅𝑟, of finding optimal paths.

Computing and Systems Vol. 18 No. 1, 2014 pp. 185-194


ISSN 1405-5546
http://dx.doi.org/10.13053/CyS-18-1-2014-027
Graph reduction algorithm without information loss 193

Using graphs can be reduced considerably 10. Li, YL, Li, JY, & Chen, WB (2007).An efficient tile-
decrease the response time graph algorithms, based ECO routing router using graph reduction and
thereby ensuring the efficiency. In addition, overall enhanced routing flow. IEEE Transactions on
Computer-Aided Design of
reduction, scalability is ensured relative to the size
Integrated Circuits and Systems, 26 (2), 345-358.
of the graph on which the analysis is performed.
11. Lin, H., Zhao, Z., Li, H., & Chen, Z. (2002).A novel
The generality of the algorithm proposed graph reduction algorithm to Identify structural
reduction lies in the possibility of its application in conflicts. 35th Annual Hawaii International
Conference on System Sciences, Big Island, Hawaii
different types of networks, as well as the Rational
1-10.
Design in Mechanical Engineering. References 12. Liu, Q., Cao, B., & Zhao, Y. (2010).An improved
method for verification workflow model based on
1. Bast, H., Funke, S., Sanders, P., & Schultes, D.
Petri net reduction. 2nd IEEE International
(2007). Fast Routing in Road Networks With Transit Conference on Information Management and
Nodes. Science, 316 (5824), 566-566. Engineering (Icime), Chengdu, China, 252-256.
2. Casetti, C., Lo Cigno, R., Mellia, M., Munafo, M., 13. Lu, K. & Liu, Q. (2007).An algorithm combining
& Zsoka, Z. (2003).A new class of QoS routing graph-reduction and graph-search workflow graphs
strategies based on network graph reduction. for verification. 11th International Conference on
Computer Networks, 41 (4), 475-487. Computer Supported Cooperative Work in Design,
3. Cong, J., Fang, J., & Khoo, KY (1999).An implicit Melbourne, Australia, 772-776.
connection graph maze routing algorithm for ECO 14. Pfoser, D., Efentakis, A., Voisard, A., & Wenk,
routing. 1999 IEEE / ACM International Conference C. (2009). Exploiting road network properties in efficient
on Computer-Aided Design, San Jose, CA, USA, shortest path computation (TR-09-007). Berkeley, CA,
163-167. USA: International Computer
4. Dijkstra, EW (1959).A Note on Two Problems in Science Institute.
Connexion With Graphs. Numerische Mathematik, 1 15. Rodriguez-Puente, R. & Lazo-Cortés, MS
(1), 269-271. (2013).Algorithm for Shortest Path search in
5. Geisberger, R. Sanders, P., Schultes, D., & Geographic Information Systems by using reduced
Delling, D. (2008).Contraction hierarchies: Faster graphs. SpringerPlus, 2, Art. No.291.
and Simpler hierarchical routing in road networks. 16. Rodriguez-Puente, R., Marrero-Osorio, SA, &
7th International Conference on Experimental Lazo-Cortés, MS (2012).Applying a graph reduction
Algorithms (WEA'08), Massachusetts, USA, 319- algorithm to the method of the dichromatic Grafos.
333. Mechanical Engineering, 15 (2), 158-169.
6. Gonzalez, H., Han, J., Li, X., Myslinska, M., & 17. Sadiq, W. & Orlowska, ME (2000).Analyzing
Sondag, JP (2007).Adaptive fastest path process models using graph reduction techniques.
computation on a road network: a traffic mining Information systems, 25 (2), 117-134.
approach. 33rd International Conference on Very 18. Sanders, P. & Schultes, D. (2005).Highway
Large Data Bases (VLDB'07), Vienna, Austria, 794- hierarchies hasten exact shortest path queries. That
805. Algorithms-2005, Lecture Notes in Computer
7. Gutman, RJ (2004).Reach-Based Routing: A New Science, 568-579.
Approach to Shortest Path Algorithms Optimized for 19. Xing, Z. & Kao, R. (2002).Shortest path search
Road Networks. Proceedings of the Sixth Workshop using piecewise linear cost tiles and propagation.
on Algorithm Engineering and Experiments and the IEEE Transactions on Computer-Aided Design of
First Workshop on Analytic Algorithmics and Integrated Circuits and Systems, 21 (2), 145-158.
Combinatorics, New Orleans, LA, USA, 100-111.
20. Zheng, SQ, Lim, JS, & Iyengar, SS (1996).Avoiding
8. Hoare, CAR (1969).An axiomatic basis for computer obstacle-finding shortest paths using graphs implicit
programming. Communications of the ACM, 12 (10), connection. IEEE Transactions on Computer-Aided
576-580. Design of Integrated Circuits and Systems, 15 (1),
9. Janssens, D. & Rozenberg, G. (1982).Graph 103-110.
grammars With embedding-controlled
neighborhood. Theoretical Computer Science, 21
(1), 55-74.

Computing and Systems Vol. 18 No. 1, 2014 pp. 185-194


ISSN 1405-5546
http://dx.doi.org/10.13053/CyS-18-1-2014-027
194 Rafael Rodríguez-Puente and Manuel S. Lazo-Cortés

Rafael Rodriguez Puente is


Doctor of Technical Sciences from
the University of Information
Sciences (UCI, 2012), is now Dean
of the
Faculty 3 of the UCI. He has
taught various subjects including
programming, data structures, compilation
techniques, design patterns, computing machines,
databases are Y Methodology of
the Scientific investigation. His areas of
interest are: algorithms on graphs,
systems of Geographic information
databases graphs and hypergraphs.

Manuel Cortés S. LazoisPhD in


Mathematics from the UCLV
(1994). His research interests are
pattern recognition (RP) with
combinational logical approach,
selection of features and unsupervised
classification. He is the author of several articles
published in professional journals, editor and
reviewer of memoirs of
international conferences in the area of RP. He is
a member of the Advisory Council for Science and
Technological Innovation of the Ministry of
Informatics and Communications of the Republic
of Cuba.
Item received the 04/13/2013, accepted the 07/17/2013.

Computing and Systems Vol. 18 No. 1, 2014 pp. 185-194


ISSN 1405-5546
http://dx.doi.org/10.13053/CyS-18-1-2014-027

Potrebbero piacerti anche