I am using a LayeredDigraphLayout using Direction=“0” and LayeringOption=“OptimalLinkLength”. This works pretty good except for nodes that are not linked are placed on the right. I would like to have nodes that are not linked to be placed on the left.

I believe this is the result of the layer they are assigned. I am attempting to make a custom layout class that extends the LayeredDigraphLayout and override the AssignLayers method. However, I do not see how to assign the node to a layer. This is what I have so far…

protected override void AssignLayers()
            foreach (var node in Diagram.Nodes)
                IList list = node.LinksConnected as IList;
                if (list.Count == 0)
                    // What goes here???                   
OR Is there a better way to accomplish this? Thanks!

Overriding AssignLayers is the most general thing to do.

You might first want to try setting LayeredDigraphLayout.LayeringOption = “LongestPathSource” and see if the results are what you want.

If that isn’t what you want, then yes, override AssignLayers.
I think you want to set vertex.Layer = this.MaxLayer, for those unlinked vertexes, although I’m not positive about that.

Thanks Walter! Setting the vertex.Layer=MaxLayer did the trick.

Just for anybody else who might see this post, here is how to get the vertex for the node:

LayeredDigraphVertex vertex = Network.FindVertex(node);