All Packages Class Hierarchy This Package Previous Next Index
Class structure.GraphMatrixUndirected
java.lang.Object

+structure.GraphMatrix

+structure.GraphMatrixUndirected
 public class GraphMatrixUndirected
 extends GraphMatrix
A class implementing an undirected, adjacencymatrix based graph.
User must commit to upper bound on number of vertices in graph.
 See Also:
 GraphMatrix, GraphMatrixDirected, GraphListUndirected

GraphMatrixUndirected(int)
 Construct an undirected, adjacencymatrix based graph.

addEdge(Object, Object, Object)
 Add an edge between two vertices within the graph.

edgeCount()
 Determine the number of edges in graph.

edges()
 Construct an iterator over all edges.

removeEdge(Object, Object)
 Remove possible edge between vertices labeled vLabel1 and vLabel2.

toString()
 Construct a string representation of graph.
GraphMatrixUndirected
public GraphMatrixUndirected(int size)
 Construct an undirected, adjacencymatrix based graph.
 Precondition:
 size > 0
 Postcondition:
 constructs an empty graph that may be expanded to
at most size vertices. Graph is undirected.
 Parameters:
 size  Maximum number of vertices in graph.
addEdge
public void addEdge(Object vLabel1,
Object vLabel2,
Object label)
 Add an edge between two vertices within the graph. Edge is undirected.
Duplicate edges are silently replaced.
Labels on edges may be null.
 Precondition:
 vLabel1 and vLabel2 are labels of existing vertices, v1 & v2
 Postcondition:
 an edge (undirected) is inserted between v1 and v2.
if edge is new, it is labeled with label (can be null)
 Parameters:
 vLabel1  One vertex.
 vLabel2  Another vertex.
 label  Label associated with the edge.
 Overrides:
 addEdge in class GraphMatrix
removeEdge
public Object removeEdge(Object vLabel1,
Object vLabel2)
 Remove possible edge between vertices labeled vLabel1 and vLabel2.
 Precondition:
 vLabel1 and vLabel2 are labels of existing vertices
 Postcondition:
 edge is removed, its label is returned
 Parameters:
 vLabel1  One vertex.
 vLabel2  Another vertex.
 Returns:
 The label associated with the edge removed.
 Overrides:
 removeEdge in class GraphMatrix
edgeCount
public int edgeCount()
 Determine the number of edges in graph.
 Postcondition:
 returns the number of edges in graph
 Returns:
 Number of edges in graph.
 Overrides:
 edgeCount in class GraphMatrix
edges
public Iterator edges()
 Construct an iterator over all edges.
edge is considered exactly once. Order is not guaranteed.
 Postcondition:
 returns iterator across all edges of graph (returns Edges)
 Returns:
 Iterator over edges.
 Overrides:
 edges in class GraphMatrix
toString
public String toString()
 Construct a string representation of graph.
 Postcondition:
 returns string representation of graph
 Returns:
 String representing graph.
 Overrides:
 toString in class Object
All Packages Class Hierarchy This Package Previous Next Index