Open andriyDev opened 1 week ago
I just started looking into this and I think I'm almost done. Surprisingly it seems you only need to add the size to the Vertex
struct and modify the execute_phase_3
function a little bit to account for the different sizes. Expect a PR today-ish.
This is what I have at the moment. I think I can fix Beth & Summer (i.e. center nodes across ranks), but not sure about Rick not being in between Jerry & Beth.
I just noticed this paragraph in the readme:
Finally, the implementation for coordinate assignment follows the algorithm provided by Brandes and Koepf, which can be found in this paper.
I'll try to look into that, it sounds like there might be useful information in there.
This is what I have at the moment. I think I can fix Beth & Summer (i.e. center nodes across ranks), but not sure about Rick not being in between Jerry & Beth.
I'm not sure what your settings are like, but this looks to me like we're only pushing nodes left by the vertex spacing, but pushing the next node right by vertex spacing +width. That might be why Jerry is moving only a bit left and Morty isn't moving at all (I would say Morty should be moving a little bit left to make space for Summer so it is more centered).
Today, AFAIK the only way to control the distance between nodes is through vertex spacing. This is a fixed amount of spacing between each node. Unfortunately this doesn't allow nodes to account for their size.
For example, I want each node to hold a string which can sometimes be fairly long. This means I either need to allow nodes to overlap which looks really bad, or I need to use a comically large vertex spacing, which makes parts of the graph that are small harder to read.
Ideally the crate would allow me to give it the size of each node and it would use that to decide where to put the nodes so they don't overlap.