Ejemplo n.º 1
0
 /**
  * (non-Javadoc)
  *
  * @see
  *     edu.uci.ics.jung.visualization.AbstractLayout#initialize_local_vertex(edu.uci.ics.jung.graph.Vertex)
  */
 protected void initialize_local_vertex(Vertex v) {
   ISOMVertexData vd = getISOMVertexData(v);
   if (vd == null) {
     vd = new ISOMVertexData();
     v.addUserDatum(getIsomKey(), vd, UserData.REMOVE);
   }
   vd.visited = false;
 }
Ejemplo n.º 2
0
  private synchronized void adjustVertex(Vertex v) {
    queue.removeAllElements();
    ISOMVertexData ivd = getISOMVertexData(v);
    ivd.distance = 0;
    ivd.visited = true;
    queue.add(v);
    Vertex current;

    while (!queue.isEmpty()) {
      current = (Vertex) queue.remove(0);
      ISOMVertexData currData = getISOMVertexData(current);
      Coordinates currXYData = getCoordinates(current);

      double dx = tempXYD.getX() - currXYData.getX();
      double dy = tempXYD.getY() - currXYData.getY();
      double factor = adaption / Math.pow(2, currData.distance);

      currXYData.addX(factor * dx);
      currXYData.addY(factor * dy);

      if (currData.distance < radius) {
        Set s = current.getNeighbors();
        while (true) {
          try {
            for (Iterator iter = s.iterator(); iter.hasNext(); ) {
              Vertex child = (Vertex) iter.next();
              ISOMVertexData childData = getISOMVertexData(child);
              if (childData != null && !childData.visited) {
                childData.visited = true;
                childData.distance = currData.distance + 1;
                queue.addElement(child);
              }
            }
            break;
          } catch (ConcurrentModificationException cme) {
          }
        }
      }
    }
  }
Ejemplo n.º 3
0
 public ISOMVertexData getISOMVertexData(Vertex v) {
   return (ISOMVertexData) (v.getUserDatum(getIsomKey()));
 }