I’m using GoWeb, and what i’m trying to do is build a flowchart so after a decision i have n branches of n nodes. I can add as many branches as i want as long as they each have 1 node in them and everything works fine. I can add 2+ nodes to the first branch(sequential flow not “either/or”) and the graph gets laid out fine.
I can’t see how the ordering of links matters.
What layout are you using, with what parameters?
Can you upload some screenshots? (use the post reply button at top of page to include images)
As far as i know i’m using the default layout. I started off by using the ChartViewer class from the Flowgrammer demo.
Sorry for the delay… just getting back from the holidays.
I think I understand now… as you add nodes, the two branches under the Get Language flip back and forth?
Only if one is “taller” than the other. If i keep adding single nodes or stacks of the same size they add in the “correct” left to right order.
Do you see similar behavior in Flowgrammer?
unfortunatly no, i havent made any changes to the layout code except to remove it from a transaction (i’m not using undo/redo) and some formatting(added whitespace). I just went through it and the layout code matches yours exactly. i removed the label code from MakeLink, other than that its the same.
I’ve gone through and set labels on the links to verifty the links are what i think they are. the First item gets the first link and the next item added is the last link(looking at the end nodes top port sourcelinks property). Does the order of the links in the source or destination links arrays have anything to do with the layout procedure? If not what does it look at, since i dont specify any positions?
Sorry for the delay, the new year has been busy for us.
First, layered-digraph layout explicitly does not guarantee the ordering of any nodes within a layer.
In fact, it’s supposed to re-order in order to reduce crossings.
And yes, the order of the links going into the algorithm can change the results.
I think I can provide some more help here, but I need to go do some research.
I dont know if it helps, but i do not have any crossings in my document. i have a single bottom port linking to 2 top ports that arrange left to right. I’ve also manage to put labels on the links indicating which is First and Last using the supplied properties, and its moving my Last links to the left of my First links (which i would assume would be the opposite order) I’ve checked both the links coming into the branches and the ones leading to the common End node. and they are all set correctly.
OK, the reason this works in flowgrammer without re-ordering columns of nodes as you add things is this: the “if” node in flowgrammer explicitly has links exiting on the left and right. You’ve changed that so the “Get Language” branches all come out the bottom, effectively telling the Layout that “all these columns are interchangeable”. Does your “Get Language” operation have more than 2 or 3 possible exit paths?
the graph on the left gets laid out how I set it up. The (same) one on the right re-orders columns (all true as long as there are no cross-overs, I believe).
and you probably want to specify
layout.LayeringOption = GoLayoutLayeredDigraphLayering.LongestPathSource
this will put the nodes at the top of the columns instead of the bottom (on paths with fewer nodes).
No, i use the same node for all of my "if"s, and to simpify the logic of trying to balance the nodes out of the left and right node(since there is no real difference to me) i made them all come out of the bottom and let layout branch them. All of my linking logic is based on every link coming from the BottomPort and going into the TopPort on the next node.
Basically i need to add a new port for each branch i want in order left to right and everything will stay in the order the ports were added, correct?
Sweet, now that I understand whats going on, i can fix it or at least explain whats happening to the boss and go from there.