Return a Visibility Graph of an input Time Series.
A visibility graph converts a time series into a graph. The constructed graph uses integer nodes to indicate which event in the series the node represents. Edges are formed as follows: consider a bar plot of the series and view that as a side view of a landscape with a node at the top of each bar. An edge means that the nodes can be connected by a straight “line-of-sight” without being obscured by any bars between the nodes.
The resulting graph inherits several properties of the series in its structure. Thereby, periodic series convert into regular graphs, random series convert into random graphs, and fractal series convert into scale-free networks .
A Time Series sequence (iterable and sliceable) of numeric values representing times.
- NetworkX Graph
The Visibility Graph of the input series
>>> series_list = [range(10), [2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3]] >>> for s in series_list: ... g = nx.visibility_graph(s) ... print(g) Graph with 10 nodes and 9 edges Graph with 12 nodes and 18 edges