https://github.com/jmrozanec/ts2g2
Generate graphs from time series and time series from graphs.
https://github.com/jmrozanec/ts2g2
graph-algorithms graphs machine-learning time-series
Last synced: 4 months ago
JSON representation
Generate graphs from time series and time series from graphs.
- Host: GitHub
- URL: https://github.com/jmrozanec/ts2g2
- Owner: jmrozanec
- License: apache-2.0
- Created: 2023-05-19T10:53:22.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-30T07:02:43.000Z (over 1 year ago)
- Last Synced: 2025-07-27T22:07:07.244Z (8 months ago)
- Topics: graph-algorithms, graphs, machine-learning, time-series
- Language: Jupyter Notebook
- Homepage: https://timeseriestographs.com
- Size: 11.5 MB
- Stars: 1
- Watchers: 3
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ts2g2
TS2G2 stands for "timeseries to graphs and back". The library implements a variety of strategies to convert timeseries into graphs, and convert graphs into sequences.
stream = TimeseriesArrayStream([2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3])
timeseries = Timeseries(stream)
g = timeseries.to_graph(NaturalVisibilityGraphStrategy())
sequence = g.to_sequence(RandomWalkSequenceGenerationStrategy(), sequence_length=500)
For a more detailed example, look at the [Amazon stocks demo](https://github.com/graph-massivizer/ts2g2/blob/main/tutorials/demo-amazon-stocks.ipynb).
Many of the methods implemented in this library are described in _Silva, Vanessa Freitas, et al. "Time series analysis via network science: Concepts and algorithms." Wiley Interdisciplinary Reviews: Data Mining and Knowledge Discovery 11.3 (2021): e1404._ Nevertheless, the library also includes additional techniques found in other works from the scientific literature.
This package is being developed as part of the [Graph-Massivizer](https://graph-massivizer.eu/) project.
The package is a joint effort between the [Jožef Stefan Institute](https://www.ijs.si/), the [University of Twente](https://www.utwente.nl/en/), the [Vrije Universiteit Amsterdam](https://vu.nl/en), the [University of Klagenfurt](https://www.aau.at/en/), the [University of Bologna](https://www.unibo.it/en), and [Peracton](https://peracton.com/).
### Timeseries to graph conversion
#### Implemented features
#
Visibility Graph
Graph type
Constraints
Undirected
Directed
Weighted
Penetration
Angle
1
Natural Visibility Graph
X
X
X
X
X
2
Horizontal Visibility Graph
X
X
X
X
X
3
Difference Visibility Graph
#### References table
#
Visibility Graph
Graph type
Constraints
Undirected
Directed
Weighted
Penetration
Angle
1
Natural Visibility Graph
ref
ref
ref
ref,
ref
2
Horizontal Visibility Graph
ref
ref
ref
ref,
ref
3
Difference Visibility Graph
### Graphs to timeseries conversion
Graphs are converted back to timeseries by sampling node values from the graph following different strategies. The following strategies have been implemented so far:
- random node
- random node neighbour
- random node degree
- random walk
- random walk with restart
- random walk with jump
## Publications
When using this work for research purposes, we would appreciate it if the following references could be included:
Below we provide a curated list of papers related to our research in this area: