Packagecom.yworks.yfiles.util
Classpublic class GraphHider
InheritanceGraphHider Inheritance YObject Inheritance Object

Provides functionality to hide and unhide nodes and edges of a graph temporarily for algorithmic operations.

This class can be used to temporarily hide away certain elements of a graph and to unhide that parts at a later time again. Instances of this class keep track of graph elements that were hidden from a graph in order to make them visible again at a later time.

Note that this class should not be used to hide elements from a Graph2D for pure hiding purposes. Since this class will by default prevent the graph instance from firing events, other code might cease to work correctly. Use this class for short term removal of nodes and edges, only.



Public Properties
 PropertyDefined By
  fireGraphEvents : Boolean
Getter: Returns whether or not this hider should fire graph events.
GraphHider
  graph : Graph
[read-only] Returns the Graph for which this GraphHider was created.
GraphHider
Protected Properties
 PropertyDefined By
  _hiddenEdges : EdgeList
holds the list of the hidden edges in stack order
GraphHider
  _hiddenNodes : NodeList
holds the list of the hidden nodes in stack order
GraphHider
Public Methods
 MethodDefined By
  
GraphHider(g:Graph, init:Boolean = true)
Instantiates a new GraphHider for the given graph.
GraphHider
 Inherited
equals(o:Object):Boolean
YObject
  
getClass():Class
[override]
GraphHider
 Inherited
hashCode():int
YObject
  
The edges that are currently hidden
GraphHider
  
The nodes that are currently hidden
GraphHider
  
hideAll():void
Hides all nodes and edges from this graph.
GraphHider
  
Hides all edges from this graph.
GraphHider
  
hideEdge(e:Edge):void
Hides the given edge from the graph.
GraphHider
  
Hides the given list of edges from the graph.
GraphHider
  
Hides the given edges from the graph.
GraphHider
  
hideGraphItems(cursor:YCursor):void
Hides the given elements from the graph.
GraphHider
  
Hides multiple edges from the graph.
GraphHider
  
hideNode(v:Node):void
Hides the given node and all it's adjacent edges from the graph.
GraphHider
  
Hides the given list of nodes from the graph.
GraphHider
  
Hides the given nodes from the graph.
GraphHider
  
Hides all self-loop edges from this graph.
GraphHider
  
hideSubgraph(graph:Graph, ec:EdgeCursor):void
[static] Hides the subgraph induced by the given edges from the given graph.
GraphHider
  
[static] Instantiates a new GraphHider for the given graph.
GraphHider
  
Hides all self-loops and multiple edges from the graph.
GraphHider
  
unhideAll():void
Unhides all formerly hidden elements in the graph.
GraphHider
  
Unhides all formerly hidden edges in the graph.
GraphHider
  
Unhides all formerly hidden nodes in the graph.
GraphHider
  
Unhides the given edge.
GraphHider
  
unhideEdges(edges:EdgeList):void
Unhides the given edges.
GraphHider
  
unhideNode(v:Node, unhideAdjacentEdges:Boolean):void
Unhides the given node and if requested its adjacent edges.
GraphHider
  
unhideNodes(nodes:NodeList, unhideAdjacentEdges:Boolean):void
Unhides the given nodes and if requested its adjacent edges.
GraphHider
  
[static] Unhides the subgraph induced by the given edges in the given graph.
GraphHider
Protected Methods
 MethodDefined By
  
Initializes this object.
GraphHider
  
This method will be called whenever the hider is requested to unhide the given edge from the graph.
GraphHider
  
This method will be called whenever the hider is requested to unhide the given node from the graph.
GraphHider
Property Detail
_hiddenEdgesproperty
protected var _hiddenEdges:EdgeList

holds the list of the hidden edges in stack order

_hiddenNodesproperty 
protected var _hiddenNodes:NodeList

holds the list of the hidden nodes in stack order

fireGraphEventsproperty 
fireGraphEvents:Boolean

Getter: Returns whether or not this hider should fire graph events.

Setter: Specifies whether or not this hider should fire graph events when adding or removing items from the graph. By default the hider does not fire graph events.


Implementation
    public function get fireGraphEvents():Boolean
    public function set fireGraphEvents(value:Boolean):void
graphproperty 
graph:Graph  [read-only]

Returns the Graph for which this GraphHider was created.


Implementation
    public function get graph():Graph
Constructor Detail
GraphHider()Constructor
public function GraphHider(g:Graph, init:Boolean = true)

Instantiates a new GraphHider for the given graph. All non-static hiding and unhiding methods will refer to the given graph.

Parameters
g:Graph
 
init:Boolean (default = true) — An internally used switch to help handle proper instance initialization in inheritance chains where classes can have multiple constructor-like factory methods. This parameter can safely be ignored/omitted when calling the constructor.
Method Detail
getClass()method
override public function getClass():Class

Returns
Class
hiddenEdges()method 
public function hiddenEdges():EdgeCursor

The edges that are currently hidden

Returns
EdgeCursor — an EdgeList containing the currently hidden edges
hiddenNodes()method 
public function hiddenNodes():NodeCursor

The nodes that are currently hidden

Returns
NodeCursor — a NodeList containing the currently hidden nodes
hideAll()method 
public function hideAll():void

Hides all nodes and edges from this graph. The hidden elements will be stored so that they can be unhidden again at a later time.

hideAllEdges()method 
public function hideAllEdges():void

Hides all edges from this graph. The hidden edges will be stored so that they can be unhidden again at a later time.

hideEdge()method 
public function hideEdge(e:Edge):void

Hides the given edge from the graph. The hidden edge will be stored so that they can be unhidden again at a later time.

Parameters

e:Edge

hideEdges()method 
public function hideEdges(el:EdgeList):void

Hides the given list of edges from the graph. The hidden edges will be stored so that they can be unhidden again at a later time.

Parameters

el:EdgeList

hideEdges2()method 
public function hideEdges2(ec:EdgeCursor):void

Hides the given edges from the graph. The hidden edges will be stored so that they can be unhidden again at a later time.

Parameters

ec:EdgeCursor

hideGraphItems()method 
public function hideGraphItems(cursor:YCursor):void

Hides the given elements from the graph. The hidden nodes and adjacent edges will be stored so that they can be unhidden again at a later time.

Parameters

cursor:YCursor

hideMultipleEdges()method 
public function hideMultipleEdges():void

Hides multiple edges from the graph. If there are multiple edges connecting two nodes then all but one (representative) of these edges will be hidden. The hidden edges will be stored so that they can be unhidden again at a later time.

hideNode()method 
public function hideNode(v:Node):void

Hides the given node and all it's adjacent edges from the graph. The hidden elements will be stored so that they can be unhidden again at a later time.

Parameters

v:Node

hideNodes()method 
public function hideNodes(nl:NodeList):void

Hides the given list of nodes from the graph. The hidden nodes and adjacent edges will be stored so that they can be unhidden again at a later time.

Parameters

nl:NodeList

hideNodes2()method 
public function hideNodes2(nc:NodeCursor):void

Hides the given nodes from the graph. The hidden nodes and adjacent edges will be stored so that they can be unhidden again at a later time.

Parameters

nc:NodeCursor

hideSelfLoops()method 
public function hideSelfLoops():void

Hides all self-loop edges from this graph. The hidden edges will be stored so that they can be unhidden again at a later time.

hideSubgraph()method 
public static function hideSubgraph(graph:Graph, ec:EdgeCursor):void

Hides the subgraph induced by the given edges from the given graph. The induced subgraph defined by the given edges consists of the given edges and all nodes that are solely connected to the rest of the graph by the given edges.

Parameters

graph:Graph
 
ec:EdgeCursor

initGraphHider()method 
protected final function initGraphHider(g:Graph):void

Initializes this object. See the documentation of the corresponding factory method newGraphHider() for details.

Parameters

g:Graph

See also

newGraphHider()method 
public static function newGraphHider(g:Graph):GraphHider

Instantiates a new GraphHider for the given graph. All non-static hiding and unhiding methods will refer to the given graph.

Parameters

g:Graph

Returns
GraphHider
simplifyGraph()method 
public function simplifyGraph():void

Hides all self-loops and multiple edges from the graph.

The overall effect of this method is that the minimum number of edges are hidden from the graph such that it contains no self-loops and no multiple edges anymore. The hidden edges will be stored so that they can be unhidden again at a later time.

unhideAll()method 
public function unhideAll():void

Unhides all formerly hidden elements in the graph.

unhideAllEdges()method 
public function unhideAllEdges():void

Unhides all formerly hidden edges in the graph.

Precondition Both source or target node of all such edges must be contained in the graph.

unhideAllNodes()method 
public function unhideAllNodes():void

Unhides all formerly hidden nodes in the graph. Note that this method does not unhide hidden edges.

unhideEdge()method 
public function unhideEdge(e:Edge):void

Unhides the given edge. Also updates this._hiddenEdges.

Complexity O(hiddenEdges.size())

Parameters

e:Edge — the edge that will be unhidden

See also

this._hiddenEdges
unhideEdgeCore()method 
protected function unhideEdgeCore(e:Edge):void

This method will be called whenever the hider is requested to unhide the given edge from the graph.

Parameters

e:Edge

unhideEdges()method 
public function unhideEdges(edges:EdgeList):void

Unhides the given edges. Also updates this._hiddenEdges.

Complexity O(hiddenEdges.size())

Parameters

edges:EdgeList — the edges that will be unhidden

See also

this._hiddenEdges
unhideNode()method 
public function unhideNode(v:Node, unhideAdjacentEdges:Boolean):void

Unhides the given node and if requested its adjacent edges. Also updates this._hiddenNodes and this._hiddenEdges.

Complexity O(hiddenNodes.size()+hiddenEdges.size())

Parameters

v:Node — the node that will be unhidden
 
unhideAdjacentEdges:Boolean — whether of not to unhide previously hidden edges connected at v whose other end point is not hidden, i.e. it is part of the graph.

See also

this._hiddenNodes
this._hiddenEdges
unhideNodeCore()method 
protected function unhideNodeCore(v:Node):void

This method will be called whenever the hider is requested to unhide the given node from the graph.

Parameters

v:Node

unhideNodes()method 
public function unhideNodes(nodes:NodeList, unhideAdjacentEdges:Boolean):void

Unhides the given nodes and if requested its adjacent edges. Also updates this._hiddenNodes and this._hiddenEdges.

Complexity O(hiddenNodes.size()+hiddenEdges.size())

Parameters

nodes:NodeList — the nodes that will be unhidden
 
unhideAdjacentEdges:Boolean — whether of not to unhide previously hidden edges connected at the given nodes whose other end point is not hidden, i.e. it is part of the graph.

See also

this._hiddenNodes
this._hiddenEdges
unhideSubgraph()method 
public static function unhideSubgraph(graph:Graph, ec:EdgeCursor):void

Unhides the subgraph induced by the given edges in the given graph. The induced subgraph defined by the given edges consists of the given edges and all nodes that are either source or target of at least one of the given edges.

Parts of the subgraph that are already contained in the given graph will not be unhidden and pose no problem to this method.

Parameters

graph:Graph
 
ec:EdgeCursor