Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

From time series to graph thru visibility algorithm.

Project Description

This python package is an implementation of the algorithm described in the article: From time series to complex networks: The visibility graph.

Installation

Install library, perhaps within a virtualenv:

$ pip install visibility_graph

Application Programming Interface

Pass series as a list, visibility_graph will return a networkX undirected graph. Nodes contain the magnitudes on their timepoints.:

>>> from visibility_graph import visibility_graph
>>> series = [0.87, 0.49, 0.36, 0.83, 0.87]
>>> g = visibility_graph( series )
>>>
>>> g.nodes()
[0, 1, 2, 3, 4]
>>> g.edges()
[(0, 1), (0, 3), (0, 4), (1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)]
>>>
>>> g.node[1]
{'mag': 0.49}

Series to edgelist

A command line script is provided:

$ series2edgelist.py series.csv

where series.csv is a file containing one time point per line. One can specify more than one series file:

$ series2edgelist.py series1.csv series2.csv seriesN.csv

The script will also read a series from the standard input:

$ cat series.csv | series2edgelist.py

Edgelist will be printed to the standard output. So it might be wise to:

$ cat series.csv | series2edgelist.py > series.edgelist

The gist

“In this graph, every node corresponds, in the same order, to series data, and two nodes are connected if visibility exists between the corresponding data, that is to say, if there is a straight line that connects the series data, provided that this “visibility line” does not intersect any intermediate data height.”

“More formally, we can establish the following visibility criteria: two arbitrary data values (t a, y a) and (t b, y b) will have visibility, and consequently will become two connected nodes of the associated graph, if any other data (t c, y c) placed between them fulfills:”

Release History

Release History

This version
History Node

0.4

History Node

0.3

History Node

0.2

History Node

0.1

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
visibility_graph-0.4.tar.gz (3.1 kB) Copy SHA256 Checksum SHA256 Source Mar 30, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting