Packagecom.yworks.yfiles.layout.planar
Classpublic class PlanarityTest
InheritancePlanarityTest Inheritance YObject Inheritance Object

Implementation of a planarity test with linear time. This class can be used to test a graph for planarity ( isPlanar(), to create a planar embedding of a planar graph ( embed()) or to find a planar subgraph of a given graph and create an embedding for it ( embedPlanarSubgraph()).

See also

isPlanar()
embed()
embedPlanarSubgraph()


Public Properties
 PropertyDefined By
  nonEmbeddedEdges : EdgeList
[read-only] Returns a list of edges that were not added to the embedding in a run of embedPlanarSubgraph()
PlanarityTest
Public Methods
 MethodDefined By
  
PlanarityTest(init:Boolean = true)
Creates an instance of PlanarityAlgorithm.
PlanarityTest
  
embed(planar:PlanarInformation):Boolean
Creates an embedding of a given graph if it is planar.
PlanarityTest
  
Runs a planarity test and constructs a valid embedding of the graph.
PlanarityTest
 Inherited
equals(o:Object):Boolean
YObject
  
getClass():Class
[override]
PlanarityTest
 Inherited
hashCode():int
YObject
  
isPlanar(graph:Graph):Boolean
Determines if the a given graph is planar.
PlanarityTest
  
[static] Creates an instance of PlanarityAlgorithm.
PlanarityTest
Protected Methods
 MethodDefined By
  
Initializes this object.
PlanarityTest
Property Detail
nonEmbeddedEdgesproperty
nonEmbeddedEdges:EdgeList  [read-only]

Returns a list of edges that were not added to the embedding in a run of embedPlanarSubgraph()


Implementation
    public function get nonEmbeddedEdges():EdgeList

See also

Constructor Detail
PlanarityTest()Constructor
public function PlanarityTest(init:Boolean = true)

Creates an instance of PlanarityAlgorithm. The DFS-tree used for the algorithm is constructed using the given order of nodes and edges in the graph.

Parameters
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
embed()method
public function embed(planar:PlanarInformation):Boolean

Creates an embedding of a given graph if it is planar. The result will be saved in the instance of com.yworks.yfiles.layout.planar.PlanarInformation which is

Parameters

planar:PlanarInformation — The PlanarInformation containing the graph to embed.

Returns
Booleantrue, if the embedding process was successful.

See also

embedPlanarSubgraph()method 
public function embedPlanarSubgraph(planar:PlanarInformation):Boolean

Runs a planarity test and constructs a valid embedding of the graph. If the graph is non-planar, some edges are hidden in order to make it planar. A list of hidden edges can be accessed via nonEmbeddedEdges.

Parameters

planar:PlanarInformation — The Graph to test, saved in a PlanarInformation data structure.

Returns
Booleantrue, if the graph is planar.

See also

getClass()method 
override public function getClass():Class

Returns
Class
initPlanarityTest()method 
protected final function initPlanarityTest():void

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

See also

isPlanar()method 
public function isPlanar(graph:Graph):Boolean

Determines if the a given graph is planar. Runtime of this test is O(N) where N is the number of nodes.

Parameters

graph:Graph — The graph to test

Returns
Booleantrue, if the graph is planar
newPlanarityTest()method 
public static function newPlanarityTest():PlanarityTest

Creates an instance of PlanarityAlgorithm. The DFS-tree used for the algorithm is constructed using the given order of nodes and edges in the graph.

Returns
PlanarityTest