| Package | flare.vis.data |
| Class | public class TreeBuilder |
| Subclasses | SpanningTree |
This class can annotate graph edges as belonging to the spanning tree
(done if the annotateEdges property is true), and can
construct a Tree instance (done if the
buildTree property is true). Generated Tree
instances are stored in the tree property. Generated trees
contain the original nodes and edges in the input graph, and any
previous parent or child links for input nodes will be cleared and
overwritten.
This class is intended as a support class for creating spanning trees
for flare.vis.data.Data instances. To create annotated
spanning trees for other purposes, see the
flare.analytics.graph.SpanningTree class, which provides a
tree builder that can also be used a visualization operator.
| Property | Defined by | ||
|---|---|---|---|
| annotateEdges : Boolean Flag indicating if edges in the spanning tree should be annotated.
| TreeBuilder | ||
| buildTree : Boolean Flag indicating if a spanning tree instance should be created.
| TreeBuilder | ||
| edgeWeight : Function A function determining edge weights used in the spanning tree
calculation.
| TreeBuilder | ||
| links : int The link type to consider when constructing a spanning tree.
| TreeBuilder | ||
| policy : String The traveral policy used to generate the spanning tree.
| TreeBuilder | ||
| root : NodeSprite
The root node for the spanning tree.
| TreeBuilder | ||
| spanningField : String The property with which to annotate edges that make up the spanning
tree.
| TreeBuilder | ||
| tree : Tree
[read-only] The tree created by this operator.
| TreeBuilder | ||
| Method | Defined by | ||
|---|---|---|---|
|
TreeBuilder(policy:String = null, buildTree:Boolean = true, annotateEdges:Boolean = false, root:NodeSprite = null, edgeWeight:* = null)
Creates a new SpanningTree operator
| TreeBuilder | ||
|
Calculates the spanning tree.
| TreeBuilder | ||
| Constant | Defined by | ||
|---|---|---|---|
| BREADTH_FIRST : String = "breadth-first" [static] Policy for a spanning tree built using breadth-first search.
| TreeBuilder | ||
| DEPTH_FIRST : String = "depth-first" [static] Policy for a spanning tree built using depth-first search.
| TreeBuilder | ||
| MINIMUM_SPAN : String = "minimum-span" [static] Policy for building a minimum spanning tree.
| TreeBuilder | ||
| annotateEdges | property |
public var annotateEdges:Boolean Flag indicating if edges in the spanning tree should be annotated.
If so, the spanningField property will be set for
each edge in the graph.
| buildTree | property |
public var buildTree:BooleanFlag indicating if a spanning tree instance should be created.
| edgeWeight | property |
edgeWeight:Function [read-write]A function determining edge weights used in the spanning tree calculation. When setting this value, one can pass in either a Function, which should take an EdgeSprite as input and return a Number as output, or a String, in which case the string will be used as a property name from which to retrieve the edge weight value from an EdgeSprite instance. If the value is null (the default) all edges will be assumed to have weight 1.
NOTE: Edge weights must be greater than or equal to zero!
Implementation public function get edgeWeight():Function
public function set edgeWeight(value:Function):void
| links | property |
links:int [read-write] The link type to consider when constructing a spanning tree. Should
be one of NodeSprite.GRAPH_LINKS,
NodeSprite.IN_LINKS, or
NodeSprite.OUT_LINKS.
public function get links():int
public function set links(value:int):void
| policy | property |
policy:String [read-write]The traveral policy used to generate the spanning tree. Should be one of DEPTH_FIRST, BREADTH_FIRST, or MINIMUM_SPAN (default).
Implementation public function get policy():String
public function set policy(value:String):void
| root | property |
public var root:NodeSpriteThe root node for the spanning tree.
| spanningField | property |
spanningField:String [read-write]The property with which to annotate edges that make up the spanning tree. The default value is "props.spanning". This property is used to annotate edges as "true" (if in the spanning forest) or "false" (if not in the spanning forest).
Implementation public function get spanningField():String
public function set spanningField(value:String):void
| tree | property |
tree:Tree [read-only]The tree created by this operator.
Implementation public function get tree():Tree
| TreeBuilder | () | constructor |
public function TreeBuilder(policy:String = null, buildTree:Boolean = true, annotateEdges:Boolean = false, root:NodeSprite = null, edgeWeight:* = null)Creates a new SpanningTree operator
Parameterspolicy:String (default = null) — the spanning tree creation policy. The default is
SpanningTree.MINIMUM_SPAN
|
|
buildTree:Boolean (default = true) — if true, this operator will build a new
Tree instance containing the spanning tree
|
|
annotateEdges:Boolean (default = false) — if true, this operator will annotate the
edges of the original graph as belonging to the spanning tree
|
|
root:NodeSprite (default = null) — the root node from which to compute the spanning tree
|
|
edgeWeight:* (default = null) — the edge weight values. This can either be a
Function that returns weight values or a
String providing the name of a property to look up on
EdgeSprite instances.
|
| calculate | () | method |
public function calculate(data:Data, n:NodeSprite):voidCalculates the spanning tree.
Parametersdata:Data — the data set containing a graph
|
|
n:NodeSprite — the root of the spanning tree
|
| BREADTH_FIRST | constant |
public static const BREADTH_FIRST:String = "breadth-first"Policy for a spanning tree built using breadth-first search.
| DEPTH_FIRST | constant |
public static const DEPTH_FIRST:String = "depth-first"Policy for a spanning tree built using depth-first search.
| MINIMUM_SPAN | constant |
public static const MINIMUM_SPAN:String = "minimum-span"Policy for building a minimum spanning tree.