summaryrefslogtreecommitdiff
path: root/networkx/readwrite/graphml.py
Commit message (Collapse)AuthorAgeFilesLines
* Update developer requirements (#6429)Jarrod Millman2023-02-141-2/+2
| | | | | * Update developer requirements * Run linter
* DOC: Minor formatting fixups to get rid of doc build warnings. (#6363)Ross Barnowski2023-01-131-1/+1
| | | Minor formatting fixups to get rid of doc build warnings.
* Use isort with pre-commit to enforce import guidelines (#5659)Mridul Seth2022-06-021-1/+0
| | | | | * Add isort to pre-commit * Run isort on all python files (except __init__.py ones)
* Add Mypy type checking infrastructure (#5127)Ross Barnowski2021-11-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add minimal mypy configuration file. * Add mypy workflow to GH. * Properly import sentinels from traversal.edgedfs. * mypy doesn't like variables named \"e\". * Rm annotations from single function. * Fix name collisions in test suite. Make sure all tests have unique names. * Rm unused random seed in test setup. * Rm redundant __all__ specification. * Silence mypy error from sum(). Mypy bug? * Fix tsp test instantiation nit. * \"type: ignore\" to suppress conditional fn sigature errors. * Remaining \"type: ignore\" to appease mypy. * Configure mypy to ignore inheritance issues. * Update exclude conf for CI. - Add yaml - Reformat regex containing reportviews * Rm partial annotations from lukes.py. Fixes mypy errors due to unannotated code. * Reorg defaultdict to reduce type: ignore cruft. * Homogenize signatures for fns defined in conditionals. * err as varname only in exception catching. * Fix name collision in Bellman-Ford test suite.
* Change exception varname e to err (#5130)Dan Schult2021-10-151-4/+4
| | | | A more descriptive variable name for exceptions. This reduces local var naming conflicts when \`e\` is used e.g. to represent edges as a loop variable.
* More informative GraphML exceptions (#5058)Ross Barnowski2021-09-141-6/+17
| | | | | | | | | * Add tests that fail on uninformative exception. * Raise informative exception when non-supported type used. * Add importorskip to new tests. * Change naming scheme for backward compatibility.
* added security warning for graphml files (#5004)bt-nia2021-08-041-0/+6
| | | | | | | | | * added security warning for graphml files * Update networkx/readwrite/graphml.py Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* bugfix-for-issue-4353: modify default edge_id format (#4842)Berlin Cho2021-06-141-5/+56
| | | | Allow selection of an edge attribute to be the edge id when writing GraphML. Adds edge_id_from_attribute kwarg.
* Decode GraphML/yEd shape type (#4694)Attila Nagy2021-06-141-3/+10
| | | | Decode and preserve GraphML/yEd shape type and add tests for description and yworks GenericNode
* Deserializing custom default properties graph ml (#4872)Jeroen Bergmans2021-06-071-2/+9
| | | | * Add test case for handling default node attributes from graphML * Add decode conversion to key defaults analogous to decode_data_elements
* Update black (#4814)Jarrod Millman2021-05-181-1/+1
|
* Remove xml import checks (#4393)Jarrod Millman2020-11-261-2/+2
|
* Move a few imports inside functions to improve import speed of the library ↵Dan Schult2020-11-121-51/+64
| | | | | | | | | | | | | | | | | | | | | (#4296) * move scipy imports into functions * run black * Move xml and lxml import inside functions in graphml.py * Move imports inside functions * Add tests to graphml.py to appease the codecov CI * rearrange KDTree import handling * remove global np from alg_connectivity code * fix black * fix black
* Format w/ black==20.8b1Jarrod Millman2020-10-061-6/+3
|
* graphml: re-add graph attribute type 'long' after 857aa81 removed it (#4189)josch2020-09-051-0/+1
| | | closes: #4188
* DOC,BLD: Fix doc build warning from markup error. (#4174)Ross Barnowski2020-08-211-1/+1
|
* Format python in docstrings (#4168)Jarrod Millman2020-08-191-13/+13
| | | | | | | | | | | | | | | | | | | * Format code w/ black * Format docstrings w/ black * Manual cleanup * Tell pytest to ignore planned deprecations * Don't call plt.show during testing * Another known deprecation * DOC: rm duplicate line from docstring example * Minor cleanup Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* MultiGraph from graphml with explicit edge ids #3470 (#3763)kiryph2020-08-161-17/+33
| | | | | | | | | | | | | | | | | | | | * MultiGraph from graphml with explicit edge ids #3470 Prior this commit, a graph with explicit edge ids but no parallel edges stored in a graphml was converted to a Graph and the edge ids were moved to the edge data. This behaviour has been removed. * clean up multigraph handling in read_graphml and friends Added changes to parse_graphml too. multigraph returned when parallel edges exist in file or when new argument "force_multigraph" is True * test parse_graphml and edge_key_type better and cleanup * more tests Co-authored-by: Dan Schult <dschult@colgate.edu>
* Format w/ blackJarrod Millman2020-07-101-129/+197
|
* Ran pyupgrade --py36plusJarrod Millman2020-07-101-1/+1
|
* Correctly infer numpy float types (#3919)Alex Henrie2020-07-051-2/+3
|
* Fix exception causes and messages all over the codebase (#4015)Ram Rachum2020-07-051-2/+2
|
* Fix typo: np.int -> np.int_ (#4013)Neil2020-06-221-1/+1
| | | | np.int is just int--it is not a numpy type, and is deprecated. Numpy has changed to np.int_
* Add option for named key ids to GraphML writing. (#3960)ryan-duve2020-05-171-9/+25
| | | | | | | | | | | * Add option for named key ids to GraphML writing. * Remove 'is True' for PEP8 compliance. * Added tests to confirm the named key ids are written as expected. * Add test showing the read graph's nodes and edges are the same when written with both the default behavior and with the named id attributes. Co-authored-by: dnp <you@example.com>
* Update string formatJarrod Millman2020-01-011-2/+2
| | | | | | | | | find -name "*py" | xargs grep -n '" % ' find -name "*py" | xargs grep -n '"\.format(' find -name "*py" | xargs grep -n "' %" find -name "*py" | xargs grep -n 'msg % ' find -name "*py" | xargs grep -n ' %d ' find -name "*py" | xargs grep -n '\.format('
* Upgrade to Py36 syntaxJarrod Millman2020-01-011-4/+3
| | | | find networkx -name \*.py -exec pyupgrade --py36-plus {} \;
* Convert %-format to fstringJarrod Millman2020-01-011-19/+19
|
* Remove boiler plate from top of modulesJarrod Millman2019-11-111-9/+0
| | | | | | | | | The copyright and author stuff is not necessary, out-of-date, and inconsistent. It takes up visual space and is a pain to police everyone doing the same thing on the top of the module. Git handles authorship in a comprehensive and authoritative way. The LICENSE.txt file applies to all project code.
* Remove old Python 2 codeJarrod Millman2019-11-101-27/+2
|
* Fix PEP8 issuesJarrod Millman2019-10-211-15/+11
|
* Deprecate make_strJarrod Millman2019-10-211-23/+23
|
* Remove unused importsJarrod Millman2019-10-211-9/+2
|
* Skip doctests when missing dependenciesJarrod Millman2019-10-211-15/+0
|
* PEP8 fixesJarrod Millman2019-10-181-1/+1
|
* Use pytest for doctestJarrod Millman2019-10-121-7/+4
|
* Write mixed-type attributes correctly in write_graphml_lxml (#3536)Alex Henrie2019-08-131-18/+12
| | | Fixes #3167
* Update copyrightJarrod Millman2019-03-301-1/+1
|
* Expand read/write_Graphml numeric type to support numpy numeric types (#3041)Dan Schult2018-06-291-0/+17
| | | | | | | | | | * Expand graphml numeric types for numpy int/floats Fixes #1556 * fix typoes in tests for float * add write_graphml update to release doc
* Misc. typos (#2872)luzpaz2018-02-141-2/+2
| | | | | | | | | | Found via `codespell -q 3 -I ../networkx-whitelist.txt` where whitelist consisted of: ``` ans childs iff nd te ```
* Pep8 fixesJarrod Millman2018-01-201-1/+3
|
* Update copyrightJarrod Millman2018-01-201-1/+1
|
* Dictionary comprehensions from #1700 merged conflicts (#2768)Dan Schult2017-11-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * use dict comprehensions in kcomponents.py * use dict comprehensions in test_kcomponents * use dict comprehensions in test_kcutsets * use dict comprehensions in test_maxflow * use dict comprehensions in test_maxflow_large_graph * use dict comprehensions in flow/utils.py * use dict comprehensions in weighted.py * use dict comprehensions in graphml.py * use dict comprehensions in nx_pylab.py * use dict comprehensions in relabel.py * use dict comprehensions in assortavity/mixing.py * conform to pep8 guidelines in mixing.py * Minor tweaks to kcomponents to update to v2.0
* Fixed a problem when reading graphml files where nodes that were part of ↵Daniel Bradburn2017-10-011-7/+12
| | | | groups would only be parsed if they were connected to non-grouped nodes via edges (#2644)
* Update docsJarrod Millman2017-08-181-2/+3
|
* Graphml: consistent I/O for key and data attributes of edges in multi-graphs ↵Mohammad Hossein Sekhavat2017-07-311-20/+24
| | | | | | | | | | | | | | | | (#2559) * Graphml: read and write key and data attributes of edges in multi-graphs. Before this commit, key and attribute of multi edges were both stored as `data` xml elements of graphml. This caused difference in edges of multigraphs with key and data attributes after consequent write and reads of graphml. `test_preserve_multi_edge_data` was added to `test_graphml.py` to show this inconsistency. This commit changes graphml reader and writer behavior to: * read and write `key` of networkx edges only in `id` attribute of `<edge id="...">` elements of graphml. * read and write `data` of networkx edges only in `<data></data>` elements of graphml. Only in non-multigraphs, `id` attribute of `<edge id="...">` elements will be read into `data` of networkx edges, because we have no `key` for edges. * Fix pep8 errors for graphml
* Update graphml to care for a number of issues. (#2515)Dan Schult2017-07-191-176/+438
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Added graphmlxml class * Allow graphml to read Cytoscape files with incomplete headers Fixes #2197 * graphml pep8 changes * Add a test and some docstring for graphml json unicode treatment addresses #1880 * Change read_graphml and parse_graphml docstring Fixes #1398 * Update LXML writer to include attributes, work with py36 etc. Set LXML as default write_graphml if present. Fixes #448 using code from #1219 * Attempt to get travis to load lxml. * Correct testing both xml and lxml writers in graphml * skip docstring test
* Remove attr_dict calls to graph's add_node; replace with **.thegreathippo2016-04-261-1/+1
| | | | | | Combing through the code for any point where it pushes a dictionary to the add_node method rather than keywords; augmenting these arguments with ** to turn them into keyword arguments.
* Add back 0/1 bools for convenience to GraphML.chebee7i2016-04-161-2/+7
|
* Update allowable bool types for GraphML and GEXF.chebee7i2016-04-161-4/+6
|
* Fix argument ordering to preserve backwards compatibilityDan LaManna2015-10-311-1/+1
|