code: @SuppressWarnings("unchecked")
  public void mouseReleased(MouseEvent e) {
      if(checkModifiers(e)) {
          final VisualizationViewer<String,String> vv = (VisualizationViewer<String,String>)e.getSource();
          final Point2D p = e.getPoint();
          Layout<String,String> layout = vv.getModel().getGraphLayout();
          GraphElementAccessor<String,String> pickSupport = vv.getPickSupport();
          if(pickSupport != null) {
              final String vertex = pickSupport.getVertex(layout, p.getX(), p.getY());
              if(vertex != null && startVertex != null) {
                  Graph<String,String> graph = vv.getGraphLayout().getGraph();
                  try{
                  	if(graph.addEdge(startVertex+"-"+vertex, startVertex, vertex, EdgeType.DIRECTED)){
                  		notifyListeners(startVertex, vertex);
                  	}
                  } catch(Exception ex){
                  	ex.printStackTrace();
                  }
              }
              vv.repaint();
          }
          startVertex = null;
          down = null;
          vv.removePostRenderPaintable(edgePaintable);
          vv.removePostRenderPaintable(arrowPaintable);
      }
  }
docs: If startVertex is non-null, and the mouse is released over an
  existing vertex, create an undirected edge from startVertex to
  the vertex under the mouse pointer. If shift was also pressed,
  create a directed edge instead.