networkx 2.8.2 Pypi GitHub Homepage
Other Docs
ParametersRaisesReturnsBackRef
interval_graph(intervals)

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

Parameters

intervals : a sequence of intervals, say (l, r) where l is the left end,
and r is the right end of the closed interval. :

Raises

:exc:`TypeError`

if :None:None:`intervals` contains None or an element which is not collections.abc.Sequence or not a length of 2.

:exc:`ValueError`

if :None:None:`intervals` contains an interval such that min1 > max1 where min1,max1 = interval

Returns

G : networkx graph

Generates an interval graph for a list of intervals given.

Examples

>>> 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))]
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.generators.interval_graph.interval_graph

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/generators/interval_graph.py#10
type: <class 'function'>
Commit: