Hi ,
One of my colleagues contacted you because we have a problem with the following diagram. We would like for the black link to be vertical all the time. So you told us to take a look at the AssignLayers method, but I can't seem to understand how to use it.

You just need to make sure that the LayeredDigraphVertex.Layer property is set to the same value for nodes in the different streams, if you want them to get the same X coordinate location.

I have another problem. I am trying to code what you just told me but because I use a different layout for each Links group(Red and Blue above), I can’t access the vertex from other layouts.

For example, if I want to set the LayeredDigraphVertex.Layer property from the RED link group instance I can't access the vertex for the blue layout even though I do BlueLayout.Network.Vertexes. BlueLayout.Network is always nothing but RedLayout.Network is ok. It's like I can only get the vertex of the instance I am in.
For presentation purposes, I need to use multiple layouts.
Hope you can understand my question Confused

Presumably you have some context object that holds all of the streams.

Hopefully you can determine, on demand, how many layers each stream will need and the relative relationships between them so that you can compute the total number of layers.
(Perhaps the total is greater than the maximum number of layers used by any one stream.)

You can then customize your layout to refer to that object, so that your AssignLayers override can determine the proper layer “globally” for each vertex/node.

So there is no way to directly access the network.vertexes of another layout ?

Well, I suppose that could be arranged, but you would still have the problem that when a layout occurs, you would not know about the layering of all of the other nodes in the whole diagram. So that would require a subsequent pass to shift individual layouts to the left or right or to split them. I did suggest that a while ago. My impression was that that was too complicated or perhaps I just didn’t make myself clear. I certainly do not know the complexities of your application.

I would like to give it a try, so I would be thankful if you could explain me how to arrange it so I can access directly my network.vertexes from another layout.

Thank you

The main problem is that the LayeredDigraphLayout.Network is normally constructed and discarded with each layout performance. And even if you kept the network around when it finished laying out, obviously there would not be any such data structure for those layouts that had not yet executed.

So are you sure that you still want to do that?

Would it work if I wait until all layouts have finished laying out and then when the last one starts laying I do all my operations? If that works I would like to give it a try, if I can’t do that then I will try the Context Object you told me about before.

That wouldn’t address the cases where earlier layouts would need to be adjusted to account for the positioning (layering) that the later layouts determine.

I still believe that using a single layout for the whole diagram is the best and probably the only good solution.

Ok thank you very much for your help Walter

Hi Walter,

I am trying swap the direction of a group using the AssignLayers method. Like you can see in the following image, I want the arrow to point to the other side. Everything works fine except for the circled portion. When I swap the layers the 2 links on the cercled portion merge, I am already using Route Adjusting="Scale".
Thank you

Route.Adjusting is just used when recomputing the route. Is the layout actually positioning the nodes or are you explicitly moving them in code?

I’m concerned that reversing the order of the layers is insufficient – you also need to reverse the links. Otherwise the spots that are chosen for how links connect to nodes will be wrong. But you can get around that by turning off LayeredDigraphLayout.SetsPortSpots and set the port spots yourself. But this issue would not explain why the routing for the links results in congruent links.

The layout is positioning the nodes. I do only change the layer of the nodes vertex.
The LayeredDigraphLayout.SetsPortSpots property seems to
make it look better but it I still don't get the same look for both the red and blue group.
How can I modify the spots ? Can I make it look exactly like the red one?

OK, then you also need to set the FromSpot and ToSpot attached properties appropriately on those nodes where the links are going “backwards”, or you can set them directly on the Route (which is what the layouts do). Maybe go:Node.FromSpot=“MiddleLeft” and go:Node.ToSpot=“MiddleRight”.

Although that doesn’t explain why the vertical distance between the link middles is less than in the red case.

I tried the FromSpot and ToSpot property but it didn't work. The vertical distace is still less in the red case.
Is there another way to change the direction of this group besides using the assignlayers method? Because I am getting no where using assignlayers.
I need the nodes(orange squares) to be reversed also. So the first square should become the last and so on.
Thank you

You could try what I first suggested: reverse all of the links.

Or you could continue having the links going from left to right, but just exchange any arrowheads: set go:LinkPanel.FromArrow instead of go:LinkPanel.ToArrow.

I do not know your application requirements, so it’s hard for me to say.

Could you explain me how can I reverse the links ? What do I need to do ?

Just swap the “from” and “to” references in the link data (if you are using a GraphLinksModel).

It would have been easy to only change the ArrowHead and let the streams going from left to right, but in my model, I use the From and To to browse the streams. So I can’t use this approach.

If we use your other approach, which is to swap the from and to of each link. Here is what will happen.

So I don’t know if I really understand the concept of swapping the link, but at the end, cold streams will be on the same side as the hot streams.

Have I missed something?