next up previous contents
Next: Algorithms Class Up: GraphStuff Package Previous: General Class

GraphAlgorithm Class

The GraphAlgorithm abstract class provides a standard graph algorithm interface which the NetWorKsPanel uses to ``run'' algorithms. Extensions must provide init() and step() methods which a NetWorKsPanel invokes to ``run'' the algorithm. The init() and step() methods both return String objects, which are displayed on the algorithm control panel in the NetWorKsPanel.

package GraphStuff;

public abstract class GraphAlgorithm extends Object {

        public abstract String init (GraphPanel gP);

        public abstract String step(GraphPanel gP);

        public abstract int GraphType();
         // General.Simple 
         // or General.SimpleUndirected

        public abstract String title();

        public boolean showWeights() {return false; }

        public boolean showFlows() {return false; }

        public boolean showCapacities() {return false; }

        public boolean showMinimums() {return false; }

        public boolean showLabels() {return false; }

        public boolean showDemands() {return false; }

}

GraphAlgorithm extensions must provide a GraphType() method that returns an int indicating the type of Graph the algorithm requires. Extensions must also provide a title() method which returns a String to be displayed on a NetWorKPanels list of algorithms. Color attributes are always displayed, but methods indicate any other attributes of Edge and Vertex objects that should be displayed. For example, the following methods in an extension would indicate that Edge weights and Vertex labels should be displayed:

        public boolean showWeights() {return true; }
        public boolean showLabels() {return true; }



Kelly Waters
Mon Oct 27 18:18:15 EST 1997