-
Notifications
You must be signed in to change notification settings - Fork 0
Highlight all merged edges and unify information #242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…le edges and update tooltip constants
…ant state management
src/types/graphs/viewgraph.ts
Outdated
| if (device && !device.visible) { | ||
| const edges = this.getConnections(nodeId); | ||
| for (const e of edges) { | ||
| if (!visitedEdges.has(e)) { | ||
| queue.push(e); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (device && !device.visible) { | |
| const edges = this.getConnections(nodeId); | |
| for (const e of edges) { | |
| if (!visitedEdges.has(e)) { | |
| queue.push(e); | |
| } | |
| } | |
| } | |
| if (device && !device.visible) { | |
| continue; | |
| } | |
| const edges = this.getConnections(nodeId); | |
| for (const e of edges) { | |
| if (!visitedEdges.has(e)) { | |
| queue.push(e); | |
| } | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the original code, the line:
if (device && !device.visible) {
const edges = this.getConnections(nodeId);
for (const e of edges) {
if (!visitedEdges.has(e)) {
queue.push(e);
}
}
}
is intentionally written this way because non-visible devices are the ones that connect multiple edges into larger "multi-edges".
The algorithm should only traverse through non-visible devices to find all edges that are part of the same multi-edge group.
If you were to use continue when a device is not visible (i.e., if (device && !device.visible) continue;), you would skip expanding through those invisible nodes, and the algorithm would not correctly join all related edges.
If you want to skip visible devices (so you only traverse through invisible ones), the correct condition would be:
if (device && device.visible) {
continue;
}
This way, you only expand through invisible devices, which is necessary to correctly find all edges that are logically connected through hidden nodes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I forgot to invert the checks. I meant that we should use early continues here, to reduce the amount of indentation.
close #201