Is there a way in the linkValidation function I can traverse the graph as if the link has already been added and then reject its creation if certain conditions aren’t met?
I’m using findNodesConnected and findNodesOutOf functions to discover if this newly created link causes any node to be unreachable. So I want to traverse the graph as if the link is already there.
Technically, I guess I can listen to model changes and immediately remove the link after it’s been added but I prefer to do it at the validation phase.
Think about it this way. In this picture I only care about the graph starting from S. So C and D are kinda like an island I don’t care for now. But as soon as the red link is added, suddenly C and D are unreachable because the link is in the opposite direction and now I have a graph with unreachable nodes.
Does that make sense? It’s not a tree. It’s a DAG.
Just a suggestion but it would be great for findNodesConnected and findNodesOutOf and other similar methods to accept a flag or something to consider this temp link or not. Like:
That would have been great if it had a consider: Link argument as well. With ignore it opts out of an existing link but I want to opt-in to consider a temp link.