Class GraphFuser


  • public class GraphFuser
    extends 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
    • Constructor Detail

      • GraphFuser

        public GraphFuser​(Graph graph,
                          GraphBuilder builder,
                          GraphFuser.EdgeMerger merger)
        Constructs a GraphFuser.
        Parameters:
        graph - Graph to fuse.
        builder - GraphBuilder used to fuse graph.
        merger - Used to merge edges.
    • Method Detail

      • fuse

        public boolean fuse()
        Performs the fuse.
        Returns:
        True if the fuse was successful, otherwise false.