The approach sounds interesting, but I would definitely not make that part
of the java interface for the graph layout. You should provide a very
"thin" api for doing the layout, possibly just a single signature of the
form:
public interface ILayoutAlgorithm {
public void doLayout(IGraph graph, ICoordinates coords) throws
LayoutException;
}
Where the coordinates are pre-allocated to the size of the graph. Or do
what swing does for performance reasons and make it return a new one only
if the param version is invalid or null.
Then if you want to construct what you describe, you could make a class
that implements ILayoutAlgorithm using a collection of nested layout
algorithms and weights.
But there are so many different kinds of layout algorithms that I would
not assume any more than the above interface.
Notice taht I made the graph an interface as well because there are
definitely very different implementations that will need to be supported
(sparse/dense).
-- Oscar
***The contents of this email message are confidential and proprietary***
On Fri, 25 Jan 2002, Manuel Simoni wrote:
> Oscar,
>
> > I am not a visad expert, but I recommend not coupling the graph (adjacency
> > matrix or adjacency list) data structure to the existing VisAD data
> > structures, until it comes time for the embedding in R^2 or R^3 (which is
> > the function performed by the layout algorithm). It will be easier for
> > people to import graph data into whatever you design if you keep the
> > topology encoding and the cartesian embedding conceptually orthogonal to
> > each other.
>
> Yes, that's exactly what I am after. I am especially interested in the
> combination of multiple layout algorithms in one graph, but I do not have
> experience with that yet.
>
> Possibly this could be achieved by defining a strength or weight for each
> layout-algorithm at runtime, so that a higher-weight algorithm overrides the
> lower ones.
>
> This approach is used in the cassowary constraint solver - it also uses the
> metaphor of suggestion: The user (or a layout mechanism ) can *suggest* new
> positions for nodes of the graph, but cannot assume that the changes make it
> thru (for example, if the new position of the node would conflict with a
> constraint or another layout mechanism.)
>
> Manuel
>
>
>