-
Notifications
You must be signed in to change notification settings - Fork 167
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
Add random_layout function and Pos2DMapping #305
Merged
Merged
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1375aa2
Add random_layout function and Pos2DMapping
mtreinish 5dc9269
Add release note
mtreinish 79480d4
Update doc organization
mtreinish 93ce79c
Merge branch 'master' into random_layout
mtreinish 538ef9e
Apply suggestions from code review
mtreinish fe49a38
Update releasenotes/notes/add-random-layout-c1c2751be971e5d0.yaml
mtreinish be5e8eb
Update releasenotes/notes/add-random-layout-c1c2751be971e5d0.yaml
mtreinish 82fe3f1
Use [f64; 2] for center type
mtreinish e3dd734
Merge branch 'main' into random_layout
mtreinish File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
16 changes: 16 additions & 0 deletions
16
releasenotes/notes/add-random-layout-c1c2751be971e5d0.yaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
features: | ||
- | | ||
Added a new layou function, :func:`retworkx.random_layout` (and it's | ||
mtreinish marked this conversation as resolved.
Show resolved
Hide resolved
|
||
equivalent per type variants :func:`retworkx.graph_random_layout` and | ||
:func:`retworkx.diraph_random_layout`) to generate a random layout which | ||
can be used for visualizations. | ||
- | | ||
Add a new custom return class, :class:`retworkx.Pos2DMapping`, has been | ||
mtreinish marked this conversation as resolved.
Show resolved
Hide resolved
|
||
added. This function will be returned by layout functions and is a drop | ||
in replacement for an immutable read-only dictionary of the form:: | ||
|
||
{1: [0.1, 0.5]} | ||
|
||
where the keys are node indices and the values are a 2 element sequence | ||
that represents the position for the node. |
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
Oops, something went wrong.
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 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.
with
retworkx.*_layout(graph).keys()
a user will seePos2DMappingKeys
. similar with.values()
. Should we have docs for these types?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.
I'm not sure if it matters too much, we can add it to the documentation it doesn't hurt. I just left it out since there really isn't any documentation for those types and we don't actually export them in the retworkx module. I basically modeled these types on how python's dict works it 'returns a
dict_keys
,dict_values
, anddict_items
class for.keys()
,.values()
, and.items()
. I couldn't find any documentation on those classes except in the C-API: https://docs.python.org/3/c-api/dict.html?highlight=dict_keys#c.PyDict_Keys