@Override public Edge<E, V> insertEdge(Vertex<V> v, Vertex<V> w, E ele) throws Exception { @SuppressWarnings("unchecked") Position<PositionAwareType<E>> pos = edges.addPos(ele, (Class<? extends PositionAwareType<E>>) Edge.class); @SuppressWarnings("unchecked") Edge<E, V> eg = (Edge<E, V>) pos.element(); eg.setSource(v); eg.setDestination(w); return eg; }
@SuppressWarnings("unchecked") @Override public void reverseDirection() { Edge<E, V> h = (Edge<E, V>) edges.getHeader(); while (h != null) { Vertex<V> temp = h.getSource(); h.setSource(h.getDestination()); h.setDestination(temp); try { h = (Edge<E, V>) edges.next((Pointer<E>) h.getPosition()).element(); } catch (Exception exc) { h = null; } } }