I have a set of nodes that are linked sequentially. There are likely to be a large number of nodes, so to maximize the information displayed in the view I’d like to arrange the nodes so that they ‘snake’ across the view.
The standard DiGraphLayout puts a list of items into the following orientation:
A–>B–>C–>D–>E–>F
I’d like it to go
A–>B–>C
|
F<–E<–D
and so on.
a. Can I get the source for DigraphLayout?
b. What’s is the best way of modifying DiGraph Layout to implement my ‘Snake Layout’
Thanks.
Mike
Hmmm, I can’t think of any easy of getting that sort of shape to happen. I suppose you could just let it do the standard layout, and then do the “folding” programmatically yourself. But that could be complicated because of the varying widths that the subtrees would have.
An alternative more in the LayeredDigraph spirit would be to customize AssignLayers to first do the standard assignment, and then modify the layers for the nodes beyond a certain layer, so that all GoLayoutLayeredDigraphNodeData.Layer values are the way you want them.
But it’s a suggestion for a future enhancement.
Regarding source code, send mail to JGo.
Thanks.
In terms of extending LayeredDigraph and overriding AssignLayers - how much work do you think I would have to do here.
I’ve played about with the demos and it is possible to get LayeredDigraph to do the job - but you have to ‘fudge’ links ( in particular their directionality). LD also seems to have limited awareness of the visible width (or height) - it might be possible to add view size awareness, and also make LD less dependent upon link directionality, then LD could potentially do the job.
Is there potential for changing these smaller aspects, if re-writing AssignLayers turns out to be a big job?
That’s right–the layout algorithms work on document objects, so they do not know about the possibly multiple variously sized views on the document.
You would just need to figure out how many layers would fit in the main view, and then assign the layers appropriately. I don’t think any of us have done this kind of thing before, so it might not work quite the way you want it, but I believe it should be close.
For example, when the chain is long enough to require multiple back-and-forths, I’m not sure what will happen–it may depend on the order in which things in the network were constructed.