Important
To understand this section better, read section 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® JViews grapher ( IlvGrapher) to manipulate and display graphs,
using the graph layout algorithms provided in Rogue Wave JViews Diagrammer 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 JViews Diagrammer 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:
int getNodesCount()
int getLinksCount()
int getLinksCount(Object node)
int getLinksFromCount(Object node)
int getLinksToCount(Object node)
int getLinkPointAt(Object link, int index)
int getSubgraphsCount()
int getInterGraphLinksCount()
The efficiency of the layout algorithm
depends directly on the efficiency of the implementation of the
adapter class and the underlying graph data structure.