GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • @maxgraph/core

This view

  • Original page
  • New address

GeezerVison is showing maxgraph.github.io — FastOrganicLayout | @maxgraph/core

  • FastOrganicLayout

Class FastOrganicLayout

Extends GraphLayout to implement a fast organic layout algorithm. The vertices need to be connected for this layout to work, vertices with no connections are ignored.

Example:

const layout = new FastOrganicLayout(graph);
layout.execute(graph.getDefaultParent());

Hierarchy (View Summary)

  • GraphLayout
    • FastOrganicLayout
  • Defined in view/layout/FastOrganicLayout.ts:37
Index

Constructors

constructor

Properties

allowedToRun cellLocation disableEdgeStyle dispX dispY forceConstant forceConstantSquared graph indices initialTemp isMoveable iteration maxDistanceLimit maxIterations minDistanceLimit minDistanceLimitSquared neighbours parent radius radiusSquared resetEdges temperature useBoundingBox useInputOrigin vertexArray

Methods

arrangeGroups calcAttraction calcPositions calcRepulsion execute getConstraint getGraph getParentOffset getVertexBounds isAncestor isEdgeIgnored isVertexIgnored isVertexMovable moveCell reduceTemperature resizeCell setEdgePoints setEdgeStyleEnabled setOrthogonalEdge setVertexLocation traverse

Constructors

constructor

  • new FastOrganicLayout(graph: AbstractGraph): FastOrganicLayout

    Parameters

    • graph: AbstractGraph

    Returns FastOrganicLayout

    Overrides GraphLayout.constructor

    • Defined in view/layout/FastOrganicLayout.ts:38

Properties

allowedToRun

allowedToRun: boolean = true

Boolean flag that specifies if the layout is allowed to run. If this is set to false, then the layout exits in the following iteration.

  • Defined in view/layout/FastOrganicLayout.ts:152

cellLocation

cellLocation: any[] = []

An array of locally stored co-ordinate positions for the vertices.

  • Defined in view/layout/FastOrganicLayout.ts:121

disableEdgeStyle

disableEdgeStyle: boolean = true

Specifies if the STYLE_NOEDGESTYLE flag should be set on edges that are modified by the result. Default is true.

  • Defined in view/layout/FastOrganicLayout.ts:55

dispX

dispX: number[] = []

An array of locally stored X co-ordinate displacements for the vertices.

  • Defined in view/layout/FastOrganicLayout.ts:111

dispY

dispY: number[] = []

An array of locally stored Y co-ordinate displacements for the vertices.

  • Defined in view/layout/FastOrganicLayout.ts:116

forceConstant

forceConstant: number = 50

The force constant by which the attractive forces are divided and the replusive forces are multiple by the square of. The value equates to the average radius there is of free space around each node. Default is 50.

  • Defined in view/layout/FastOrganicLayout.ts:60

forceConstantSquared

forceConstantSquared: any = 0

Cache of ^2 for performance.

  • Defined in view/layout/FastOrganicLayout.ts:65

graph

graph: AbstractGraph

Reference to the enclosing AbstractGraph.

Inherited from GraphLayout.graph

  • Defined in view/layout/GraphLayout.ts:42

indices

indices: { [key: string]: number } = {}

Hashtable from cells to local indices.

  • Defined in view/layout/FastOrganicLayout.ts:146

initialTemp

initialTemp: number = 200

Start value of temperature. Default is 200.

  • Defined in view/layout/FastOrganicLayout.ts:86

isMoveable

isMoveable: boolean[] = []

Array of booleans representing the movable states of the vertices.

  • Defined in view/layout/FastOrganicLayout.ts:136

iteration

iteration: number = 0

Current iteration count.

  • Defined in view/layout/FastOrganicLayout.ts:101

maxDistanceLimit

maxDistanceLimit: number = 500

Maximal distance limit. Default is 500. Prevents of dividing by zero.

  • Defined in view/layout/FastOrganicLayout.ts:76

maxIterations

maxIterations: number = 0

Total number of iterations to run the layout though.

  • Defined in view/layout/FastOrganicLayout.ts:96

minDistanceLimit

minDistanceLimit: number = 2

Minimal distance limit. Default is 2. Prevents of dividing by zero.

  • Defined in view/layout/FastOrganicLayout.ts:70

minDistanceLimitSquared

minDistanceLimitSquared: number = 4

Cached version of minDistanceLimit squared.

  • Defined in view/layout/FastOrganicLayout.ts:81

neighbours

neighbours: { [key: number]: number[] } = {}

Local copy of cell neighbours.

  • Defined in view/layout/FastOrganicLayout.ts:141

parent

parent: Cell | null = null

The parent cell of the layout, if any

Default

null

Inherited from GraphLayout.parent

  • Defined in view/layout/GraphLayout.ts:54

radius

radius: number[] = []

The approximate radius of each cell, nodes only.

  • Defined in view/layout/FastOrganicLayout.ts:126

radiusSquared

radiusSquared: number[] = []

The approximate radius squared of each cell, nodes only.

  • Defined in view/layout/FastOrganicLayout.ts:131

resetEdges

resetEdges: boolean = true

Specifies if all edge points of traversed edges should be removed. Default is true.

  • Defined in view/layout/FastOrganicLayout.ts:50

temperature

temperature: number = 0

Temperature to limit displacement at later stages of layout.

  • Defined in view/layout/FastOrganicLayout.ts:91

useBoundingBox

useBoundingBox: boolean = true

Boolean indicating if the bounding box of the label should be used if it iss available.

Default

true.

Inherited from GraphLayout.useBoundingBox

  • Defined in view/layout/GraphLayout.ts:48

useInputOrigin

useInputOrigin: boolean = true

Specifies if the top left corner of the input cells should be the origin of the layout result. Default is true.

  • Defined in view/layout/FastOrganicLayout.ts:45

vertexArray

vertexArray: Cell[] = []

An array of all vertices to be laid out.

  • Defined in view/layout/FastOrganicLayout.ts:106

Methods

arrangeGroups

  • arrangeGroups(
        cells: Cell[],
        border: number,
        topBorder: number,
        rightBorder: number,
        bottomBorder: number,
        leftBorder: number,
    ): Cell[]

    Shortcut to AbstractGraph.updateGroupBounds with moveGroup set to true.

    Parameters

    • cells: Cell[]
    • border: number
    • topBorder: number
    • rightBorder: number
    • bottomBorder: number
    • leftBorder: number

    Returns Cell[]

    Inherited from GraphLayout.arrangeGroups

    • Defined in view/layout/GraphLayout.ts:424

calcAttraction

  • calcAttraction(): void

    Calculates the attractive forces between all laid out nodes linked by edges

    Returns void

    • Defined in view/layout/FastOrganicLayout.ts:378

calcPositions

  • calcPositions(): void

    Takes the displacements calculated for each cell and applies them to the local cache of cell positions. Limits the displacement to the current temperature.

    Returns void

    • Defined in view/layout/FastOrganicLayout.ts:342

calcRepulsion

  • calcRepulsion(): void

    Calculates the repulsive forces between all laid out nodes

    Returns void

    • Defined in view/layout/FastOrganicLayout.ts:419

execute

  • execute(parent: Cell): void

    Implements GraphLayout#execute. This operates on all children of the given parent where returns false.

    Parameters

    • parent: Cell

    Returns void

    Overrides GraphLayout.execute

    • Defined in view/layout/FastOrganicLayout.ts:170

getConstraint

  • getConstraint(key: string, cell: Cell, edge?: Cell, source?: boolean): any

    Returns the constraint for the given key and cell. The optional edge and source arguments are used to return inbound and outgoing routing- constraints for the given edge and vertex. This implementation always returns the value for the given key in the style of the given cell.

    Parameters

    • key: string

      Key of the constraint to be returned.

    • cell: Cell

      Cell whose constraint should be returned.

    • Optionaledge: Cell

      Optional Cell that represents the connection whose constraint should be returned. Default is null.

    • Optionalsource: boolean

      Optional boolean that specifies if the connection is incoming or outgoing. Default is null.

    Returns any

    Inherited from GraphLayout.getConstraint

    • Defined in view/layout/GraphLayout.ts:115

getGraph

  • getGraph(): AbstractGraph

    Returns the graph that this layout operates on.

    Returns AbstractGraph

    Inherited from GraphLayout.getGraph

    • Defined in view/layout/GraphLayout.ts:98

getParentOffset

  • getParentOffset(parent: Cell | null): Point

    Determines the offset of the given parent to the parent of the layout

    Parameters

    • parent: Cell | null

    Returns Point

    Inherited from GraphLayout.getParentOffset

    • Defined in view/layout/GraphLayout.ts:261

getVertexBounds

  • getVertexBounds(cell: Cell): Rectangle

    Returns an Rectangle that defines the bounds of the given cell or the bounding box if useBoundingBox is true.

    Parameters

    • cell: Cell

    Returns Rectangle

    Inherited from GraphLayout.getVertexBounds

    • Defined in view/layout/GraphLayout.ts:380

isAncestor

  • isAncestor(
        parent: Cell,
        child: Cell | null,
        traverseAncestors?: boolean,
    ): boolean

    Returns true if the given parent is an ancestor of the given child.

    Parameters

    • parent: Cell

      Cell that specifies the parent.

    • child: Cell | null

      Cell that specifies the child.

    • OptionaltraverseAncestors: boolean

      boolean whether to

    Returns boolean

    Inherited from GraphLayout.isAncestor

    • Defined in view/layout/GraphLayout.ts:191

isEdgeIgnored

  • isEdgeIgnored(edge: Cell): boolean

    Returns a boolean indicating if the given Cell should be ignored by the algorithm. This implementation returns false for all vertices.

    Parameters

    • edge: Cell

      Cell whose ignored state should be returned.

    Returns boolean

    Inherited from GraphLayout.isEdgeIgnored

    • Defined in view/layout/GraphLayout.ts:234

isVertexIgnored

  • isVertexIgnored(vertex: Cell): boolean

    Returns a boolean indicating if the given should be ignored as a vertex. This returns true if the cell has no connections.

    Parameters

    • vertex: Cell

      whose ignored state should be returned.

    Returns boolean

    Overrides GraphLayout.isVertexIgnored

    • Defined in view/layout/FastOrganicLayout.ts:160

isVertexMovable

  • isVertexMovable(cell: Cell): boolean

    Returns a boolean indicating if the given Cell is movable or bendable by the algorithm. This implementation returns true if the given cell is movable in the graph.

    Parameters

    • cell: Cell

      Cell whose movable state should be returned.

    Returns boolean

    Inherited from GraphLayout.isVertexMovable

    • Defined in view/layout/GraphLayout.ts:214

moveCell

  • moveCell(cell: Cell, x: number, y: number): void

    Notified when a cell is being moved in a parent that has automatic layout to update the cell state (eg. index) so that the outcome of the layout will position the vertex as close to the point (x, y) as possible.

    Empty implementation.

    Parameters

    • cell: Cell

      Cell which has been moved.

    • x: number

      X-coordinate of the new cell location.

    • y: number

      Y-coordinate of the new cell location.

    Returns void

    Inherited from GraphLayout.moveCell

    • Defined in view/layout/GraphLayout.ts:68

reduceTemperature

  • reduceTemperature(): void

    Reduces the temperature of the layout from an initial setting in a linear fashion to zero.

    Returns void

    • Defined in view/layout/FastOrganicLayout.ts:473

resizeCell

  • resizeCell(cell: Cell, bounds: Rectangle, prev?: Cell): void

    Notified when a cell is being resized in a parent that has automatic layout to update the other cells in the layout.

    Empty implementation.

    Parameters

    • cell: Cell

      Cell which has been moved.

    • bounds: Rectangle

      Rectangle that represents the new cell bounds.

    • Optionalprev: Cell

    Returns void

    Inherited from GraphLayout.resizeCell

    • Defined in view/layout/GraphLayout.ts:82

setEdgePoints

  • setEdgePoints(edge: Cell, points: Point[] | null): void

    Replaces the array of Point in the geometry of the given edge with the given array of Point.

    Parameters

    • edge: Cell
    • points: Point[] | null

    Returns void

    Inherited from GraphLayout.setEdgePoints

    • Defined in view/layout/GraphLayout.ts:286

setEdgeStyleEnabled

  • setEdgeStyleEnabled(edge: Cell, value: boolean): void

    Disables or enables the edge style of the given edge.

    Parameters

    • edge: Cell
    • value: boolean

    Returns void

    Inherited from GraphLayout.setEdgeStyleEnabled

    • Defined in view/layout/GraphLayout.ts:246

setOrthogonalEdge

  • setOrthogonalEdge(edge: Cell, value: boolean): void

    Disables or enables orthogonal end segments of the given edge.

    Parameters

    • edge: Cell
    • value: boolean

    Returns void

    Inherited from GraphLayout.setOrthogonalEdge

    • Defined in view/layout/GraphLayout.ts:253

setVertexLocation

  • setVertexLocation(cell: Cell, x: number, y: number): Rectangle | null

    Sets the new position of the given cell taking into account the size of the bounding box if useBoundingBox is true. The change is only carried out if the new location is not equal to the existing location, otherwise the geometry is not replaced with an updated instance. The new or old bounds are returned (including overlapping labels).

    Parameters

    • cell: Cell

      Cell whose geometry is to be set.

    • x: number

      Integer that defines the x-coordinate of the new location.

    • y: number

      Integer that defines the y-coordinate of the new location.

    Returns Rectangle | null

    Inherited from GraphLayout.setVertexLocation

    • Defined in view/layout/GraphLayout.ts:324

traverse

  • traverse(vertex: GraphLayoutTraverseArgs): void

    Traverses the (directed) graph invoking the given function for each visited vertex and edge. The function is invoked with the current vertex and the incoming edge as a parameter. This implementation makes sure each vertex is only visited once. The function may return false if the traversal should stop at the given vertex.

    Example:

    GlobalConfig.logger.show();
    const cell = graph.getSelectionCell();
    graph.traverse(cell, false, function(vertex, edge)
    {
    GlobalConfig.logger.debug(graph.getLabel(vertex));
    });

    Parameters

    • vertex: GraphLayoutTraverseArgs

      Cell that represents the vertex where the traversal starts.

    Returns void

    Inherited from GraphLayout.traverse

    • Defined in view/layout/GraphLayout.ts:147

Settings

Member Visibility
  • Protected
  • Inherited
Theme

On This Page

Constructors
constructor
Properties
allowedToRuncellLocationdisableEdgeStyledispXdispYforceConstantforceConstantSquaredgraphindicesinitialTempisMoveableiterationmaxDistanceLimitmaxIterationsminDistanceLimitminDistanceLimitSquaredneighboursparentradiusradiusSquaredresetEdgestemperatureuseBoundingBoxuseInputOriginvertexArray
Methods
arrangeGroupscalcAttractioncalcPositionscalcRepulsionexecutegetConstraintgetGraphgetParentOffsetgetVertexBoundsisAncestorisEdgeIgnoredisVertexIgnoredisVertexMovablemoveCellreduceTemperatureresizeCellsetEdgePointssetEdgeStyleEnabledsetOrthogonalEdgesetVertexLocationtraverse
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.