documentationfor yFiles for HTML 2.6

RankAssignment

Solves the rank assignment problem.

Inheritance Hierarchy
RankAssignment

Remarks

Definitions

Let G = (V, E) be a directed acyclic graph. Let length(e) denote the minimum length and weight(e) the weight of an edge e.

The rank assignment problem is the problem of finding integer values rank(v) for all vV, such that:

  • rank(v) − rank(w) ≥ length(v, w), for all (v, w) ∈ E and,
  • ∑(weight(v, w) ⋅ (rank(v) − rank(w))) over all (v, w) ∈ E is minimized.

Algorithm

The algorithm solves the rank assignment problem using the simplex method. This method assigns a minimum rank to the nodes in a acyclic graph. Although its time complexity has not been proven polynomial, in practice it takes few iterations and runs quickly.

The algorithm is based on

  • E.R. Gansner et al., A Technique for Drawing Directed Graphs, IEEE Transactions on Software Engineering, Vol. 19, No. 3, March 1993.

Examples

Calculating the minimum rank to the nodes.
// prepare the rank assignment algorithm
const algorithm = new RankAssignment({
  weights,
  minimumEdgeLengths
})
// run the algorithm
const result = algorithm.run(graph)

// add labels indicating the actual rank
for (const node of graph.nodes) {
  const rank = result.nodeRankIds.get(node)
  if (rank) {
    graph.addLabel(node, `${rank}`)
  }
}

Type Details

yfiles module
view-layout-bridge
yfiles-umd modules
view-layout-bridge
Legacy UMD name
yfiles.analysis.RankAssignment

See Also

Constructors

Properties

Methods