Implemented conversion from networkx graph to latex graph.#3591
Implemented conversion from networkx graph to latex graph.#3591LucaCappelletti94 wants to merge 13 commits intonetworkx:mainfrom LucaCappelletti94:adigraph
Conversation
|
Wow --- This looks really nice. |
|
Any updates on this pull request? |
|
Thanks for the gentle nudge! |
|
Hello @LucaCappelletti94! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2020-06-30 15:51:51 UTC |
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
Also pep8 formatting
|
I removed the conflicts with the master branch and reformatted docstrings and switched names from vertices/vertex to nodes/node. Also format changes to match PEP8, and removed numpy requirements for the tests, as well as making the test class into a test function. I also made some cosmetic code changes. Questions/concerns/suggestions:
Thanks! |
|
Looks like the Appveyor tests were having trouble due to matching files with vs without ending linefeeds. It might have also been differences in how files end their lines: with \n or \n\r. But I can't tell for sure (and I don't have access to a windows machine for local testing). The current test I have constructed writes a file and then reads and compares each line of the written test file and an expected output file. This might be better done using a string rather than writing/reading to files. But it seems to work OK and alleviates the difficulties with trailing end-of-line issues. Any thoughts on better ways to test this? |
|
I can't get LaTeX to compile using the Do I need to install anything, or use a particular flavor of pdflatex/latex/etc to get this to work? |
|
@LucaCappelletti94 can you verify that the |
|
Hello @dschult and sorry for the late reply. I am checking it now. |
|
Hello @dschult, I was able to compile the expected.tex on overleaf: https://www.overleaf.com/read/mpyqdcyypfgx |
I guess it depends on the general expected user usage of the Networkx library. This class was meant to be a stand-alone conversion from a graph to Latex, in a way that it can be easily customized. I guess that a method such as the plot methods that are already present could be used, as no heavy lifting is executed in the constructor of the class.
Yes, there is no strict need for figures nor subfigures, but I always found myself in need for one.
I honestly do not remember exactly the meaning of that: I seem to remember that it was needed to properly centre the graph.
I don't think there are contro-indications to put the files into strings, they just felt more modular being separated this way.
Yes that definitely makes sense.
It will work for DiGraphs but not for MultiGraphs.
Sure, but I'd need some help to get started with these.
Thank you for your work and sorry for my late reply. This period has been filled to the brink of stuff to do. Have a nice day! |
|
Thanks very much for this. It looks like my version of adigraph is 1.5.1 and the latest is 1.7.1. That may be the cause of the xparse error complaining about extra commas. Does this make sense? Is there a version of adigraph that we should require for this to work? |
When I developed the python wrapper I was using 1.7.x, so I think we should use that one. I would expect for any updated version of the LaTex distribution to have the latest one (as even overleaf has it, and they update very rarely), considering running the following to update your package: sudo tlmgr update --self
sudo tlmgr update adigraphOn an unrelated note, I'm finalizing a python + rust backend graph library which has some features that might interest you if you'd like to have a chat after we finish up this pull request. |
|
This PR was closed since Feb apparently due to the original fork being deleted. |
|
Hello @dschult , I must have done that by mistake. Likely I thought it was a spurious fork. Do you need help putting it back together? |
|
No, it transferred to the new PR just fine. Looks like it'll need updating/rebasing to get the CI to pass. but I think that will be straightforward. Thanks! |
Implemented conversion from networkx graph to latex updating my old implementation of pyadigraph, converting arbitrary graphs into Adigraph pure tikz graphs.
Example:
