Class LayoutNetwork

This provides an abstract view of a diagram as a network (graph) of vertexes and directed edges. The network contains vertexes and edges corresponding to Nodes and Links.

This class provides a framework for manipulating the state of nodes and links without modifying the structure of the diagram. Having a separate representation also permits adding or removing vertexes or edges from the network so that the graph that is laid out is not isomorphic to the diagram's graph.

For each kind of layout that uses a LayoutNetwork there is a subclass of LayoutVertex and a subclass of LayoutEdge:

Modifying a LayoutNetwork or a LayoutVertex or a LayoutEdge does not invalidate the Layout or raise any changed events.

Constructor Summary Details

Name Description
LayoutNetwork()

This constructs an empty network.More... It is commonplace to call addParts to build up the network to have the same structure as a Diagram's or Group's nodes and links.

Properties Summary Details

Name, Value Type Description
edges
{Set.}

Gets a collection of all of the LayoutEdges in this network.More... Do not modify this collection directly. Instead, call addEdge, deleteEdge, addLink, or deleteLink.

layout
{Y}

Gets the Layout that uses this network of LayoutVertexes and LayoutEdges.More... The default value is null. It is set automatically for you when this setting Layout.network.

vertexes
{Set.}

Gets a collection of all of the LayoutVertexes in this network.More... Do not modify this collection directly. Instead, call addVertex, deleteVertex, addNode, or deleteNode.

Method Summary Details

Name, Return Type Description
addEdge(edge)

Adds a LayoutEdge to the network.More... Although this method is provided for completeness, linkVertexes provides a more efficient manner of linking vertexes already in the network.

Parameters:
{E} edge
addNode(node)
{V}

This convenience method makes sure there is a LayoutVertex in this network corresponding to a Node.More...

Parameters:
{Node} node
Returns:
{V} a vertex in this network.
addParts(parts, toplevelonly, pred)

Creates a network of LayoutVertexes and LayoutEdges corresponding to the given Nodes and Links.More... This is usually more convenient than repeatedly calling addNode and addLink. This method ignores all instances of Parts that are not Nodes or Links. This will recurse through Groups that have no Group.layout.

Parameters:
{Iterable.} parts
A collection of Nodes or Links.
{boolean=} toplevelonly
whether to skip Parts in the given collection that are contained by Groups; default is false
{function(Part):boolean|null=} pred
optional predicate to apply to each Part -- if it returns false do not include Vertex or Edge in the network; default ignores link label nodes or links connecting with them
addVertex(vertex)

Adds a LayoutVertex to the network.More...

Parameters:
{V} vertex
createEdge()
{E}

Allocate a new instance of LayoutEdge.More... This is overridden in LayoutNetwork subclasses to create instances of subclasses of LayoutEdge. Please read the Introduction page on Extensions for how to override methods and how to call this base method.

Returns:
{E}
createVertex()
{V}

Allocate a new instance of LayoutVertex.More... This is overridden in LayoutNetwork subclasses to create instances of subclasses of LayoutVertex. Please read the Introduction page on Extensions for how to override methods and how to call this base method.

Returns:
{V}
deleteArtificialVertexes()

Deletes all vertexes and edges that have no Part associated with them.

deleteEdge(edge)

Removes a LayoutEdge from the network.More...

Parameters:
{E} edge
deleteNode(node)

This convenience method deletes any LayoutVertex corresponding to a Node.More...

Parameters:
{Node} node
deleteSelfEdges()

Deletes all LayoutEdges whose "to vertex" and "from vertex" are the same vertex.

deleteVertex(vertex)

Removes a LayoutVertex from the network.More... This function also deletes all edges to or from the vertex.

Parameters:
{V} vertex
findAllParts()
{Set.} 1.1

Retrieve all of the Nodes and Links from the LayoutVertexes and LayoutEdges that are in this network.

Returns:
{Set.} A collection of Parts.
findEdge(link)
{E}

Returns the LayoutEdge that was constructed for the Link.More...

Parameters:
{Link} link
Returns:
{E} an edge in this network, or null if no such edge exists.
findVertex(node)
{V}

Returns the LayoutVertex that was constructed for the Node.More...

Parameters:
{Node} node
Returns:
{V} a vertex in this network, or null if no such vertex exists.
linkVertexes(fromVertex, toVertex, link)
{E}

Links two vertexes already in the network and returns the created LayoutEdge.More...

Parameters:
{V} fromVertex
{V} toVertex
{Link} link
Returns:
{E} an edge in this network, or null if both vertexes don't exist.
reverseEdge(edge)

Reverses the direction of a LayoutEdge in the network.More...

Parameters:
{E} edge
splitIntoSubNetworks()
{List.}

Modify this network by splitting it up into separate subnetworks, each of which has all of its vertexes connected to each other, but not to any vertexes in any other subnetworks.More...

This method will first delete from this network all artificial vertexes and all edges that do not connect two different vertexes. Afterwards, this original network may be empty or may contain all of the singleton vertexes, each of which had no edges connecting it to any other vertexes.

Returns:
{List.} a collection of LayoutNetworks, sorted in order of decreasing vertex count.