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

Automatic Graph Drawing for draw_d3 #277

Merged
merged 9 commits into from
Nov 19, 2024
Merged

Conversation

mehatamm
Copy link
Contributor

I added a toggle for the draw_d3 function in drawing.py for graphs without qubit/row data provided, so instead of being drawn stacked they are drawn after the application of a force-based algorithm that produces reasonably symmetric and visually pleasing results. This uses the helper function auto_draw_vertex_locs. The algorithm used is the first found in this textbook chapter:
https://cs.brown.edu/people/rtamassi/gdhandbook/chapters/force-directed.pdf

@jvdwetering
Copy link
Collaborator

Thanks for the implementation. Can I suggest changing the parameter name to auto_layout instead of auto_draw which I find a bit more ambiguous. Can you also add to the docstring of that function explaining what this parameter does?

@mehatamm
Copy link
Contributor Author

Thanks for the implementation. Can I suggest changing the parameter name to auto_layout instead of auto_draw which I find a bit more ambiguous. Can you also add to the docstring of that function explaining what this parameter does?

I changed the parameter name to auto_layout and added a docstring to draw_d3. Let me know if there's anything else I should change!

@jvdwetering jvdwetering merged commit cd0f992 into zxcalc:master Nov 19, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants