Skip to content
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

Rewrite merge_classes to traverse through the graph. #72

Open
herbiebradley opened this issue May 19, 2021 · 0 comments
Open

Rewrite merge_classes to traverse through the graph. #72

herbiebradley opened this issue May 19, 2021 · 0 comments

Comments

@herbiebradley
Copy link
Member

Nice - I agree with your analysis, thank you for clarifying!

Regarding the proposed solution:
Yes I think that works! (:
How intensive is the merge operation? Does the sequential merging take much time? If so, we might be able to optimize it by leveraging the graph structure (forgive the pseudo code):

(1) Creating a set of all nodes with this class label (I'll call it _node_set, _ indicating that it's temporary )
(2) While _node_set is non-empty:
(2.0) Pop the first node in current_node = _node_set.pop()
(2.1) From current_node, do a graph traversal (e.g. bfs) along the nearest neighbors to find all nodes that can be reached from current_node by going through nodes with the same class label. Add those nodes to a list called nodes_to_merge. This will be one cluster of nodes that will be merged into a larger one.
(2.2) Merge all nodes in nodes_to_merge, with the final index of current_node
(2.2) Remove nodes_to_merge from _node_set

This way we'd be doing one "merge" per cluster of nodes (one in the above example), rather than one per neighbors (3 in the above example)

Originally posted by @Croydon-Brixton in #70 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant