Some Nodes in Graph are shown intersecting links that they aren't actually connected to

In my graph, a node is sitting perfectly on a link, but it is not linked to either of the nodes that that link represents.

I’ve seen this a few times before in my main Vault, but here is a simplified version of it.

Expected:

The “force” simulation appropriately distances unrelated nodes from each other.

Actual:

Nodes that have no reason to be close to each other look as if they are connected.

Screenshot from Obsidian:

Screenshot from Foam/Markdown links (which uses d3js as well)

You can see that in the Foam version, the “zxcvb” and “wertwery” notes are off on their own tail, as they are only connected via “test2obs”.

In obsidian, they are overlapping the “opiuy”-“test-link…” link, making it look as if zxcvb is connected to both.

Sorry in advance, I should have used non-gibberish names.

I also notice that there are a couple nodes at the bottom (mnbvxc and new-page) that are not showing on the Foam version (likely due to some compatibility issue), but it shouldn’t be happening regardless.

1 Like

This is not a really a bug.
The force simulation algorithm pushes the nodes apart but does not have a direct influence on their position, nor it checks if a node falls in the line in between two other nodes.

If you want, you can open a feature request for better handling of these cases. We may look into some other algorithms (if they already implemented in d3js or similar), however this may be ultimately unvoidable on large graphs or computationally costly.

Foam might generate a better graph in some cases out of sheer luck of the initialization seed.

I believe this is indeed due to some luck that it’s initialized in a position that ends up being squished in that position.

What you can do is drag nodes around, and the simulation will continue to reorder them, which will solve your problem.

By a similar argument, you’d expect Foam’s graph to position “qwer” and “asdfgh” on its own arm, rather than stuck in between “new-obs”, “Test Link Update Obsidian” and “opiuy”, despite having no connections to them. I think what happens here is that they are forcing the length of the line to be a fixed length, whereas we allow it to extend due to the force simulation.

Thanks for the replies! I wasn’t aware that you could drag the nodes. It fixes it, but only temporarily. Anyway, its not a truly big deal really - just thought it might be something to look into. Evidently not. Feel free to close this