[GRASS5] Re: shortest path

Radim Blazek wrote:

roberto micarelli wrote:
>
> Angus Carr wrote:
> >
> > I, too, have thought that this would be a useful program. The network has
> > topology, so you should be able to do something with it. A feature request
> > for you- please allow the reporting of the nodes/segments taken. I want to
> > do a traffic analysis, and I need a log of all vehicles that pass through
> > any given node, and along any given vector, assuming they took the shortest
> > path from point to point. Given the list of nodes and edges between any two
> > points (Dijkstra), I can then do the traffic analysis.
> >
> > One other possibility for you is to develop a network API and library for
> > GRASS. That way, others can easily build on your work. It makes the
> > development of your code quite modular, too, which is always a good thing.
> >
> > Thanks for the idea, and I will be happy to help with testing when it comes
> > time. If you want other help, I can provide some, as needed.
> >
> > Angus Carr.
>
> Thanks to you for the help. I agree with your suggestions. We can switch to the
> developer list or private mail for details.
>
> Ciao.

I would like listen to the following discussion about network also.
I thing that we should discuss format for network first. Or is it
clear for you? Points + lines in dig file?

Radim

No, so far it is not clear to me. I think that we need a different format for storing
the network. I'm wondering how could it be:

Link_t
{
Nodeid, #links, (To0, To1, ..., ToN),
                (Cost0, Cost1, ..., CostN),
                (ArcId0, ArcId1, ..., ArcIdN)
}

This is a way to represent a directed graph in a file, that will
then be a stream of Link_t records.

The 'to' fields are references to further nodes.
The 'cost' fields are the cost to travel from this node to the
relative 'to' node.

The algorithm must output the path list as:

Step Arc Distance FromNode ToNode
-------------------------------------
0 Id cost Id Id
1 Id cost Id Id
..
N Id cost Id Id
------------------------------
           total

Maybe we could withdraw ArcId from the graph, one should
then be able to retrieve it from the FromNode/ToNode couple
in order (for example) to plot the path.

--

What I'm designing is a -graph- read only file, that one must generate from
its topology. The same network can be generated in different flavours, and
optimized for different navigation parameters.
Dijkstra has O('#node'**) complexity, and I've seen around navigable layers of more than
300.000 arcs. What performance can we expect if we use a RDBMS to perform (300.000)**
selects ?
Thus the 'to' fields must be direct seek values in the file that are transformed
in memory-addresses when the graph comes to fit into memory for calculations.
I would like to have this program running on 'low cost' hw.

The geometry portion of the network can still reside in dig files ...

Make me know what do you think about this idea.

Ciao.

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'

If we are going to go the route of saving a graph for a vector file (I suggest
the command n.build...) then perhaps we should follow the same convention as
the Graph Template Library (http://www.fmi.uni-passau.de/Graphlet/GTL/ ) and
use an existing on-disk format. They use the GML - Graph Modelling Language

Angus Carr wrote:

If we are going to go the route of saving a graph for a vector file (I suggest
the command n.build...) then perhaps we should follow the same convention as
the Graph Template Library (http://www.fmi.uni-passau.de/Graphlet/GTL/ ) and
use an existing on-disk format. They use the GML - Graph Modelling Language.
There is a parser for GML available at
http://www.infosun.fmi.uni-passau.de/Graphlet/GML/index.html, written in C.

I'm not suggesting that we go to a C++ program and just use the GTL, but we
could use a common format, with an existing parser library.

Angus.

I didn't know about GTL, thank you. It is a nice interface, supporting a wide range
of algorithms. On this side my work is still poor.
In any case there are two choises I made when started the design: C language
(eventually adding a C++ wrapper in a second phase), and a binary file format
(to reduce in/out band requirements and higher overall execution speed).
To achieve this I use binary trees while loading/updating the graph, but before
to start calculation I have to 'flatten' it and translate all relations between
nodes into memory (or file) offsets.
So far only shortest path algorithm has been implemented. The first performance
tests are giving excellent results: it took me 1 second to find least cost path in
a 100.000 nodes / 360.000 edges graph. This must be added 3 sec to load the graph
from disk if not yet cached (speaking in PIII/IDE terms). If I had the same in ASCII
and I had to reconstruct the internal structure while loading I would have spent
minutes.
At this point I'm investigating my approach, comparing it to GTL. My work is enought
young to get eventually stopped and reconverted. I need to try GTL performances on
large datastores, as the GIS graphs usually are.

For sure, we can at least export/import GML graphs.

Regards.

P.S.: n.build (n.*) sounds good. Radim's point of view appreciated

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'