ó
|£*^c           @   s¢   d  Z  y d d l m Z Wn! e k
 r= d d l m Z n Xd d l Z d j d d g ƒ Z d d	 d
 d g Z	 d d d „ Z d „  Z d d „ Z d „  Z d S(   s   Operations on many graphs.
iÿÿÿÿ(   t   izip_longest(   t   zip_longestNs   
s&   Robert King <kingrobertking@gmail.com>s%   Aric Hagberg <aric.hagberg@gmail.com>t	   union_allt   compose_allt   disjoint_union_allt   intersection_allc         C   sc   t  |  | ƒ } t | ƒ \ } } x; | D]3 \ } } t j | | | | f d | ƒ} d } q( W| S(   sñ  Return the union of all graphs.

    The graphs must be disjoint, otherwise an exception is raised.

    Parameters
    ----------
    graphs : list of graphs
       List of NetworkX graphs

    rename : bool , default=(None, None)
       Node names of G and H can be changed by specifying the tuple
       rename=('G-','H-') (for example).  Node "u" in G is then renamed
       "G-u" and "v" in H is renamed "H-v".

    name : string
       Specify the name for the union graph@not_implemnted_for('direct

    Returns
    -------
    U : a graph with the same type as the first graph in list

    Notes
    -----
    To force a disjoint union with node relabeling, use
    disjoint_union_all(G,H) or convert_node_labels_to integers().

    Graph, edge, and node attributes are propagated to the union graph.
    If a graph attribute is present in multiple graphs, then the value
    from the last graph in the list with that attribute is used.

    See Also
    --------
    union
    disjoint_union_all
    t   nameN(   R   t   nextt   nxt   uniont   None(   t   graphst   renameR   t   graphs_namest   Ut   gnamet   Ht   hname(    (    su   /home/gitlab-runner/builds/8480fa44/0/bergerc/fluidmanager-web/art-framework/bin/networkx/algorithms/operators/all.pyR      s    $!
c         C   s?   t  |  ƒ }  t |  ƒ } x  |  D] } t j | | ƒ } q W| S(   s“  Return the disjoint union of all graphs.

    This operation forces distinct integer node labels starting with 0
    for the first graph in the list and numbering consecutively.

    Parameters
    ----------
    graphs : list
       List of NetworkX graphs

    Returns
    -------
    U : A graph with the same type as the first graph in list

    Notes
    -----
    It is recommended that the graphs be either all directed or all undirected.

    Graph, edge, and node attributes are propagated to the union graph.
    If a graph attribute is present in multiple graphs, then the value
    from the last graph in the list with that attribute is used.
    (   t   iterR   R   t   disjoint_union(   R   R   R   (    (    su   /home/gitlab-runner/builds/8480fa44/0/bergerc/fluidmanager-web/art-framework/bin/networkx/algorithms/operators/all.pyR   C   s
    c         C   sE   t  |  ƒ }  t |  ƒ } x& |  D] } t j | | d | ƒ} q W| S(   sÍ  Return the composition of all graphs.

    Composition is the simple union of the node sets and edge sets.
    The node sets of the supplied graphs need not be disjoint.

    Parameters
    ----------
    graphs : list
       List of NetworkX graphs

    name : string
       Specify name for new graph

    Returns
    -------
    C : A graph with the same type as the first graph in list

    Notes
    -----
    It is recommended that the supplied graphs be either all directed or all
    undirected.

    Graph, edge, and node attributes are propagated to the union graph.
    If a graph attribute is present in multiple graphs, then the value
    from the last graph in the list with that attribute is used.
    R   (   R   R   R   t   compose(   R   R   t   CR   (    (    su   /home/gitlab-runner/builds/8480fa44/0/bergerc/fluidmanager-web/art-framework/bin/networkx/algorithms/operators/all.pyR   a   s
    c         C   s?   t  |  ƒ }  t |  ƒ } x  |  D] } t j | | ƒ } q W| S(   s¢  Return a new graph that contains only the edges that exist in
    all graphs.

    All supplied graphs must have the same node set.

    Parameters
    ----------
    graphs_list : list
       List of NetworkX graphs

    Returns
    -------
    R : A new graph with the same type as the first graph in list

    Notes
    -----
    Attributes from the graph, nodes, and edges are not copied to the new
    graph.
    (   R   R   R   t   intersection(   R   t   RR   (    (    su   /home/gitlab-runner/builds/8480fa44/0/bergerc/fluidmanager-web/art-framework/bin/networkx/algorithms/operators/all.pyR   ƒ   s
    (   N(   t   __doc__t	   itertoolsR    R   t   ImportErrort   networkxR   t   joint
   __author__t   __all__R
   R   R   R   R   (    (    (    su   /home/gitlab-runner/builds/8480fa44/0/bergerc/fluidmanager-web/art-framework/bin/networkx/algorithms/operators/all.pyt   <module>   s   			,	"