Generates an interval graph for a list of intervals given.
In graph theory, an interval graph is an undirected graph formed from a set of closed intervals on the real line, with a vertex for each interval and an edge between vertices whose intervals intersect. It is the intersection graph of the intervals.
More information can be found at: https://en.wikipedia.org/wiki/Interval_graph
intervals (a sequence of intervals, say (l, r) where l is the left end,)
and r is the right end of the closed interval.
- Return type
>>> intervals = [(-2, 3), [1, 4], (2, 3), (4, 6)] >>> G = nx.interval_graph(intervals) >>> sorted(G.edges) [((-2, 3), (1, 4)), ((-2, 3), (2, 3)), ((1, 4), (2, 3)), ((1, 4), (4, 6))]