Java Graph Analyzer
Written in 2001 for CS-344 Design and Analysis of Algorithms at Rutgers University.
Written in 2001 for CS-344 Design and Analysis of Algorithms at Rutgers University.
This program will perform various graph searching functions on an input dataset representing a graph G = (E,V).
It works on directed and undirected graphs, and detects cycles.
The stand-alone Java Graph Analyzer, will correctly do the following:
sets up the GUI and does most of the important required functions. A number of global data structures are used which store the TreeEdges, Backedges, CutPoints, dfsNumbers, backnumbers, and finishing numbers.
this function creates the adjacency list for the Graph. It handles both directed and undirected graphs. Arrays of Linked Lists are used to store the edges and edge weights associated with each edge. Arrays that will be used to store the dfsnumbers and back numbers are allocated.
this function calls DFS() and outputs the tree and backedges. The existence of backedges indicates that a cycle exists.
this function calls DFS() on undirected graphs and outputs the cutpoints. If there are no cutpoints the graph is biconnected.
checks whether the graph is connected. If it is, it calls Prims() and outputs the MST and it's total weight.
calls DFS(). It outputs the topsorted ordering of vertices for acyclic graphs.
recursive function that does a Depth First Search on an input Graph. This method is used to create a topological ordering on a directed graph and to find the biconnected components of an undirected graph. Calls DFSFrom(vertex) to perform these calculations.
Computes cutpoints, topsorted ordering of vertices, and dfs tree. ParentOf[] keeps track of parents, avals[] keeps track of the place in the linked list(each vertice's edge list) that we leave off at when pushing a vertex on the stack, Stack[] keeps track of which vertices are on the stack, backnum[] and dfsnum[] keep track of those numbers for each vertex.
Computes the MST of a connected, undirected graph. status[] keeps track of status for each vertex, marked[] keeps track of which vertices are marked, parent[] keeps track of parents, count is the number of unmarked vertices, tempweight keeps track of lowest weight, and tempvertex keeps track of which vertex has the lowest weight.
clears the corresponding data structures that hold backEdges, treeEdges, and FinishingNums.
Global variables he and she are used to hold the first and second vertices of an edge.
null constructor
contructor that creates an edge with 2 given vertices
extracts the second vertex of an edge pair
extracts the first vertex of an edge pair
Global variable num is used to give each vertex a label. Global variable numD is used to hold the weight of each edge. Weights are stored in vertices to make the implementation if the adjacency list more efficient. (In the adjacency list every other node is a vertex and every other node is a weight).
null constructor
constructor with vertex label x
constructor for a node that holds weight information for an edge. The weight is specified by y.
returns the num for this Vertex
returns the numD for this Vertex. (returns the weight associated with the edge that this Vertex is a part of).
constructs the application, frames, and runs the main program