
    h                     P    S r SSKJr  SSKrS/r\R                  " SSS9S 5       rg)z 
Generators for interval graph.
    )SequenceNinterval_graphT)graphsreturns_graphc                    [        U 5      n U  HL  n[        U[        5      (       a  [        U5      S:X  d  [	        S5      eUS   US   :  d  M@  [        SU 35      e   [        R                  " 5       nU  Vs/ s H  n[        U5      PM     nnUR                  U5        U(       aI  UR                  5       =u  pEnU H&  nUu  pXX:  d  M  X:  d  M  UR                  Xg5        M(     U(       a  MI  U$ s  snf )a  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

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.

Returns
-------
G : networkx graph

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

Raises
------
:exc:`TypeError`
    if `intervals` contains None or an element which is not
    collections.abc.Sequence or not a length of 2.
:exc:`ValueError`
    if `intervals` contains an interval such that min1 > max1
    where min1,max1 = interval
   zZEach interval must have length 2, and be a collections.abc.Sequence such as tuple or list.r      z*Interval must have lower value first. Got )list
isinstancer   len	TypeError
ValueErrornxGraphtupleadd_nodes_frompopadd_edge)
	intervalsintervalgraphtupled_intervalsmin1max1	interval1	interval2min2max2s
             T/var/www/html/env/lib/python3.13/site-packages/networkx/generators/interval_graph.pyr   r      s    J YI8X..3x=A3EB  A;!$I(TUU  HHJE8AB	Hh	B	)*
!1!5!5!77
Y)I"JD|y4 * 
 L Cs   7C1)__doc__collections.abcr   networkxr   __all___dispatchabler        r   <module>r'      s;    % 
 T29 39r&   