The DigraphAsMatrix class can be implemented
by extending the GraphAsMatrix class
introduced in Program
to implement the Digraph interface
defined in Program
:
public class DigraphAsMatrix
extends GraphAsMatrix
implements Digraph
{
// ...
}
Implement the DigraphAsMatrix class
by providing suitable definitions for the following methods:
DigraphAsMatrix (constructor),
purge,
addEdge, getEdge, isEdge, and getEdges.
You must also have a complete implementation of the base class
GraphAsMatrix (see Project
).
Write a test program and test your implementation.