Michael,

I agree with your experience that it's just as reasonable to work at the feature level rather than the geometry level. Graph-based algorithms are pretty much orthogonal to geometric algorithms, so there's not much to be gained from having the graph "know" about the geometry. The one exception is precisely for planar graphs - in this case, the geometry implies an ordering of edges around each node, which is important for various algorithms in JTS. Perhaps this is why you're seeing JGraphT being faster that JTS? There is a cost to computing the edge ordering, of course.

Do you have some details of how JGraphT is easier to use than JTS? It would be nice for development if the JTS graph structures were as easy to use as possible.


Michaël Michaud wrote:
Hi,

I have used JGraphT with JTS for a while and I can say it is *very* fast.
I use it to find nodes of a linear network, degree* of each node, cycles... When using JTS+JGraphT, I consider linear features as the edges of the graph and first and last coordinates of their geometry as the nodes. It may not fit all needs as the graph has no node where features intersect if intersection point is not already the extremity of those features.

I have to admit that I first tried to do this with pure JTS (avoiding to add a 500kb jar), but it appeared much more complex to use. Maybe some convenient methods around PlanarGraph class would have helped me achieve the same goal in pure JTS, but now, I'm no more sure there are much benefits working at the geometry level rather than at the feature level.

My two cents

Michaël

* if you try to use it, note that I just discovered a bug which returns a degree 4 node at the end of a single looping edge (should be degree 2)

Stefan Steiniger a écrit :
I think Michael Michaud also used JgraphT for his OpeJUMP Plugin:

http://geo.michaelm.free.fr/OpenJUMP/resources/jump-jgrapht-0.3.jar
http://geo.michaelm.free.fr/OpenJUMP/resources/jump-jgrapht-src-0.3.zip

but maybe it is already what you meant with JUMP plugin

stefan
_______________________________________________
jts-devel mailing list
[email protected]
http://lists.refractions.net/mailman/listinfo/jts-devel



_______________________________________________
jts-devel mailing list
[email protected]
http://lists.refractions.net/mailman/listinfo/jts-devel


--
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022

_______________________________________________
jts-devel mailing list
[email protected]
http://lists.refractions.net/mailman/listinfo/jts-devel

Reply via email to