Skip to main content

Obtain visibility graphs from time series data.

Project description

ts2vg

Example of a Visibility Graph Visualized

The Python ts2vg package provides high-performance algorithm implementations to obtain visibility graphs from time series data.

The visibility graphs and some of their properties (e.g. degree distributions) are computed quickly and efficiently, even for time series with millions of observations, thanks to the use of NumPy and a custom C backend (with the help of Cython) developed for the visibility algorithms.

The (natural) visibility graphs are provided according to the mathematical definitions described in:

  • Lucas Lacasa et al., "From time series to complex networks: The visibility graph", 2008.

An efficient divide-and-conquer algorithm is used, as described in:

  • Xin Lan et al., "Fast transformation from time series to visibility graphs", 2015

Installation

The latest released ts2vg version is available at the Python Package Index and can be easily installed by running:

pip install ts2vg

For other advanced uses, to install ts2vg from source, Cython is required.

Python basic usage

Obtaining the edge list for the visibility graph of a time series:

from ts2vg import NaturalVisibilityGraph

ts = [0.87, 0.48, 0.36, 0.83, 0.87, 0.48, 0.36, 0.83]
edges = NaturalVisibilityGraph(ts).edgelist()

Obtaining the degree distribution for the visibility graph of a time series:

from ts2vg import NaturalVisibilityGraph

ts = [0.87, 0.48, 0.36, 0.83, 0.87, 0.48, 0.36, 0.83]
ks, pks = NaturalVisibilityGraph(ts).degree_distribution()

To obtain an igraph, NetworkX or SNAP graph object the following methods are provided:

  • as_igraph()
  • as_networkx()
  • as_snap()
from ts2vg import NaturalVisibilityGraph

ts = [0.87, 0.48, 0.36, 0.83, 0.87, 0.48, 0.36, 0.83]
vg = NaturalVisibilityGraph(ts).as_igraph()

Full documentation and information on all available features be found here.

Command Line Interface

ts2vg can also be used as a command line program directly from the console:

ts2vg ./timeseries.txt -o out.edg 

Use ts2vg -h to see additional help on the command line program use and features.

License

ts2vg is licensed under the terms of the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ts2vg-0.1.tar.gz (153.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ts2vg-0.1-cp38-cp38-win_amd64.whl (82.6 kB view details)

Uploaded CPython 3.8Windows x86-64

ts2vg-0.1-cp38-cp38-win32.whl (69.3 kB view details)

Uploaded CPython 3.8Windows x86

ts2vg-0.1-cp36-cp36m-win_amd64.whl (81.1 kB view details)

Uploaded CPython 3.6mWindows x86-64

File details

Details for the file ts2vg-0.1.tar.gz.

File metadata

  • Download URL: ts2vg-0.1.tar.gz
  • Upload date:
  • Size: 153.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.8

File hashes

Hashes for ts2vg-0.1.tar.gz
Algorithm Hash digest
SHA256 a071726cf418579fbbdc4f46225219ce2c7807323fd4a3175c59c8cc634f3801
MD5 01cc9f2676f2d5abf2c3897e9bd325a8
BLAKE2b-256 93532feb4ce99d7b4dfb5b2759f976c273363998133c334dfe369b1cd3b1492a

See more details on using hashes here.

File details

Details for the file ts2vg-0.1-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: ts2vg-0.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 82.6 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.8

File hashes

Hashes for ts2vg-0.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 26dbc7222898a18c36ae9cfdad45a89769047b129139bbdb79db2824f6197677
MD5 f35815f558e0e58c2328263a5bd5e412
BLAKE2b-256 ef7ee5c1c4282793bfae2d80b3058801cf23c2a6a998315e5483dba0c27e4734

See more details on using hashes here.

File details

Details for the file ts2vg-0.1-cp38-cp38-win32.whl.

File metadata

  • Download URL: ts2vg-0.1-cp38-cp38-win32.whl
  • Upload date:
  • Size: 69.3 kB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.8

File hashes

Hashes for ts2vg-0.1-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 ce64d6cce3492eb093fc41c40a64a9eb2a2068933921423ffff980d4773d775d
MD5 3d4e1e5d069a8ce57c63a44f102d5c37
BLAKE2b-256 4ac718321d27a4eb42855c98689d9e866a749fef3f9f264533f0bc53d12be405

See more details on using hashes here.

File details

Details for the file ts2vg-0.1-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: ts2vg-0.1-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 81.1 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.8

File hashes

Hashes for ts2vg-0.1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 7e4f5ba592ff8b15a9f5486f6eb0ba8460f730454fc0b99313010c8d8b374294
MD5 a33c5e3b7cad4a34bd55f191510f2e8b
BLAKE2b-256 098ab2e1ed900100c0acccb283e05ff3d746fa5a720b25bd14ec72a20a6e61f1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page