-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix handling of index holes in PyDiGraph pickling (#116)
This commit fixes an issue with pickling (and by extension deepcopy) PyDiGraph or PyDAG objects that have holes in their node id lists. Previously the node ids would not be preserved across pickling leading to a compacted list instead of the original node ids. For example, if you had a PyDiGraph with node ids [0, 1, 3] after pickling/deepcopy the node ids would be [0, 1, 2] but otherwise identical. This commit fixes this issue by adding a check for holes to __setstate__ method and incrementing the node id to reproduce a 1:1 mapping with the original node ids prior to pickling.
- Loading branch information
Showing
4 changed files
with
62 additions
and
39 deletions.
There are no files selected for viewing
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
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
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
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