Obtain visibility graphs from time series data.
Project description
ts2vg
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for ts2vg-0.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26dbc7222898a18c36ae9cfdad45a89769047b129139bbdb79db2824f6197677 |
|
MD5 | f35815f558e0e58c2328263a5bd5e412 |
|
BLAKE2b-256 | ef7ee5c1c4282793bfae2d80b3058801cf23c2a6a998315e5483dba0c27e4734 |
Hashes for ts2vg-0.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e4f5ba592ff8b15a9f5486f6eb0ba8460f730454fc0b99313010c8d8b374294 |
|
MD5 | a33c5e3b7cad4a34bd55f191510f2e8b |
|
BLAKE2b-256 | 098ab2e1ed900100c0acccb283e05ff3d746fa5a720b25bd14ec72a20a6e61f1 |