@Override public Collection<E> getInEdges(V vertex) { if (!containsVertex(vertex)) { return null; } return Collections.unmodifiableCollection(getIncoming_internal(vertex)); }
public Collection<E> getInEdges(V vertex) { if (!containsVertex(vertex)) return null; return Collections.unmodifiableCollection(getIncoming_internal(vertex)); }
public Collection<E> getIncidentEdges(V vertex) { if (!containsVertex(vertex)) return null; Collection<E> incident_edges = new HashSet<E>(); incident_edges.addAll(getIncoming_internal(vertex)); incident_edges.addAll(getOutgoing_internal(vertex)); return Collections.unmodifiableCollection(incident_edges); }
@Override public Collection<E> getIncidentEdges(V vertex) { if (!containsVertex(vertex)) { return null; } Collection<E> incident_edges = new HashSet<E>(); incident_edges.addAll(getIncoming_internal(vertex)); incident_edges.addAll(getOutgoing_internal(vertex)); return Collections.unmodifiableCollection(incident_edges); }
public boolean removeVertex(V vertex) { if (!containsVertex(vertex)) return false; // copy to avoid concurrent modification in removeEdge ArrayList<E> incident = new ArrayList<E>(getIncoming_internal(vertex)); incident.addAll(getOutgoing_internal(vertex)); for (E edge : incident) removeEdge(edge); vertices.remove(vertex); return true; }
@Override public boolean removeVertex(V vertex) { if (!containsVertex(vertex)) { return false; } // copy to avoid concurrent modification in removeEdge ArrayList<E> incident = new ArrayList<E>(getIncoming_internal(vertex)); incident.addAll(getOutgoing_internal(vertex)); for (E edge : incident) { removeEdge(edge); } vertices.remove(vertex); return true; }