Generic Graphing Framework

advertisement
Generic Graphing Framework
Lance Stout
Clemson University
2486 University Station
336-978-0038
lstout@clemson.edu
ABSTRACT
component of the circuit has custom, assosciated information that
is updated as the circuit runs. This applet does provide a means to
save the circuit structure for later viewing.
Categories and Subject Descriptors
E.1 Data Structures
K.3.1 Computer Uses in Education
General Terms
Design, Experimentation
Keywords
1.INTRODUCTION
The graph data structure is useful across many disciplines. Graphs
can be used to capture electical circuits, molecular structures,
maps, flow charts, mathematical expressions, etc. While there are
currently several applications available that provide tools for
creating these items, there is no common method for neither
storing the graph information nor creating the graph in the first
place.
Consider the logic gate simulator created by David Viner [1]. His
Java applet allows the user to create a logic circuit using boolean
operators by dragging various gates onto a workspace. The gates
can then be connected into a circuit by dragging handles from
output pins to input pins. The circuit can also be tested by
changing the values of inputs and observing how the outputs
react. However, the applet does not provide a means for saving
the circuit for later testing, nor does it allow automatic checking
and review against a previously designed circuit, such as one
created by a teacher.
A similar tool is provided by Johns Hopkins University [2]. This
applet has similar, but not as robust, functionality as Viner's. The
major distinction is that it computes and displays the outputs for
all possible combinations of inputs. There is again a lack of
preservation of data across sessions.
Paul Falstad has created an electric circuit viewer[3] that
demonstrates the behaviour of electric circuits. The applet
presents a predefined selection that demonstrate certain
behaviours as well as methods to create new ones. Each
From Clemson University, Sam Bryfczynski has developed
OrganicPad [4] and GraphPad [5]. OrganicPad is used for
modeling molecular structures while GraphPad is used for directly
drawing graphs. The appeal of both programs lies in their
networking capabilities. Students using the programs can create
molecules or graphs and then submit them to a teacher's instance
of the program which can automatically evaluate the student's
work and return a response.
2.STATEMENT OF NEED
Among applications that provide graph based tools, there is no
common framework to build upon. In each instance, custom data
structures were required which preclude the ability to easily share
information between programs.
A common format for saving graphs and data structures to
manipulate them would allow for a general purpose evaluation
tool that can check student's work against a teacher's copy.
Combined with an interface to generate the graph and networking
capabilities to send responses between student and teacher, the
result would be a Generic Graphing Framework that could easily
be adapted and tailored to specific disciplines.
3.PROPOSED SOLUTION
3.1 Data Structure
The fundamental aspect of the proposed framework is the data
structure model that will be used. In implementing a graph, nodes
and edges are required. Thus we have Node objects and Edge
objects. In order to maintain a generic nature, these objects serve
as wrappers to a dictionary or hash of properties. For example, a
node object in an electric circuit may have a “resistance” property,
while a node in a molecular structure may have an “element”
property.
In order to provide an interface with information on what
properties a node should have, and to assist with isomorphism
checks, a type system is needed. Node and edge types can be
defined by stating what previous type they extend (or none), and a
list of the properties required to be considered of that type. Since
the interface will likely require nodes to include properties for the
x and y coordinates it is located at on screen, each field must also
indicate whether or not it is to be used in isomorphism checks.
The main graph object has two associated properties: directed and
weighted. The behaviour of the graph when adding edges is
modified by these two properties. For example, when the graph is
undirected an additional edge is created and added to the graph
whenever a new edge is supplied that goes in the opposite
direction. This setup allows for the same algorithms to be used
when working with the graph regardless of if it is declared as
directed or undirected.
The graph object maintains a dictionar of all nodes and their
associated type and properties using the node label as its key. A
node is only added to the list if it has all of the fields required by
its stated type. A list of all edges is also stored in a similar fashion
and can be used to generate an adjacency list or matrix.
Isomorphism between two graph objects is also provided. The
nodes and edges in each graph are first “sanitized” by making
copies of them that do not include fields that were not marked as
required for isomorphism in the type definition. Afterwords, the
list of nodes and edges in each graph are compared and checked
for equality. If both graphs have identical lists of nodes and edges
then they are isomorphic.
The current implementation is built using Python and takes
advantage of the dictionary, list, and tuple structures provided by
the language. Edges, nodes, and type definitions are created using
dictinaries of tuples and lists of tuples rather than having explicit
classes for them.
The comparisons made when checking
isomorphism are handled by Python's checking for equality
between lists.
The representation of each node can be customized by adding an
“image” property to the node overriding the default display
method. More advanced client interfaces could have dedicated
display objects that can handle drawing nodes in a variety of
methods, such as dynamicall drawing shapes instead of relying on
predefined images.
In addition to the graph creation mechanisms, the interface must
provide a method for sending the graph to a teacher's client and
display any feedback. The student client should also be able to
accept a graph structure and question/statement from the teacher
and display them. In this manner, a teacher can create a problem
and send it to the students to solve.
A teacher version of the client also has the means to view all
solutions submitted by students and can mark them as correct or
incorrect in the event the program's automatic evaluation was
insufficient.
To facilitate checking student solutions, the teacher can mark the
nodes in a basic setup to a question as uneditable. Doing so
prevents the trouble of having nodes with different labels between
the student and teacher version which would complicate
isomorphism checking tremendously.
4.RESULTS
5.CONCLUSION
6.ACKNOWLEDGMENTS
3.2 Data Format
7.REFERENCES
The format used to save and exchange graphs between students
and teachers is XML based. Node elements consist of the element
“node” with its attributes consisting of “type” and the fields
required by the type. Edge elements consist of the element “edge”
and are required to have “type”, “source” and “target” attributes
as well as any others required by its type.
[1]
David Viner's Logic Gate Simulator
http://www.davidviner.com/java.php?pg=3
[2]
Johns Hopkins University Logic Circuit Solver
http://www.jhu.edu/~virtlab/logic/logic.htm
[3]
Paul Falstad's Electic Circuit Viewer
http://www.falstad.com/circuit/index.html
[4]
Sam Bryfczynski's OrganicPad
http://people.clemson.edu/~sbryfcz/481/index_files/Organi
cPad.htm
[5]
Sam Bryfczynski's GraphPad
http://people.clemson.edu/~sbryfcz/481/index_files/Graph
Pad.htm
Type definitions conside of the element “type” and has the
attribute “extends” specifying the type it inherits from. This
element contains “property” elements that have “name” and
“required” attributes.
With these XML element definitions, any given graph created
using the code objects can be stored and retrieved from disk or
I/O stream.
3.2 Interface Features
The interface is adaptable to the type definitions supplied and can
provide options to add each type of node and edge specified.
Download