Graph Layout > Layout Algorithms > Random Layout > Brief Description of the Algorithm
 
Brief Description of the Algorithm
The Random Layout algorithm is not really a layout algorithm. It simply places the nodes at randomly computed positions inside a user-defined region. Nevertheless, the Random Layout algorithm may be useful when a random, initial placement is needed by another layout algorithm or in cases where an attractive, readable drawing is not important.
Code Sample
Below is a code sample using the IlvRandomLayout class:
// ...
IlvGrapher* grapher = new IlvGrapher(display);
// ... Fill in here the grapher with nodes and links in
IlvRandomLayout* layout = new IlvRandomLayout();
layout->attach(grapher);
 
// Perform the layout
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.2.1
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.