Package org.geotools.graph.util.graph
Class GraphFuser
Object
GraphFuser
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.



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
Nested ClassesModifier and TypeClassDescriptionstatic interfaceMerges the underlying objects represented by a number of edges into a single object. -
Constructor Summary
ConstructorsConstructorDescriptionGraphFuser(Graph graph, GraphBuilder builder, GraphFuser.EdgeMerger merger) Constructs a GraphFuser. -
Method Summary
-
Constructor Details
-
GraphFuser
Constructs a GraphFuser.- Parameters:
graph- Graph to fuse.builder- GraphBuilder used to fuse graph.merger- Used to merge edges.
-
-
Method Details
-
fuse
public boolean fuse()Performs the fuse.- Returns:
- True if the fuse was successful, otherwise false.
-