Graph Layout > Using Advanced Features > Laying Out a Non-Views Grapher
 
Laying Out a Non-Views Grapher
Note: To understand this section better, read Using the Graph Model first.
It is sometimes necessary to add graph layout features to an existing application. If the application already uses the Rogue Wave Views grapher (IlvGrapher) to manipulate and display graphs, using the graph layout algorithms provided in Rogue Wave Views is a straightforward process. No adapter has to be written.
However, the case may arise where an application uses its own classes for nodes, links, and graphs, and where, for some reason, you do not want to replace these classes with Rogue Wave Views classes. To enable the graph layout algorithms to work with these graph objects, a custom adapter (that is, a subclass of IlvGraphModel) must be written.
The adapter must implement all the abstract methods of the IlvGraphModel class. The nonabstract methods of this class have a default implementation that is really functional. However, they may not be optimal because they do not take advantage of the characteristics of the underlying graph implementation. For better performance, the following nonabstract methods can be overridden in the adapter class:
IlUInt IlvGraphModel::getNodesCount()
IlUInt IlvGraphModel::getLinksCount()
IlUInt IlvGraphModel::getLinksCount(IlAny node)
IlUInt getLinksFromCount(IlAny node)
IlUInt getLinksToCount(IlAny node)
IlUInt getLinkPointAt(IlAny link, IlUInt index)
The efficiency of the layout algorithm depends directly on the efficiency of the implementation of the adapter class and the underlying graph data structure.

Version 6.2.1
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.