Skip to content

nelsonaloysio/networkx-temporal

Repository files navigation

NetworkX-Temporal


PyPI package Documentation Status Downloads Downloads License

Python package to build and manipulate temporal graphs using NetworkX as backend.

Install

Available for Python 3.7++ from PyPI:

$ pip install 'networkx-temporal[draw]'

The [draw] extra includes additional libraries required to plot graphs with NetworkX.

Requires networkx >=2.1, numpy >=1.17.3, pandas >=1.1.0, scipy >=1.7.3.

Optional dependencies can be installed from the groups all, docs, draw, ipynb.

Quick example

For detailed information on using the package, please refer to its official documentation.

An interactive Jupyter notebook with more examples is also available here (open on Colab).

>>> import networkx_temporal as tx
>>>
>>> TG = tx.temporal_graph(directed=False)  # tx.TemporalMultiGraph()
>>>
>>> TG.add_edge("a", "b", time=0)
>>> TG.add_edge("c", "b", time=1)
>>> TG.add_edge("d", "c", time=2)
>>> TG.add_edge("d", "e", time=2)
>>> TG.add_edge("a", "c", time=2)
>>> TG.add_edge("f", "e", time=3)
>>> TG.add_edge("f", "a", time=3)
>>> TG.add_edge("f", "b", time=3)
>>>
>>> # Obtain snapshots as subgraph views.
>>> TG = TG.slice(attr="time")
>>>
>>> # Plot resulting object.
>>> tx.draw(TG, layout="kamada_kawai", figsize=(8,2))

Temporal graph plot

Contributing

Contributions are welcome! If you find any bugs or have any suggestions, feel free to open a ticket, fork the repository and create a pull request, or simply send an e-mail. Please keep in mind that any out-of-scope contributions (not regarding temporal networks) should instead be directed to the NetworkX repository.

License

This package is released under the BSD License.

Cite

In case this package is useful for your research, kindly consider citing it.

About

Python package to build and manipulate temporal graphs.

Resources

License

Stars

Watchers

Forks

Contributors