Skip to content

Commit

Permalink
Create a Tikz latex drawing feature for networkx (#6238)
Browse files Browse the repository at this point in the history
* Implemented conversion from networkx graph to latex graph.

* Removed latex cache files uploaded by error.

* Resolved placeholders file import issue.

* Removed dependency to numpy

* Updated test

* Wrapped test for numpy dependency

* Updated test name

* format changes to nx_latex.py and friends.

vertex -> node,  vertices -> nodes
PEP8 spacing and tabs
pytest function instead of class (class not needed here -- no imports)
Moved author info to CONTRIBUTORS.rst as our new standard
converted list comprehension done for side-effects to for-loop.
switch to f-strings from string-format calls
update setup.py to remove conflicts

* Remove numpy requirement for testing latex

Also pep8 formatting

* reorder imports in __init__

* Attempt to debug windows/appveyor adigraph error

* try again

* Remove types, run pre-commit

* blackify

* pyupgradify

* inline latex placeholders and expected_tex.

Check not multigraph.
Add example
Change variable name `file` to `latex_code`
inline if/else for __init__ setup

* Change tabs to spaces

* pull apart Adigraph to simplify interface

* remove class Adigraph completely in favor of functions

* replace default layout to be circular.

(matches adigraph and avoids using random seeds in tests

* fix old version of isort result

* update documentation and include with rst file. Update some tests

* make docs more complete, checked and add tests

* Cleanup extra file changes that aren't needed

* Add TikZ version of to_latex as default

* improve docs

* Make the networkx latex interface via TikZ and not adigraph

* fix rebase

* Apply suggestions from code review

Co-authored-by: Mridul Seth <mail@mriduls.com>

* comment out print statements in tests

* Turn off multigraph for latex

* Remove tests of `line width` and edge label placement

* add back line width style, fix placement of style on edges.

* Set default layout to have radius 10

Co-authored-by: Mridul Seth <mail@mriduls.com>

* fix docstring test

* Minor docstring formatting nits.

Co-authored-by: Luca Cappelletti <cappelletti.luca94@gmail.com>
Co-authored-by: Mridul Seth <seth.mridul@gmail.com>
Co-authored-by: Mridul Seth <git@mriduls.com>
Co-authored-by: Mridul Seth <mail@mriduls.com>
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
  • Loading branch information
6 people committed Jan 4, 2023
1 parent 814b295 commit 59ed0cf
Show file tree
Hide file tree
Showing 5 changed files with 876 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/developer/about_us.rst
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ to add your name to the bottom of the list.
- Philip Boalch
- Matt Schwennesen, Github: `mjschwenne <https://github.com/mjschwenne>`_
- Andrew Knyazev, Github: `lobpcg <https://github.com/lobpcg>`_, LinkedIn: `andrew-knyazev <https://www.linkedin.com/in/andrew-knyazev>`_
- Luca Cappelletti, GitHub: `LucaCappelletti94 <https://github.com/LucaCappelletti94>`_
- Sultan Orazbayev, GitHub: `SultanOrazbayev <https://github.com/SultanOrazbayev>`_, LinkedIn: `Sultan Orazbayev <https://www.linkedin.com/in/sultan-orazbayev/>`_

A supplementary (but still incomplete) list of contributors is given by the
Expand Down
12 changes: 11 additions & 1 deletion doc/reference/drawing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,14 @@ Graph Layout
spectral_layout
spiral_layout
multipartite_layout



LaTeX Code
==========
.. automodule:: networkx.drawing.nx_latex
.. autosummary::
:toctree: generated/

to_latex_raw
to_latex
write_latex
1 change: 1 addition & 0 deletions networkx/drawing/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# graph drawing and interface to graphviz

from .layout import *
from .nx_latex import *
from .nx_pylab import *
from . import nx_agraph
from . import nx_pydot
Loading

0 comments on commit 59ed0cf

Please sign in to comment.