Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.uci.ics.jung.visualization.contrib
Class KKLayout

    java.lang.Object
      edu.uci.ics.jung.visualization.AbstractLayout
          edu.uci.ics.jung.visualization.contrib.KKLayout

All Implemented Interfaces:
  ChangeEventSupport, Layout, VertexLocationFunction

public class KKLayout
extends AbstractLayout

Implements the Kamada-Kawai algorithm for node layout. Does not respect filter calls, and sometimes crashes when the view changes to it.

Author:
  Masanori Harada
See Also:
  "Tomihisa Kamada and Satoru Kawai: An algorithm for drawing general indirect graphs. Information Processing Letters 31(1):7-15, 1989", "Tomihisa Kamada: On visualization of abstract objects and relations. Ph.D. dissertation, Dept. of Information Science, Univ. of Tokyo, Dec. 1988."

Field Summary
`protected double` | `diameter` The diameter of the visible graph.
`protected Distance` | `distance` Retrieves graph distances between vertices of the visible graph

Fields inherited from class edu.uci.ics.jung.visualization.AbstractLayout
`changeSupport, vertex_locations`

Constructor Summary
`KKLayout(Graph g)`
`KKLayout(Graph g, Distance distance)`

Method Summary
`void` | `adjustForGravity()` Shift all vertices so that the center of gravity is located at the center of the screen.
`void` | `advancePositions()` Implementors must override this method in order to create a Layout.
`boolean` | `getAdjustForGravity()` Returns true if gravity point adjusting is enabled.
`boolean` | `getExchangeVertices()` Returns true if the local minimum escape technique by exchanging vertices is enabled.
`String` | `getStatus()` Returns the current status of the sytem, or null if there is no particular status to report. Useful for reporting things like number of iterations passed, temperature, and so on.By default, an `AbstractLayout` returns null for its status.By default, an `AbstractLayout` returns null for its status.
`boolean` | `incrementsAreDone()` Returns true once the current iteration has passed the maximum count.
`protected void` | `initialize_local_vertex(Vertex v)` Initializes the local information on a single vertex.
`protected void` | `initialize_local()` Initializes all local information, and is called immediately within the `initialize()` process.
`protected void` | `initializeLocations()` This method calls `initialize_local_vertex` for each vertex, and also adds initial coordinate information for each vertex.
`boolean` | `isIncremental()` This one is an incremental visualization.
`void` | `setAdjustForGravity(boolean on)` Enable or disable gravity point adjusting.
`void` | `setDisconnectedDistanceMultiplier(double disconnected_multiplier)` Sets a multiplicative factor that specifies the fraction of the graph's diameter to be used as the inter-vertex distance between disconnected vertices.
`void` | `setExchangeVertices(boolean on)` Enable or disable the local minimum escape technique by exchanging vertices.
`void` | `setLengthFactor(double length_factor)` Sets a multiplicative factor which partly specifies the "preferred" length of an edge (L).
`void` | `setMaxIterations(int maxIterations)`

Methods inherited from class edu.uci.ics.jung.visualization.AbstractLayout
`addChangeListener, applyFilter, dontMove, fireStateChanged, forceMove, getAVertex, getBaseKey, getChangeListeners, getCoordinates, getCurrentSize, getEdge, getEdge, getGraph, getLocation, getVertex, getVertex, getVertexIterator, getVisibleEdges, getVisibleGraph, getVisibleVertices, getX, getY, initialize, initialize, initializeLocation, isLocked, lockVertex, offsetVertex, postInitialize, removeChangeListener, resize, restart, unlockVertex`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### distance

    protected Distance distance

  Retrieves graph distances between vertices of the visible graph

### diameter

    protected double diameter

  The diameter of the visible graph. In other words, the maximum over all pairs of vertices of the length of the shortest path between a and bf the visible graph.

Constructor Detail

### KKLayout

    public KKLayout(Graph g)

### KKLayout

    public KKLayout(Graph g,
                    Distance distance)

Method Detail

### setLengthFactor

    public void setLengthFactor(double length_factor)

  Sets a multiplicative factor which partly specifies the "preferred" length of an edge (L).

### setDisconnectedDistanceMultiplier

    public void setDisconnectedDistanceMultiplier(double disconnected_multiplier)

  Sets a multiplicative factor that specifies the fraction of the graph's diameter to be used as the inter-vertex distance between disconnected vertices.

### getStatus

    public String getStatus()

  Description copied from class: `AbstractLayout`
  Returns the current status of the sytem, or null if there is no particular status to report. Useful for reporting things like number of iterations passed, temperature, and so on.By default, an `AbstractLayout` returns null for its status.

  Specified by:
    `getStatus` in interface `Layout`
  Overrides:
    `getStatus` in class `AbstractLayout`

### setMaxIterations

    public void setMaxIterations(int maxIterations)

### isIncremental

    public boolean isIncremental()

  This one is an incremental visualization.

### incrementsAreDone

    public boolean incrementsAreDone()

  Returns true once the current iteration has passed the maximum count.

### initialize_local

    protected void initialize_local()

  Description copied from class: `AbstractLayout`
  Initializes all local information, and is called immediately within the `initialize()` process. The user is responsible for overriding this method to do any construction that may be necessary: for example, to initialize local per-edge or graph-wide data.

  Overrides:
    `initialize_local` in class `AbstractLayout`

### initializeLocations

    protected void initializeLocations()

  Description copied from class: `AbstractLayout`
  This method calls `initialize_local_vertex` for each vertex, and also adds initial coordinate information for each vertex. (The vertex's initial location is set by calling `initializeLocation`.

  Overrides:
    `initializeLocations` in class `AbstractLayout`

### initialize_local_vertex

    protected void initialize_local_vertex(Vertex v)

  Description copied from class: `AbstractLayout`
  Initializes the local information on a single vertex. The user is responsible for overriding this method to do any vertex-level construction that may be necessary: for example, to attach vertex-level information to each vertex.

  Specified by:
    `initialize_local_vertex` in class `AbstractLayout`

### advancePositions

    public void advancePositions()

  Description copied from class: `AbstractLayout`
  Implementors must override this method in order to create a Layout. If the Layout is the sort that only calculates locations once, this method may be overridden with an empty method.

  Note that "locked" vertices are not to be moved; however, it is the policy of the visualization to decide how to handle them, and what to do with the vertices around them. Prototypical code might include a clipping like

        for (Iterator i = getVertices().iterator(); i.hasNext() ) { Vertex v = (Vertex) i.next(); if (! dontmove.contains( v ) ) { ... // handle the node } else { // ignore the node } }

  Specified by:
    `advancePositions` in interface `Layout`
  Specified by:
    `advancePositions` in class `AbstractLayout`
  See Also:
    `Layout.advancePositions()`

### adjustForGravity

    public void adjustForGravity()

  Shift all vertices so that the center of gravity is located at the center of the screen.

### setAdjustForGravity

    public void setAdjustForGravity(boolean on)

  Enable or disable gravity point adjusting.

### getAdjustForGravity

    public boolean getAdjustForGravity()

  Returns true if gravity point adjusting is enabled.

### setExchangeVertices

    public void setExchangeVertices(boolean on)

  Enable or disable the local minimum escape technique by exchanging vertices.

### getExchangeVertices

    public boolean getExchangeVertices()

  Returns true if the local minimum escape technique by exchanging vertices is enabled.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD