org.geotools.graph.util.graph
Class GraphFuser

java.lang.Object
  extended byorg.geotools.graph.util.graph.GraphFuser

public class GraphFuser
extends java.lang.Object

Removes all nodes of degree 2 from a graph. The following are examples of graphs being fused.







When a node of degree 2 is removed from tan unfused graph, the two edges is is adjacent to must be merged into a single edge. More generally if n adjacent nodes of degree 2 are removed, n+1 edges must be merged into a single edge. This change in graph structure has an effect on the entities modelled by the graph. Since each edge models a single object, replacing multiple edges with a single edge results in an inconsistet model. Therefore an EdgeMerger is used to merge the objects represented by the multiple edges into a single object. This new object becomes the underlying object of the merged edge.

Author:
Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net

Nested Class Summary
static interface GraphFuser.EdgeMerger
          Merges the underlying objects represented by a number of edges into a single object.
 
Constructor Summary
GraphFuser(Graph graph, GraphBuilder builder, GraphFuser.EdgeMerger merger)
          Constructs a GraphFuser.
 
Method Summary
 boolean fuse()
          Performs the fuse.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphFuser

public GraphFuser(Graph graph,
                  GraphBuilder builder,
                  GraphFuser.EdgeMerger merger)
Constructs a GraphFuser.

Parameters:
graph - Graph to fuse.
merger - Used to merge edges.
Method Detail

fuse

public boolean fuse()
Performs the fuse.

Returns:
True if the fuse was successful, otherwise false.


Copyright © GeoTools. All Rights Reserved.