This stage can be used to layout non-tree structures with a tree layout algorithm.

Namespace: yWorks.yFiles.Layout.Tree
Assembly: yWorks.yFilesSilverlight.Algorithms (in yWorks.yFilesSilverlight.Algorithms.dll) Version: 2.4.0.0

Syntax

C#
public class TreeReductionStage : AbstractLayoutStage
Visual Basic
Public Class TreeReductionStage _ Inherits AbstractLayoutStage

Remarks

This stage can be used to layout non-tree structures with a tree layout algorithm. First this stage transforms a graph into a tree or forest by removing some edges. Then it invokes the core layout algorithm on the reduced graph. Finally, it reinserts the hidden non-tree edges to the graph again and optionally routes these edges.

Typical usage:

CopyC#
TreeLayouter tl = new TreeLayouter();
TreeReductionStage trs = new TreeReductionStage();
trs.NonTreeEdgeRouter = new OrganicEdgeRouter();
trs.NonTreeEdgeSelectionKey = OrganicEdgeRouter.RouteEdgeDpKey);
tl.AppendStage(trs);
graph.ApplyLayout(new BufferedLayouter(tl));
tl.RemoveStage(trs);

Note that if there are edges between group nodes, the TreeLayouter may throw a InvalidGraphStructureException -Exception. Such exceptions can be prevented by adding a ComponentLayouter right after appending the TreeReductionStage, i.e., adding line tl.appendStage(new ComponentLayouter()).

Inheritance Hierarchy

System..::..Object
  yWorks.yFiles.Layout..::..AbstractLayoutStage
    yWorks.yFiles.Layout.Tree..::..TreeReductionStage

See Also