suvi.alg
Class GraphLayoutAlgChassis

java.lang.Object
  |
  +--javautils.collections.Algs
        |
        +--javautils.graph.Graphs
              |
              +--suvi.alg.GraphLayoutAlgChassis
All Implemented Interfaces:
EdgeLabelConstants, FlowTrendConstants, GraphLayoutAlg, GraphLayoutAttrConsumer

public class GraphLayoutAlgChassis
extends javautils.graph.Graphs
implements GraphLayoutAlg, EdgeLabelConstants, FlowTrendConstants

The chassis for a family of graph layout algorithms.

A graph layout algorithm is a rather complex beast. To tame the complexity it is necessary to divide the overall algorithm into several phases and conquer each phase separately. The design of this class is based on the Strategy-design pattern described in [Gamma1995]. The overall graph layout algorithm is divided into 5 separate and mostly mutually orthogonal strategies, or policies, that implement separate phases of the overall graph layout algorithm.

A ComponentLayoutPolicy decides relative placement, or layout, of separate connected components of the graph. Within each connected component, the algorithm computes the layout in four distinct phases:

  1. A NodeRankingPolicy decides the rank, or roughly the row, of each node.
  2. A NodeOrderingPolicy decides the order of nodes within ranks.
  3. A NodePositioningPolicy decides the exact coordinates of nodes.
  4. A EdgeRoutingPolicy decides the exact routes for edges.

Because there is only one chassis and an open set of implementations of the 5 policies, the chassis is given as much responsibility over computing intermediate and auxiliary information to assist the policies as reasonable. This way the policy implementations can be relatively simple. In particular the chassis

For more details on the collaboration and contracts between the algorithm chassis and the policies, read the documentation of the policies.


Field Summary
 
Fields inherited from class javautils.collections.Algs
EMPTY_ARRAY, EMPTY_LIST, EMPTY_MAP, EMPTY_SEQUENCE, EMPTY_SET
 
Fields inherited from interface suvi.api.alg.attr.EdgeLabelConstants
EL_CENTER_LABEL, EL_HEAD_LABEL, EL_MAX_LABEL, EL_MIN_LABEL, EL_TAIL_LABEL
 
Fields inherited from interface suvi.api.alg.attr.FlowTrendConstants
FT_BIT_MASK, FT_CANONICAL, FT_DOWN_LEFT, FT_DOWN_RIGHT, FT_INVERT_ORDERING_FLAG, FT_INVERT_RANKING_FLAG, FT_LEFT_DOWN, FT_LEFT_UP, FT_RIGHT_DOWN, FT_RIGHT_UP, FT_ROTATE_FLAG, FT_UP_LEFT, FT_UP_RIGHT
 
Constructor Summary
GraphLayoutAlgChassis(ComponentLayoutPolicy componentLayoutPolicy, NodeRankingPolicy nodeRankingPolicy, NodeOrderingPolicy nodeOrderingPolicy, NodePositioningPolicy nodePositioningPolicy, EdgeRoutingPolicy edgeRoutingPolicy)
           
 
Method Summary
 GraphLayoutAttr[] defaultAttrs()
          Default implementations of all the required attributes.
 GraphLayout layout(javautils.graph.adt.Graph unaugmentedOriginalGraph, GraphLayoutAttrMap unaugmentedAttrMap)
           return layout(graph, attrMap, GraphLayoutAlgProgressPolicy.NULL_PROGRESS_POLICY);
 GraphLayout layout(javautils.graph.adt.Graph unaugmentedOriginalGraph, GraphLayoutAttrMap unaugmentedAttrMap, GraphLayoutAlgProgressPolicy progressPolicy)
          A layout for the specified graph computed according to the specified layout attributes.
 
Methods inherited from class javautils.graph.Graphs
asSourceTargetPair, asString, asString, augmented, connectedComponents, edges, edgeSet, forEachEdge, forEachNode, inducedByEdgesAndContainingNodes, invariant, isAcyclic, isIncoming, isSelf, nodesByDecreasingDfsFinishingTime, nodesByIncreasingIndegree, nodesByIncreasingOutdegree, nodeSet, nodesReachableFrom, nodesReachableFrom, nodesReachableFrom, otherNode, randomGraph, restrictedToNodes, restrictedToNodes, restrictedToNodes, sameNodesAndEdges, stronglyConnectedComponents, transitiveIrreflexiveClosure, transposed, transposed, undirected
 
Methods inherited from class javautils.collections.Algs
addAll, allSuperInterfaces, asArray, asArray, asComparator, asUnmodifiableList, collect, collectMap, collectSet, collectUnmodifiable, concat, concat, concat, copyOf, copyOf, copyOf, copyOf, copyOf, copyOf, copyOf, copyOf, copyOf, copyOfArray, ensureLength, exists, exists, exists, filter, filter, filter, find, find, find, flatten, flatten, flatten, fold, fold, fold, foldRight, foldRight, foldRight, forAll, forAll, forAll, forEach, forEach, forEach, forEach, forEach, forEach, forEachInProduct, forEachInProduct, forEachInProduct, forEachInProduct, genAddAll, genConcat, genConcat, genForEach, genForEach, getOrIfNull, integersInRange, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iteratorOverArray, map, map, map, map, map, map, mapMorphism, mapMorphismTo, mapTransform, max, max, max, max, max, max, max, min, min, min, min, min, min, min, newMap, newShapedArray, newUnmodifiableList, putAll, putAll, reverseIterator, reverseIterator, select, select, select, sign, singletonIterator, sort, sort, sorted, sorted, transform, transform, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphLayoutAlgChassis

public GraphLayoutAlgChassis(ComponentLayoutPolicy componentLayoutPolicy,
                             NodeRankingPolicy nodeRankingPolicy,
                             NodeOrderingPolicy nodeOrderingPolicy,
                             NodePositioningPolicy nodePositioningPolicy,
                             EdgeRoutingPolicy edgeRoutingPolicy)
Method Detail

defaultAttrs

public GraphLayoutAttr[] defaultAttrs()
Description copied from interface: GraphLayoutAttrConsumer

Default implementations of all the required attributes. The returned array must not contain duplicates nor null references.

Specified by:
defaultAttrs in interface GraphLayoutAttrConsumer

layout

public GraphLayout layout(javautils.graph.adt.Graph unaugmentedOriginalGraph,
                          GraphLayoutAttrMap unaugmentedAttrMap)
Description copied from interface: GraphLayoutAlg
 return layout(graph,
               attrMap,
               GraphLayoutAlgProgressPolicy.NULL_PROGRESS_POLICY);
 

Specified by:
layout in interface GraphLayoutAlg

layout

public GraphLayout layout(javautils.graph.adt.Graph unaugmentedOriginalGraph,
                          GraphLayoutAttrMap unaugmentedAttrMap,
                          GraphLayoutAlgProgressPolicy progressPolicy)
Description copied from interface: GraphLayoutAlg

A layout for the specified graph computed according to the specified layout attributes. Calls the progress policy to report progress events.

Specified by:
layout in interface GraphLayoutAlg