Repository navigation
Fix node attributes on lattice graphs - #8311
Merged
Merged
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are two minor fixes in this PR, a result of me taking a closer look at some of the lattice graphs for a maze-making application I'm thinking about.
hexagonal_lattice_graphhas awith_positionsboolean kwarg. It isTrueby default, so the positions of the nodes are computed and stored on a node attr named "pos". It turns out thatwith_positionsis being ignored inhexagonal_lattice_graph- it's a very easy fix though, just move the existing position calculation under anif with_positionscondition (this was already in place fortriangular_lattice_graphThe second is more subtle - both
hexagonal_lattice_graphandtriangular_lattice_graphusecontracted_nodesunder-the-hood to identify boundary nodes whenperiodic=True. By default,contracted_nodesstores information about the contraction on the nodes/edges in the resultant graph. In this particular case, the contractions are an implementation detail - the information about the contraction itself shouldn't be stored on the resulting lattice graph. This PR adds tests for this and uses the newstore_contraction_askwarg (see Add feature to make storing node contraction data optional #7902) to suppress this info on the final returned lattice graph.Finally, one stylistic change: I removed the explicit import of
contracted_nodesfromalgorithms.minorswithin the functions and simply call it from the top-levelnxnamespace instead!