All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class structure.GraphListUndirected

java.lang.Object
    |
    +----structure.GraphList
            |
            +----structure.GraphListUndirected

public class GraphListUndirected
extends GraphList
A class implementing an undirected, adjacency-list based graph.

See Also:
GraphList, GraphListDirected, GraphMatrixUndirected

Constructor Index

 o GraphListUndirected()
Construct an undirected, adjacency-list based graph.

Method Index

 o addEdge(Object, Object, Object)
Add an edge between two vertices within the graph.
 o edgeCount()
Determine the number of edges in graph.
 o remove(Object)
Remove a vertex from the graph.
 o removeEdge(Object, Object)
Remove possible edge between vertices labeled vLabel1 and vLabel2.
 o toString()
Construct a string representation of graph.

Constructors

 o GraphListUndirected
public GraphListUndirected()
Construct an undirected, adjacency-list based graph.

Postcondition:
constructs an undirected graph

Methods

 o 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 GraphList
 o remove
public Object remove(Object label)
Remove a vertex from the graph. Associated edges are also removed. Non-vertices are silently ignored.

Precondition:
label is non-null vertex label
Postcondition:
vertex with "equals" label is removed, if found

Parameters:
label - The label of the vertex within the graph.
Returns:
The label associated with the vertex.
Overrides:
remove in class GraphList
 o 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 GraphList
 o 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 GraphList
 o 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