{"id":18657296,"url":"https://github.com/jmrozanec/ts2g2","last_synced_at":"2025-12-13T18:01:36.602Z","repository":{"id":223189547,"uuid":"642789655","full_name":"jmrozanec/ts2g2","owner":"jmrozanec","description":"Generate graphs from time series and time series from graphs.","archived":false,"fork":false,"pushed_at":"2024-07-30T07:02:43.000Z","size":12051,"stargazers_count":1,"open_issues_count":0,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-27T22:07:07.244Z","etag":null,"topics":["graph-algorithms","graphs","machine-learning","time-series"],"latest_commit_sha":null,"homepage":"https://timeseriestographs.com","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jmrozanec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-19T10:53:22.000Z","updated_at":"2024-08-27T13:37:44.000Z","dependencies_parsed_at":"2024-02-18T22:22:12.634Z","dependency_job_id":"d54e598b-62d1-4aa6-9643-3714743a462a","html_url":"https://github.com/jmrozanec/ts2g2","commit_stats":null,"previous_names":["jmrozanec/time-series-generator","jmrozanec/ts2g2"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jmrozanec/ts2g2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmrozanec%2Fts2g2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmrozanec%2Fts2g2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmrozanec%2Fts2g2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmrozanec%2Fts2g2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmrozanec","download_url":"https://codeload.github.com/jmrozanec/ts2g2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmrozanec%2Fts2g2/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269548500,"owners_count":24436113,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-09T02:00:10.424Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graph-algorithms","graphs","machine-learning","time-series"],"created_at":"2024-11-07T07:27:29.364Z","updated_at":"2025-12-13T18:01:36.024Z","avatar_url":"https://github.com/jmrozanec.png","language":"Jupyter Notebook","readme":"# ts2g\u003csup\u003e2\u003c/sup\u003e\n\nTS2G\u003csup\u003e2\u003c/sup\u003e stands for \"timeseries to graphs and back\". The library implements a variety of strategies to convert timeseries into graphs, and convert graphs into sequences.\n\n    stream = TimeseriesArrayStream([2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3])\n    timeseries = Timeseries(stream)\n    g = timeseries.to_graph(NaturalVisibilityGraphStrategy())\n    sequence = g.to_sequence(RandomWalkSequenceGenerationStrategy(), sequence_length=500)\n\nFor a more detailed example, look at the [Amazon stocks demo](https://github.com/graph-massivizer/ts2g2/blob/main/tutorials/demo-amazon-stocks.ipynb).\n\nMany 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.\n\nThis package is being developed as part of the [Graph-Massivizer](https://graph-massivizer.eu/) project. \nThe 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/).\n\n\n### Timeseries to graph conversion\n\n#### Implemented features\n\n\u003ctable class=\"tg\"\u003e\n\u003cthead\u003e\n  \u003ctr\u003e\n    \u003cth class=\"tg-7btt\" rowspan=\"3\"\u003e#\u003c/th\u003e\n    \u003cth class=\"tg-7btt\" rowspan=\"3\"\u003eVisibility Graph\u003c/th\u003e\n    \u003cth class=\"tg-7btt\" colspan=\"3\"\u003eGraph type\u003c/th\u003e\n    \u003cth class=\"tg-7btt\" colspan=\"4\"\u003eConstraints\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003cth class=\"tg-7btt\" rowspan=\"2\"\u003eUndirected\u003c/th\u003e\n    \u003cth class=\"tg-7btt\" rowspan=\"2\"\u003eDirected\u003c/th\u003e\n    \u003cth class=\"tg-7btt\" rowspan=\"2\"\u003eWeighted\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003cth class=\"tg-7btt\"\u003ePenetration\u003c/th\u003e\n    \u003cth class=\"tg-7btt\"\u003eAngle\u003c/th\u003e\n  \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n  \u003ctr\u003e\n    \u003ctd class=\"tg-7btt\"\u003e1\u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003eNatural Visibility Graph\u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n        X\n    \u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n      \u003c!-- directed --\u003e\n      X\n    \u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n      \u003c!-- weighted --\u003e\n      X\n    \u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n      \u003c!-- constraints:references: penetration --\u003e\n      X\n    \u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n      \u003c!-- constraints:references: angle --\u003e\n      X\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd class=\"tg-7btt\"\u003e2\u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003eHorizontal Visibility Graph\u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n      X\n    \u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n        \u003c!-- directed --\u003e\n        X\n    \u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n      \u003c!-- weighted --\u003e\n      X \n    \u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n      \u003c!-- constraints:references: penetration --\u003e\n      X\n    \u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n      \u003c!-- constraints:references: angle --\u003e\n      X\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd class=\"tg-7btt\"\u003e3\u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003eDifference Visibility Graph\u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n        \u003c!-- undirected --\u003e\n    \u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n      \u003c!-- directed --\u003e\n    \u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n      \u003c!-- weighted --\u003e\n    \u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n      \u003c!-- constraints:references: penetration --\u003e\n    \u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n      \u003c!-- constraints:references: angle --\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\n\n#### References table\n\n\u003ctable class=\"tg\"\u003e\n\u003cthead\u003e\n  \u003ctr\u003e\n    \u003cth class=\"tg-7btt\" rowspan=\"3\"\u003e#\u003c/th\u003e\n    \u003cth class=\"tg-7btt\" rowspan=\"3\"\u003eVisibility Graph\u003c/th\u003e\n    \u003cth class=\"tg-7btt\" colspan=\"3\"\u003eGraph type\u003c/th\u003e\n    \u003cth class=\"tg-7btt\" colspan=\"4\"\u003eConstraints\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003cth class=\"tg-7btt\" rowspan=\"2\"\u003eUndirected\u003c/th\u003e\n    \u003cth class=\"tg-7btt\" rowspan=\"2\"\u003eDirected\u003c/th\u003e\n    \u003cth class=\"tg-7btt\" rowspan=\"2\"\u003eWeighted\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003cth class=\"tg-7btt\"\u003ePenetration\u003c/th\u003e\n    \u003cth class=\"tg-7btt\"\u003eAngle\u003c/th\u003e\n  \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n  \u003ctr\u003e\n    \u003ctd class=\"tg-7btt\"\u003e1\u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003eNatural Visibility Graph\u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n        \u003ca href=\"https://www.pnas.org/doi/10.1073/pnas.0709247105\"\u003eref\u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n      \u003c!-- directed --\u003e\n      \u003ca href=\"https://link.springer.com/article/10.1140/epjb/e2012-20809-8\"\u003eref\u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n      \u003c!-- weighted --\u003e\n    \u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n      \u003c!-- constraints:references: penetration --\u003e\n      \u003ca href=\"https://www.semanticscholar.org/paper/Limited-penetrable-visibility-graph-for-complex-Zhou-Jin/fe4a3d2f486021ee066f8a80472deef57d8aee71\"\u003eref\u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n      \u003c!-- constraints:references: angle --\u003e\n      \u003ca href=\"https://doi.org/10.1109/ACCESS.2016.2612242\"\u003eref\u003c/a\u003e, \n      \u003ca href=\"https://doi.org/10.1016/j.physa.2014.07.002\"\u003eref\u003c/a\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd class=\"tg-7btt\"\u003e2\u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003eHorizontal Visibility Graph\u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n      \u003ca href=\"https://journals.aps.org/pre/abstract/10.1103/PhysRevE.80.046103\"\u003eref\u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n      \u003ca href=\"https://link.springer.com/article/10.1140/epjb/e2012-20809-8\"\u003eref\u003c/a\u003e\n      \u003c!-- directed --\u003e\n    \u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n      \u003c!-- weighted --\u003e\n      \u003ca href=\"https://doi.org/10.1109/ACCESS.2016.2612242\"\u003eref\u003c/a\u003e \n    \u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n      \u003c!-- constraints:references: penetration --\u003e\n      \u003ca href=\"https://www.semanticscholar.org/paper/Limited-penetrable-visibility-graph-for-complex-Zhou-Jin/fe4a3d2f486021ee066f8a80472deef57d8aee71\"\u003eref\u003c/a\u003e, \n      \u003ca href=\"https://www.nature.com/articles/srep35622\"\u003eref\u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n      \u003c!-- constraints:references: angle --\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd class=\"tg-7btt\"\u003e3\u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003eDifference Visibility Graph\u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n        \u003c!-- undirected --\u003e\n    \u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n      \u003c!-- directed --\u003e\n    \u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n      \u003c!-- weighted --\u003e\n    \u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n      \u003c!-- constraints:references: penetration --\u003e\n    \u003c/td\u003e\n    \u003ctd class=\"tg-0pky\"\u003e\n      \u003c!-- constraints:references: angle --\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\n\n\n### Graphs to timeseries conversion\n\nGraphs are converted back to timeseries by sampling node values from the graph following different strategies. The following strategies have been implemented so far:\n\n - random node\n - random node neighbour\n - random node degree \n - random walk\n - random walk with restart\n - random walk with jump\n\n\n## Publications\n\nWhen using this work for research purposes, we would appreciate it if the following references could be included:\n\n\nBelow we provide a curated list of papers related to our research in this area:\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmrozanec%2Fts2g2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmrozanec%2Fts2g2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmrozanec%2Fts2g2/lists"}