Java Doc for GraphIterator.java in  » GIS » GeoTools-2.4.1 » org » geotools » graph » traverse » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » GeoTools 2.4.1 » org.geotools.graph.traverse 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.geotools.graph.traverse.GraphIterator

All known Subclasses:   org.geotools.graph.traverse.basic.AbstractGraphIterator,
GraphIterator
public interface GraphIterator (Code)
Defines an algorithm in which to traverse the components of a graph. A graph iterator operates by repeatedly returing graph components to the caller. The order in which to return the components is specific to the iterator. However, most iterators follow the following conventions:

  • Components are visited only once
  • The next component to be returned is determined by the components that have been previously visited
The following is an example of a GraphIterator. It returns nodes of a graph in a standard Depth First Search order, starting from a specified node. The nodes have been numbered to correspond to the iteration pattern.

indicates source of traversal


In order to analyze the traversal, the following terms are defined:

The Next Set of a traversal is the set of components that will be visited in a later stage of the traversal.
The Branch Set of an component e is defined as the set of components that can be visited in a later stage of the traversal as a direct result of visiting e.

In most traversals, the two sets are related. The Next Set is built by analyzing the Branch Set of the component being visited in the current stage of the traversal. Revisiting the above example, a Depth First Search Traversal operates as follows:

  • Each node is visited only once.
  • The Next Set is organized as a Last In First Out Queue (Stack).
  • At each stage, every node in the Branch Set that has not yet been visited is added to the Next Set.
As well it is assumed that nodes related to a node are sorted in alphabetic order.

The following table summarizes the stages of the traversal:

Stage Visited Node Branch Set Next Set Comment
0     {A}   Initial stage, iteration starts explicitly from A
1A{B,F}{F,B}   Related nodes added to Next Set in LIFO order.
2F{A,B}{B,B}   A already visited so not added to Next Set
  B not yet visited so added to queue.
3B{A,C,D,E,F}{B,E,D,C}   A,F already visited so not added to Next Set
4B {E,D,C}   B already visited so ignore and move to next stage
5E{B}{D,C}  
6D{B,C}{C,C}  
7C{B,D}{C}  
8C { }   C already visited so ignore and move to next stage
9  { }   Next set empty, iteration complete.


At any stage of a travesal a branch may be killed.When a branch is killed at a stage of an iteration, no elements in the current Branch Set are added to the Next Set. This is illustrated by revisiting the Depth First Search Iteration, but this time killing the branch at node B. The following table summarizes the stages of the traversal:

Stage Visited Node Branch Set Next Set Comment
0     {A}   Initial stage, iteration starts explicitly from A
1A{B,F}{F,B}   Related nodes added to Next Set in LIFO order.
2F{A,B}{B,B}   A already visited so not added to Next Set
  B not yet visited so added to queue.
3B{A,C,D,E,F}{B}   Branch Killed. No nodes added to Next Set
4B { }   B already visited so ignore and move to next stage
9  { }   Next set empty, iteration complete.

In this example, killing the branch at node B results in nodes C, D, and E never being visited.

See Also:   GraphWalker
See Also:   GraphTraversal
author:
   Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net




Method Summary
public  voidcont(Graphable current, GraphTraversal traversal)
     Signals to the iterator that iteration should continue from the current component in the traversal.
public  GraphTraversalgetTraversal()
     Returns the traversal for the iterator.
public  voidinit(Graph graph, GraphTraversal traversal)
     Signals to the itereator that iteration is about to begin.
public  voidkillBranch(Graphable current, GraphTraversal traversal)
     Signals the iterator to kill the branch at the current component.
public  Graphablenext(GraphTraversal traversal)
     Returns the next graph component in the iteration.
public  voidsetTraversal(GraphTraversal traversal)
     Sets the traversal for the iterator.



Method Detail
cont
public void cont(Graphable current, GraphTraversal traversal)(Code)
Signals to the iterator that iteration should continue from the current component in the traversal.
Parameters:
  current - The current component of the traversal.



getTraversal
public GraphTraversal getTraversal()(Code)
Returns the traversal for the iterator. The traversal requesting components from the iterator.



init
public void init(Graph graph, GraphTraversal traversal)(Code)
Signals to the itereator that iteration is about to begin. This often results in the creation/initialization of any internal data structures used by the iterator.
Parameters:
  graph - The graph being whose components are being iterated over.



killBranch
public void killBranch(Graphable current, GraphTraversal traversal)(Code)
Signals the iterator to kill the branch at the current component.
Parameters:
  current - The current component of the traversal.



next
public Graphable next(GraphTraversal traversal)(Code)
Returns the next graph component in the iteration. To signal to the caller that the iteration is complete, null should be returned. The next component in the iteration, or null if iteration is complete.



setTraversal
public void setTraversal(GraphTraversal traversal)(Code)
Sets the traversal for the iterator.
Parameters:
  traversal - The traversal requesting components from the iterator.



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.