public class BusRepresentations extends Object
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
.
Modifier and Type | Field and Description |
---|---|
static EdgeDpKey<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 EdgeDpKey<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. |
Modifier and Type | Method and Description |
---|---|
static EdgeList |
replaceHubsBySubgraph(LayoutGraph graph,
EdgeList[] hubEdgesLists,
IDataProvider hubMarker,
IDataProvider fixedMarker,
IDataAcceptor descriptorAcceptor)
Changes the representation of buses from hubs to complete subgraphs by creating new edges between regular nodes and
removing the hubs.
|
static EdgeList |
replaceHubsBySubgraph(LayoutGraph graph,
IDataProvider hubMarker,
IDataAcceptor descriptorAcceptor)
Changes the representation of buses from hubs to complete subgraphs.
|
static void |
replaceSubgraphByHubs(LayoutGraph graph,
IEdgeCursor edgeCursor,
IDataProvider descriptorProvider,
IDataAcceptor busIDAcceptor)
Changes the representation of buses from complete subgraphs to hubs by replacing intersection points by hubs.
|
static EdgeList[] |
toEdgeLists(Graph graph,
IDataProvider hubMarker)
Calculates for every bus represented by hubs a list of all of its edges.
|
public static final EdgeDpKey<Object> SOURCE_ID_DPKEY
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.
public static final EdgeDpKey<Object> TARGET_ID_DPKEY
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.
public static final EdgeList replaceHubsBySubgraph(LayoutGraph graph, EdgeList[] hubEdgesLists, IDataProvider hubMarker, IDataProvider fixedMarker, IDataAcceptor descriptorAcceptor)
This method respects multiple connections of nodes and creates appropriate
BusDescriptor
s 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.
graph
- the graph of the bushubEdgesLists
- an array of EdgeList
s each containing the edges of a bushubMarker
- a IDataProvider
that marks hub nodesfixedMarker
- a IDataProvider
that marks fixed edgesdescriptorAcceptor
- a IDataAcceptor
for storing the created bus descriptorspublic static final EdgeList replaceHubsBySubgraph(LayoutGraph graph, IDataProvider hubMarker, IDataAcceptor descriptorAcceptor)
This method delegates to
replaceHubsBySubgraph(LayoutGraph, EdgeList[], IDataProvider, IDataProvider, IDataAcceptor)
.
graph
- the graph of the bushubMarker
- a IDataProvider
that marks hub nodesdescriptorAcceptor
- a IDataAcceptor
for storing the created bus descriptorsreplaceHubsBySubgraph(LayoutGraph, EdgeList[], IDataProvider, IDataProvider, IDataAcceptor)
,
toEdgeLists(Graph, IDataProvider)
public static final void replaceSubgraphByHubs(LayoutGraph graph, IEdgeCursor edgeCursor, IDataProvider descriptorProvider, IDataAcceptor busIDAcceptor)
The edges of the given graph must form an orthogonal, cycle-free bus, otherwise an IllegalStateException
is
thrown.
IllegalStateException
- if the path of an edge is not orthogonal or if some paths form a cyclegraph
- the graph where each bus is represented by a complete subgraph of the corresponding nodesedgeCursor
- an IEdgeCursor
of the regular edgesdescriptorProvider
- a IDataProvider
that provides a BusDescriptor
for each edgebusIDAcceptor
- an optional IDataAcceptor
that stores the bus ID for each new edgepublic static final EdgeList[] toEdgeLists(Graph graph, IDataProvider hubMarker)
graph
- the graph where buses are represented by means of hubshubMarker
- a IDataProvider
which marks hub nodesEdgeList
s where each list contains all edges of a bus