Created
July 20, 2017 20:04
-
-
Save Sumith1896/b7b1fe4ccb628d3e9196551987a2fc0f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(remove-child! | |
(lambda (parent child) | |
(if (enum-set-contains? | |
(apply enum-set-union | |
(map (curry vertex-parents graph) | |
(vertex-children graph child))) | |
parent) | |
(void) | |
(begin | |
(enum-set-remove! (vector-ref mb parent) child) | |
(enum-set-remove! (vector-ref mb child) parent))) | |
(for-enum-set ([other-parent (vertex-parents graph child)]) | |
(unless (equal? parent other-parent) | |
(define others-child (vertex-children graph other-parent)) | |
(define others-parent (vertex-parents graph other-parent)) | |
(define others-childs-parents ((apply enum-set-union | |
(map (curry vertex-parents graph) | |
(vertex-children graph other-parent))))) | |
(if (enum-set-contains? (enum-set-union others-parent others-child | |
others-childs-parents) parent) | |
(void) | |
(begin | |
(enum-set-remove! (vector-ref mb parent) other-parent) | |
(enum-set-remove! (vector-ref mb other-parent) parent))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment