@SuppressWarnings("unchecked")
 public String printEdges() {
   String s = "";
   Edge<E, V> eg = (Edge<E, V>) edges.getHeader();
   while (eg != null) {
     s += eg.toString() + " ";
     try {
       eg = (Edge<E, V>) edges.next((Pointer<E>) eg.getPosition()).element();
     } catch (Exception exc) {
       eg = null;
     }
   }
   return s;
 }
 @SuppressWarnings("unchecked")
 @Override
 public List<Edge<E, V>> list_edges() {
   List<Edge<E, V>> coll = new ArrayList<Edge<E, V>>();
   Edge<E, V> head_edg = (Edge<E, V>) edges.getHeader();
   while (head_edg != null) {
     coll.add(head_edg);
     try {
       head_edg = (Edge<E, V>) edges.next((Pointer<E>) head_edg.getPosition()).element();
     } catch (Exception exc) {
       head_edg = null;
     }
   }
   return coll;
 }
 @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;
     }
   }
 }
 @SuppressWarnings("unchecked")
 public String printEdges(String type) {
   String s = "";
   Edge<E, V> eg = (Edge<E, V>) edges.getHeader();
   while (eg != null) {
     if (eg.getType().equals(type))
       s += eg.getSource().getInfo() + " -> " + eg.getDestination().getInfo() + "\n";
     try {
       eg = (Edge<E, V>) edges.next((Pointer<E>) eg.getPosition()).element();
     } catch (Exception exc) {
       eg = null;
     }
   }
   return s;
 }
 @SuppressWarnings("unchecked")
 @Override
 public Iterator<Edge<E, V>> edges(String type) {
   List<Edge<E, V>> coll = new ArrayList<Edge<E, V>>();
   Edge<E, V> head_edg = (Edge<E, V>) edges.getHeader();
   while (head_edg != null) {
     if (head_edg.getType().equals(type)) coll.add(head_edg);
     try {
       head_edg = (Edge<E, V>) edges.next((Pointer<E>) head_edg.getPosition()).element();
     } catch (Exception exc) {
       head_edg = null;
     }
   }
   return coll.iterator();
 }
 @SuppressWarnings("unchecked")
 @Override
 public boolean areAdjacent(Vertex<V> v, Vertex<V> w) {
   boolean b = false;
   Edge<E, V> eg = (Edge<E, V>) edges.getHeader();
   while (eg != null && !b) {
     if ((eg.getDestination().equals(v) || eg.getSource().equals(v))
         && (eg.getDestination().equals(w) || eg.getSource().equals(w))) b = true;
     try {
       eg = (Edge<E, V>) edges.next((Pointer<E>) eg.getPosition()).element();
     } catch (Exception exc) {
       eg = null;
     }
   }
   return b;
 }
  @SuppressWarnings("unchecked")
  @Override
  public Iterator<Vertex<V>> adjacentVertices(Vertex<V> v) {
    List<Vertex<V>> coll = new ArrayList<Vertex<V>>();
    Edge<E, V> head_edg = (Edge<E, V>) edges.getHeader();
    while (head_edg != null) {
      if (head_edg.getSource().equals(v)) coll.add((Vertex<V>) head_edg.getDestination());
      try {
        head_edg = (Edge<E, V>) edges.next((Pointer<E>) head_edg.getPosition()).element();
      } catch (Exception exc) {
        head_edg = null;
      }
    }

    return coll.iterator();
  }
 @SuppressWarnings("unchecked")
 @Override
 public void removeEdge(Edge<E, V> e) throws Exception {
   edges.removePos((Position<PositionAwareType<E>>) e.getPosition());
 }