Skip to content

Commit

Permalink
Merge pull request #305 from Deltares/chore/222-investigate-igraph-pe…
Browse files Browse the repository at this point in the history
…rformance

chore: #222 investigate igraph performance
  • Loading branch information
ArdtK authored Mar 6, 2024
2 parents 447cb6c + e9ab3b5 commit d1ef8ae
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ instance/

# Sphinx documentation
docs/_build/
docs/_examples/

# PyBuilder
target/
Expand Down
29 changes: 28 additions & 1 deletion docs/collaboration/implementation_decisions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,31 @@ We tried replacing `geopy <https://geopy.readthedocs.io/en/stable/>`_ with simil
However, this did not seem to be a valid alternative as the accuracy and simplicity of geopy outweights the benefit of replacing it with similar extensive logic as can be seen in this `example <https://autogis-site.readthedocs.io/en/2019/notebooks/L2/calculating-distances.html>`_.

.. tip::
This topic was handled in issue `188 <https://github.com/Deltares/ra2ce/issues/188>`_
This topic was handled in issue `188 <https://github.com/Deltares/ra2ce/issues/188>`_

Replacing NetworkX with igraph
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Currently NetworkX is used as graph framework `NetworkX <https://networkx.org/>`_.
A downside of this framework is the known poor performance.
For this reason igraph `igraph <https://igraph.org/python/>`_ has been assessed as possible replacement of NetworkX.

.. tip::
This topic was handled in issue `222 <https://github.com/Deltares/ra2ce/issues/222>`_

Characteristics NetworkX
""""""""""""""""""""""""
- works well together with `geopandas`,
- has different classes for graphs, multigraphs and directed (multi-)graphs,
- offers many functions for graph manipulation and analysis.

Characteristics igraph
""""""""""""""""""""""
- has a better performance than NetworkX,
- less intuitive to use with Python and geopandas (e.g. working with coordinate systems is less straightforward),
- less suited for dynamic graphs (indexing needs to be redone on extension and reduction of the graph).

Conclusion
""""""""""
NetworkX is used on many places in the code.
This, together with the differences in implementation, will require a thorough refactoring of the application for the benefit of a significant performance improvement.
Therefore, for now, it was chosen not to work on replacing NetworkX with igraph.

0 comments on commit d1ef8ae

Please sign in to comment.