Hi Justin,

It's been a while but I've been able to revisit this problem with the
subgraphs and made a test case. The code reads a roads shapefile and creates
a graph. Then it iterates over each edge and uses a visitor/walker to find a
sub-graph around the edge (see SubGraphVisitor2 class). The problem is that
the code breaks when it reaches an edge that has previously been added to an
unrelated subgraph. For some reason the visit() method in the SubGraphWalker
isn't called in these cases (I've stepped through the underlying GeoTools
code and couldn't work out why though) .

The toy_city data included with the test is very small so all roads are
added to the first subgraph and it then fails on the second edge. But if you
give it a larger dataset it works for a few times reaching an edge that has
already been added to another subgraph and failing.

The test class file is self-contained and located here (the testSubGraph()
method does the interesting stuff, everything else is for reading the file
and creating the graph):

http://geocrimedata.svn.sourceforge.net/viewvc/geocrimedata/SpatialAnalysis/src/main/java/uk/ac/leeds/ccg/spatialanalysis/spacesyntax/SubGraphTest.java?view=log

The toy city data (shapefile) is here:

http://geocrimedata.svn.sourceforge.net/viewvc/geocrimedata/SpatialAnalysis/data/toy_city/

Or if you want the whole NetBeans project that I'm using (including the
data), it's called SpatialAnalysis and you can download it here:

https://sourceforge.net/projects/geocrimedata/files/

Thanks again for your help, I'm completely stuck!

Nick



--
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/Problem-iterating-over-a-graph-tp6676019p6854456.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to