Hi, i would like to do app "shortest path finder", so I read something about
Graph, and on the beginning I was pleased because it looked very easy :) So
I tried very simple example like this:


GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null);
LineStringGraphGenerator lineStringGen = new LineStringGraphGenerator();

Point a = geometryFactory.createPoint(new Coordinate(0, 0));
Point b = geometryFactory.createPoint(new Coordinate(1, 0));
Point c = geometryFactory.createPoint(new Coordinate(1, 1));
Point d = geometryFactory.createPoint(new Coordinate(0, 1));

LineString abcd = geometryFactory.createLineString(new Coordinate[] {
                new Coordinate(a.getX(), a.getY()), new Coordinate(b.getX(), 
b.getY()),
                new Coordinate(c.getX(), c.getY()), new Coordinate(d.getX(), 
d.getY()) });

LineString ac = geometryFactory.createLineString(new Coordinate[] {
                new Coordinate(a.getX(), a.getY()), new Coordinate(c.getX(), 
c.getY()) });

lineStringGen.add(abcd);
lineStringGen.add(ac);
Graph g = lineStringGen.getGraph();


as u can see, I tried to create just very simple graph with 4 points A,B,C,D
and lines between them like this:

http://osgeo-org.1803224.n2.nabble.com/file/n6386745/graph.jpg 

But when i build graph, and use method getNodes(), i have only three nodes
(why? i build graph with 4) also edges are different. So of course, when I
use DijkstraShortestPathFinder, it also gives me different result.

What did I wrong?

--
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/problem-with-building-graph-tp6386745p6386745.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to