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
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  GraphFuser.EdgeMerger
      Merges the underlying objects represented by a number of edges into a single object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean fuse()
      Performs the fuse.
      • Methods inherited from class 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.
        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.