public void removePort(Port port) throws GraphException {
if (port == null) {
throw new IllegalArgumentException("null");
}
if (!this.ports.contains(port)) {
throw new GraphException("The graph doesn't contain the port that is being removed.");
}
// copy it so that we can remove edge without worrying about the
// iteration issue.
ArrayList<Edge> edgesToBeRemoved = new ArrayList<Edge>(port.getEdges());