Search this API

y.layout.router
Class BusRepresentations

java.lang.Object
  extended by y.layout.router.BusRepresentations

public class BusRepresentations
extends java.lang.Object

This class provides helper methods to convert between buses given by complete subgraphs and buses represented by specific hub nodes.

In a representation by means of hubs, each connected subgraph induced by hubs establishes a bus. All regular nodes (non-hubs) which are connected to hubs of the same component are end-nodes of the same bus. In other words, nodes which are reachable on paths consisting of only hubs belong to the same bus. Of course, a node can be an end-node of more than one bus.

Since a bus models a group of nodes in which every node is connected to every other node, it can be represented as a complete subgraph of these nodes. To distinguish buses in this representation, each edge must be associated with a unique ID which identifies the bus to which it is associated. This is the representation expected by BusRouter.

 
Your browser does not support SVG content.

Field Summary
static java.lang.Object SOURCE_ID_DPKEY
          A DataAcceptor key to transfer a user-defined object from each original edge to the respective newly created edge Since there is no one-to-one mapping between original and new edges, the data provider of this key is responsible for the edges whose source endpoint is a regular node.
static java.lang.Object TARGET_ID_DPKEY
          A DataAcceptor key to transfer a user-defined object from each original edge to the respective newly created edge Since there is no one-to-one mapping between original and new edges, the data provider of this key is responsible for the edges whose target endpoint is a regular node.
 
Method Summary
static EdgeList replaceHubsBySubgraph(LayoutGraph graph, DataProvider hubMarker, DataAcceptor descriptorAcceptor)
          Changes the representation of buses from hubs to complete subgraphs.
static EdgeList replaceHubsBySubgraph(LayoutGraph graph, EdgeList[] hubEdgesLists, DataProvider hubMarker, DataProvider fixedMarker, DataAcceptor descriptorAcceptor)
          Changes the representation of buses from hubs to complete subgraphs by creating new edges between regular nodes and removing the hubs.
static void replaceSubgraphByHubs(LayoutGraph graph, EdgeCursor edgeCursor, DataProvider descriptorProvider, DataAcceptor busIDAcceptor)
          Changes the representation of buses from complete subgraphs to hubs by replacing intersection points by hubs.
static EdgeList[] toEdgeLists(Graph graph, DataProvider hubMarker)
          Calculates for every bus represented by hubs a list of all of its edges.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOURCE_ID_DPKEY

public static final java.lang.Object SOURCE_ID_DPKEY
A DataAcceptor key to transfer a user-defined object from each original edge to the respective newly created edge

Since there is no one-to-one mapping between original and new edges, the data provider of this key is responsible for the edges whose source endpoint is a regular node.


TARGET_ID_DPKEY

public static final java.lang.Object TARGET_ID_DPKEY
A DataAcceptor key to transfer a user-defined object from each original edge to the respective newly created edge

Since there is no one-to-one mapping between original and new edges, the data provider of this key is responsible for the edges whose target endpoint is a regular node.

Method Detail

toEdgeLists

public static EdgeList[] toEdgeLists(Graph graph,
                                     DataProvider hubMarker)
Calculates for every bus represented by hubs a list of all of its edges.

 
This method cannot return isolated hubs.
Parameters:
graph - the graph where buses are represented by means of hubs
hubMarker - a DataProvider which marks hub nodes
Returns:
an array of EdgeLists where each list contains all edges of a bus

replaceHubsBySubgraph

public static EdgeList replaceHubsBySubgraph(LayoutGraph graph,
                                             DataProvider hubMarker,
                                             DataAcceptor descriptorAcceptor)
Changes the representation of buses from hubs to complete subgraphs. This method delegates to replaceHubsBySubgraph(LayoutGraph, EdgeList[], DataProvider, DataProvider, DataAcceptor).

Parameters:
graph - the graph of the bus
hubMarker - a DataProvider that marks hub nodes
descriptorAcceptor - a DataAcceptor for storing the created bus descriptors
Returns:
a list of the created edges
See Also:
replaceHubsBySubgraph(LayoutGraph, EdgeList[], DataProvider, DataProvider, DataAcceptor), toEdgeLists(Graph, DataProvider)

replaceHubsBySubgraph

public static EdgeList replaceHubsBySubgraph(LayoutGraph graph,
                                             EdgeList[] hubEdgesLists,
                                             DataProvider hubMarker,
                                             DataProvider fixedMarker,
                                             DataAcceptor descriptorAcceptor)
Changes the representation of buses from hubs to complete subgraphs by creating new edges between regular nodes and removing the hubs.

This method respects multiple connections of nodes and creates appropriate BusDescriptors consisting of the bus ID as well as source and target group IDs.

The path of each new edge follows the route defined by the component of the hubs. If the subgraph of hubs is not a tree, these paths are ambiguous. In this case, an arbitrary tree is computed from the hub's subgraph which defines all the paths.

Parameters:
graph - the graph of the bus
hubEdgesLists - an array of EdgeLists each containing the edges of a bus
hubMarker - a DataProvider that marks hub nodes
fixedMarker - a DataProvider that marks fixed edges
descriptorAcceptor - a DataAcceptor for storing the created bus descriptors
Returns:
a list of the created edges

replaceSubgraphByHubs

public static void replaceSubgraphByHubs(LayoutGraph graph,
                                         EdgeCursor edgeCursor,
                                         DataProvider descriptorProvider,
                                         DataAcceptor busIDAcceptor)
Changes the representation of buses from complete subgraphs to hubs by replacing intersection points by hubs.

The edges of the given graph must form an orthogonal, cycle-free bus, otherwise an IllegalStateException is thrown.

Parameters:
graph - the graph where each bus is represented by a complete subgraph of the corresponding nodes
edgeCursor - an EdgeCursor of the regular edges
descriptorProvider - a DataProvider that provides a BusDescriptor for each edge
busIDAcceptor - an optional DataAcceptor that stores the bus ID for each new edge
Throws:
java.lang.IllegalStateException - if the path of an edge is not orthogonal or if some paths form a cycle

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.