Professional Documents
Culture Documents
Using Path-Finding Algorithms of Graph Theory For Route-Searching in Geographical Information Systems
Using Path-Finding Algorithms of Graph Theory For Route-Searching in Geographical Information Systems
Abstract—This paper deals with graph theory application in software and geographical data designed for effective
large-scale geographical data searching and visualization. gathering, retaining, editing, processing, analysis and
We present a comparison of two path-finding algorithms of visualization of all kinds of geographical information.
graph theory, i.e. blind-search and A* algorithm, that Generally, it is a spatial specialized IS.
results into the selection of the second one for
implementation within a geographical information system. Being an IS, GIS has to provide information in
The main goal is to process the terrain map representation graphical (e.g. location of the hotel on the map) and
in the form of a graph during route-searching between start nongraphical (e.g. fees, room equipment) way that
and target positions, and during the visualization and supports fast searching and actualization of data.
animation of the results of this search. We show the Nowadays, graphical information are stored as vector
implementation results on random city map and on real graphics (two-dimensional), but the trends are clearly
three-dimensional model of our university campus. Finally,
forecasting the 2nd generation GIS as an IS working with
we discuss further directions of current work.
3D objects and surfaces.
It is useful to extend the implementation of the above-
I. INTRODUCTION mentioned searching of objects by route-searching
Graphs can be imagined as a set of points (vertices) between two selected objects. As the map is the core of
interconnected by lines (edges). The edges can have any GIS, a possible way of use of path-finding on graphs
specified direction (orientation). Paths are sequences of within such a system is the mapping of these maps onto
vertices and edges between them. Path-finding between searchable graphs that will be shown in next sections of
two graph points is used in many areas, like GPS this paper. Section II presents the theoretical background
navigation, CAD systems (auto-routing in design of needed in algorithm descriptions in the other following
circuit boards), and applications of artificial intelligence, sections. In Section III, we define terms such as map and
computer games, virtual reality, military forces or route, and the blind-search and A* algorithms are also
robotics. The main aim is to pass through environment in introduced. Next two sections deal with the test results:
secure form and to avoid of obstacles. Examples of this Sec. IV presents test results on static two-dimensional
need are autonomous robots on distant planets without maps, while Sec. V presents results from tests where
the possibility to be controlled in real time because of three-dimensional (city) maps were used. Sec. V
latencies in signal sending, or automatic vehicles control. demonstrates the tested 3D city information system,
Another example of path-finding are strategic computer especially its user interface, as well. Section VI is
games, mostly with computer opponent. Path-finding is denoted to conclusions and future work.
also widely used in finding best routers interconnection II. THEORETICAL BACKGROUND
for data transmission in many kinds of computer
networks. L. Euler, mathematician from the 18th Century, is
considered as the founder of graph theory. Graph theory
To be successful in path-finding, the need of reliable as a science discipline started with first graph theory
algorithm and reliable implementation of that algorithm is
monographs written by mathematicians D. König (1936)
enormous. Another important thing is the need of some
and C. Berge (1958). The next part of this section relies
user-friendly visualization of results of path-finding,
on definitions in [2].
which is realized by application of computer graphics
Let V be a final non-empty set, i.e. the set of vertices,
techniques. and let E be the set of edges defined as:
A geographical information system [1] (GIS) is an E = {e | e = {v1,v 2 };v1,2 V} . (1)
information system (IS) designed to work with data that V V
represent geographical or spatial coordinates. These data Obviously, E , where is a set of all two-
can be further analyzed and statistically evaluated. 2 2
Another way to specify a GIS is that it is a specialized element subsets of set V:
IS defined as a collection of computer hardware and
Figure 2. Blind-search algorithm trouble on Map2 Figure 5. Path found by A* algorithm on Map2
Figure 3. Path found by blind-search algorithm on Map3 Figure 6. Path found by A* algorithm on Map3
At the beginning, the starting vertex is inserted into
OPEN. The iteration cycle starts with the choose of the
vertex n with best value of f(n). This vertex will be
inserted into set CLOSED and all from n reachable
vertices v are selected, and if they are not in set OPEN,
they will be inserted with p[v]=n and the corresponding
value of d[v]=d[n]+l(n,v), where l(n,v)=wg(v) is the cost
function for the selected edge from n. If v was already a
member of OPEN, we need to test if the new path is
shorter than the old by comparing d[v]<d[n]+l(n,v). If
the comparison fails, we need to update the values p[v]
and d[v]. The presented cycle continues until the target is Figure 7. Statistics on searched squares on maps by both algorithms
found or the set OPEN is empty. After the algorithm had
finished, we need to reconstruct the path using values of
V. TESTING WITH THREE-DIMENSIONAL CITY MAPS
p[v].
Fig. 4-6 show examples of usage of the A* algorithm Two-dimensional maps, as presented above, are a good
on 2D static maps to compare with the results of the testing tool, but in real systems three-dimensional ones
blind-search algorithm from the previous section. are nowadays more useful. Representing higher fidelity to
There are possible modifications to this algorithm that real world, virtual reality techniques help to build more
can decrease memory usage and fasten the A* algorithm. user-friendly and more precise information systems.
The most common techniques optimize the number of Dealing with geographical information, a three-
vertices within the sets OPEN and CLOSED by dimensional map (or more precisely, the visualization of
discarding the less useful ones. This technique limits the it) introduces a few new problems into the path-finding
count of the elements of each set separately to get best by extending the information character to be searched.
performance but do not miss some possible paths. The Therefore, we run tests on more complicated surfaces
common problem is the grid resolution selection: high and maps with building objects, hills etc. The result is
resolution rapidly slows down the algorithm execution; shown on Fig. 8 in the form of the found route form point
low resolution may cause loss on important information A to point B between the buildings of a randomly
as smaller buildings and/or gates. The maximum sizes of generated city.
sets OPEN and CLOSED were examined and We also performed tests on optimizing of set sizes for
experimentally defined in [3] as 1000 and 3000. OPEN and CLOSED. As we already mentioned, in [3]
were made some experiments under our supervision. The
IV. TEST RESULTS FOR STATIC TWO-DIMENSIONAL testing conditions were as follows: each test case was run
MAPS separately on the same hardware (no sequences etc.);
We run a couple of tests on two-dimensional static visualization (rendering) speed was set to minimum; each
maps to compare the blind-search and A* algorithms, test case was run ten times and results were averaged.
which implementations were based on [4,5]. Ten (10) The test results are shown on Tab. I and Tab. II; we got
maps were tested. Found routes differ in length (compare best performance by dual optimizing (i.e. using both
results on Fig. 3 and Fig. 6). The route always starts with limits), but the optimization of size of set OPEN had
red arrow. If the route is returning by the same route stronger effect on execution speed than the optimization
backward, then the arrow is changed to yellow and the of set CLOSED. The tested A* algorithm was
route continues with yellow arrow. If the route crosses implemented within the 3D city IS we do present in next
itself (blind-search algorithm), then it is in cycle and the section.
arrow will be marked by boxed blue color. Yellow square
is start square, blue square is target square.
The efficiency of blind-search algorithm is only 40%
because from 10 maps it found route only in four of them.
A* algorithm searched in all maps 14 895 squares
together. Blind-search needed to search 83 928 squares,
because it used to cycle itself (see Fig. 2) and the
condition of cycle detection was at 10000 cycles. The
blind-search algorithm searched 5,64 times more squares
than A* algorithm.
We present the test results of both algorithms on Fig.
7. It is obvious that blind-search was not so effective like
the A* algorithm when compared the count of squares
searched. The speeds are not comparable due to the low
Figure 8. A* algorithm test results on a random 9 km2 city map
efficiency of the blind-search algorithm.
TABLE I.
SPEED TEST RESULTS OF A* ALGORITHM OPTIMIZATION
TABLE II.
SET SIZES AND PATH LENGTH DURING A* ALGORITHM OPTIMIZATION Figure 10. Search window of 3D city information system
Optimization Path |OPEN| |CLOSED|
technique length
[m] only moves the camera to the selected target.
none 5210 6022 5210 Function show-path opens after a few minutes the
CLOSED 5210 6022 3000 resulting route from the actual position on the map to the
selected target as shown on Fig. 8. The speed is faster
OPEN 5210 1000 5263
with less resolution, but some narrow streets have been
OPEN & CLOSED 5210 1000 3000
missed. With the campus map are nearly real-time results
due to the small count of objects.
The virtual reality oriented part of the tested
A. The 3D City Information System Test Case geographical information system was the animation
function. The path-finding module was shared with the
Fig. 9 shows the main screen of the tested GIS. We can other already mentioned parts. The test case had to ensure
see few building objects on the base map, in the upper the quality of the obstacle detection. This part offers the
right corner are navigation buttons (3 – minimize, 4 – path visualization by circles and the animated walk-
close). Upper left corner has also two buttons: 1 – open through of the scene rendered from the map and
map, 2 – options. Options are like map resolution etc. The additional object information stored in the GIS database.
number 5 indicates the search button, which functionality
Fig. 11 shows the animation screen. Buttons 13-16 are
we tested.
classical navigation buttons for movement within the
Selecting this last option, a search dialog opens that is
animation.
shown on Fig. 10. As any classical search dialogs, it has a
field for the search query (reference number ref. no. 6), VI. CONCLUSION
results displaying area (ref. no. 7), search execution This paper presents a view on graph theory from point
button (ref. no. 8), animation button (ref. no. 9), path of view of virtual reality. We showed the application of
display button (ref. no. 10), object display button (ref. no. the modified Dijkstra’s A* algorithm of path-finding in
11), and close dialog button (ref. no. 12). graphs within a geographical information system.
The testing procedure is simple: open a map, i.e. in our Due to the required speed and reliability of the
case by other tool randomly generated maps with some searching, we chose this algorithm. Our tests of the
known labeled objects, the real (but yet only partial) city selected algorithm are included as well as the introduction
map, and the map of the university campus; type a search of the visualization system within we needed to
phrase and see what is found and displayed. Now follows implement them.
the test of path-finding abilities. Function go-to-object From the test results some conclusions can be made.
Figure 9. Main screen of 3D city information system Figure 11. Walk-through animation of 3D city information system
The blind-search algorithm is fast but is not accurate graphics and virtual reality systems. Collision detection is
enough and can be used in maps with low number of the main area of it, but, as this article implies, the
obstacles only when the results have to be gained as fast information system area should follow these trends as well
as possible and the route does not have to be the shortest by implementing its algorithms into the visualization and
one. A* algorithm is the most used algorithm and showed searching modules.
its qualities in our tests as well. Despite time results (the Large graphical data volumes are not only points clouds
speed of this algorithm is not the fastest), this algorithm is got from three-dimensional scanning but also spatial data
reliable on 100% and has provided better results. The from existing maps. These data are exactly the ones
optimization techniques of set size restrictions were useful processed, gathered, edited, searched etc. in conclusion
and brought higher speed into execution of path-finding. with extending nongraphical information by GIS.
The implementation of both algorithms showed up as
useful, but the significant difference of applicability ACKNOWLEDGMENT
between them excludes the blind-search algorithm from This work is supported by VEGA grant project No.
the set of candidates of route-searching algorithms for a 1/3136/06: “Research of parallel, distributed and network
GIS. computer systems applications to solve computational
We implemented the 3D city information system as a processes in an area of large graphical data volumes
prototype of a GIS. The included functionalities except processing.”
those presented include the object browser and map editor.
In the future, we plan to interconnect the system with REFERENCES
other systems for geographical data processing such points
[1] J. Tuek, Geographical Information Systems, “Geografické
clouds analyzers, video or ortophoto processors etc. informaní systémy” (original Czech title), Praha: Computer
Our plan is also to extend the models as huge as Press, 1998.
possible and provide a more complex information system [2] M. Buko and M. Kle, Discrete Mathematics, “Diskrétna
applicable for logistics as well. Matematika” (original Slovak title), Koice: Academic press elfa,
1999.
The similarity to today’s GPS in the case of route-
searching is intentional. According to the trends in the [3] M. Vlasova, “3D city information system,” DCI FEEI TU, Koice,
diploma thesis, 2008.
area, future navigation systems might offer three-
[4] T. Barron, Strategy Game Programming with DirectX 9.0,
dimensional interfaces as well. The only difference is in Wordware Publishing Inc., 2003.
the type of the map, because our system uses a static map [5] J. Adams, Advanced Animation with DirectX, Premier Press, a
while a good navigation system uses a dynamic one that division of Course Technology, 2003.
might future GIS use too.
As we mentioned in the introducing section, the use of
graph theory becomes common in modern computer