Graph Layout > Layout Algorithms > Bus Layout > Brief Description of the Algorithm
 
Brief Description of the Algorithm
Bus topology is well-known in network management and telecommunications fields. The Bus Layout class can display these topologies nicely. It represents the “bus” as a “serpent” polyline. The width of the “serpent” is user-defined (via the width of the layout region parameter) and the height is computed so that enough space is available for all the nodes.
Code Sample
Below is a code sample using the IlvBusLayout class:
// ...
IlvGrapher* grapher = new IlvGrapher(display);
// ... Fill in the grapher with nodes and links here
// Create the bus node; the number of points and
// the coordinates are not important
IlvPoint point(10,10);
IlvPolyline* bus = new IlvPolyline(display, 1, &point);
grapher->addNode(bus);
// ... Fill in the grapher with links between each node
// and the bus here
IlvBusLayout* layout = new IlvBusLayout();
layout->attach(grapher);
// Specify the bus node
layout->setBus(bus);
IlvGraphLayoutReport* layoutReport = layout->performLayout();
if (layoutReport->getCode() != IlvLayoutReportLayoutDone)
IlvWarning("Layout not done. Error code = %d\n", layoutReport->getCode());
// ...
// If the grapher is not anymore subject of layout:
layout->detach();
 
// Once the layout algorithm is not anymore needed:
delete layout;
 

Version 6.1
Copyright © 2016, Rogue Wave Software, Inc. All Rights Reserved.