The NetWorKsPanel is an applet that runs on a web page. This class supports algorithm selection and control, manages the display of the GraphControlPanel, and also displays a GraphPanel. The NetWorKsPanel swaps out the algorithm selection, algorithm control, and GraphControlPanel which are displayed across the top of the screen. The GraphControlPanel is the panel used to edit Vertex and Edge attributes, and allows switching back and forth between the directed and undirected graphs. The GraphPanel displays the graphs and supports adding and deleting vertices and edges. The GraphPanel also provides animation and control for moving vertices.
Whenever a user selects an algorithm, or presses the restart or step button, the NetWorKsPanel instructs the GraphPanel to display the appropriate graph, and then the NetWorKsPanel invokes the GraphAlgorithm init(GraphPanel) or step(GraphPanel) method. The SimpleUndirectedGraph class extends the SimpleGraph class to handle undirected edges. The SimpleGraph class extends the Graph class to prohibit loops. Since the SimpleUndirectedGraph and SimpleGraph classes are extensions of the Graph class, they both implement all of the Graph class methods. The Graph class provides access to arrays of Vertex and Edge objects which are stored internally in HashTables
. Graph objects can draw static or transient portions of themselves, and can determine whether a given location is contained within the Graph.
The Edge class provides methods to access and modify its color, weight, flow, capacity, and min attributes. The class implements the Sortable interface with a precedes() method that allows an array of Edge objects to be sorted by any of these attributes. Edge objects can draw themselves as directed or undirected, and they provide access to incident Vertex objects.
The Vertex class provides methods to access color, demand and vName attributes. The class implements the Sortable interface
with a precedes() method that allows an array of Vertex objects to be sorted by any of these attributes.
A Vertex object can draw itself, or can draw itself along with incident edges. It can also produce arrays of incident, out-incident, or in-incident edges. Note that the edges are stored in a HashTable. The General class provides access to a pool of data relevant to a variety of classes within the GraphStuff package.