U
    td}                     @   s  d Z dZddlmZmZmZmZmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5 ddl6m7Z7m8Z8m9Z9m:Z:m;Z; ddl<m=Z=m>Z> ddl?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZG ddlHmIZImJZJmKZK ddlLmMZMmNZNmOZOmPZPmQZQmRZRmSZSmTZTmUZUmVZVmWZWmXZXmYZY dd	lZm[Z[m\Z\m]Z]m^Z^m_Z_m`Z`maZambZbmcZcmdZdmeZemfZfmgZg dd
lhmiZimjZjmkZkmlZlmmZmmnZnmoZompZp ddlqmrZrmsZt ddlumvZvmwZwmxZxmyZymzZzm{Z{m|Z|m}Z} ddl~mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ ddlmZ ddlmZ ddlmZmZmZmZ ddlmZ ddlmZ ddlmZmZmZmZmZmZmZmZmZmZmZmZ ddlmZmZmZmZmZmZmZmZmZmZmZ ddlmZmZ ddlmZmZmZmZ ddlmZ ddlmZmZmZmZ ddlmZ ddlmZmZmZmZmZmZmZ ddlmZ ddlmZmZmZmZ ddlmZmZmZ ddlmZmZmZmZmZmZmZmZ ddlmZmZmZmZmZ dd lmZmZ dd!lmZmZmZ dd"lmZmZ dd#lZdd#lZG d$d% d%eZee_e܃  ee_eeD ]:Zed&sqed'krqeeeeeee qeeje_eej e_eeje_eeje_eeje_d(d) Zd*d+ Z	e	Z
d,d- ZeZet Z[[[[[[[[[[[[[[[[[[[[[[[[[[[[[M[N[O[P[Q[R[S[T[U[V[W[X[Y[[[@[A[B[C[D[F[G[[[[[[[=[>[7[8[9[I[J[K[d[e[f[d.Zd#S )/z
igraph library.
a  
Copyright (C) 2006- The igraph development team

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc.,  51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
    )2ADJ_DIRECTED	ADJ_LOWERADJ_MAXADJ_MINADJ_PLUSADJ_UNDIRECTED	ADJ_UPPERALLARPACKOptionsBFSIterBLISS_FBLISS_FL	BLISS_FLMBLISS_FMBLISS_FS	BLISS_FSMDFSIterEdgeGET_ADJACENCY_BOTHGET_ADJACENCY_LOWERGET_ADJACENCY_UPPER	GraphBaseINInternalErrorOUTREWIRING_SIMPLEREWIRING_SIMPLE_LOOPSSTAR_INSTAR_MUTUALSTAR_OUTSTAR_UNDIRECTEDSTRONGTRANSITIVITY_NANTRANSITIVITY_ZEROTREE_INTREE_OUTTREE_UNDIRECTEDVertexWEAKarpack_optionscommunity_to_membershipconvex_hullis_degree_sequenceis_graphicalis_graphical_degree_sequenceset_progress_handlerset_random_number_generatorset_status_handlerumap_compute_weights__igraph_version__)_get_adjacency_get_adjacency_sparse_get_adjlist_get_incidence_get_inclist)_count_automorphisms_vf2_get_automorphisms_vf2)	_add_edge
_add_edges_add_vertex_add_vertices_delete_edges_clear_as_directed_as_undirected)_maximum_bipartite_matching_bipartite_projection_bipartite_projection_size)_community_fastgreedy_community_infomap$_community_leading_eigenvector_naive_community_leading_eigenvector_community_label_propagation_community_multilevel_community_optimal_modularity_community_edge_betweenness_community_spinglass_community_walktrap_k_core_community_leiden_modularity)
ClusteringVertexClustering
DendrogramVertexDendrogramCoverVertexCoverCohesiveBlockscompare_communitiessplit_join_distance_biconnected_components_cohesive_blocks_connected_components	_clusters)CutFlow_all_st_cuts_all_st_mincuts_gomory_hu_tree_maxflow_mincut
_st_mincut)Configurationinit)BoundingBoxCairoGraphDrawerDefaultGraphDrawerMatplotlibGraphDrawerPlotPoint	Rectangleplot)PaletteGradientPaletteAdvancedGradientPaletteRainbowPalettePrecalculatedPaletteClusterColoringPalettecolor_name_to_rgbcolor_name_to_rgba
hsv_to_rgbhsva_to_rgba
hsl_to_rgbhsla_to_rgba
rgb_to_hsvrgba_to_hsva
rgb_to_hslrgba_to_hslapalettesknown_colors)__plot__)	autocurve)Matrix
DyadCensusTriadCensusUniqueIdGenerator)construct_graph_from_formula)_format_mapping)#_construct_graph_from_graphmlz_file!_construct_graph_from_dimacs_file!_construct_graph_from_pickle_file"_construct_graph_from_picklez_file$_construct_graph_from_adjacency_file_construct_graph_from_file_write_graph_to_adjacency_file_write_graph_to_dimacs_file_write_graph_to_graphmlz_file_write_graph_to_pickle_file_write_graph_to_picklez_file_write_graph_to_file)_construct_graph_from_dict_list_export_graph_to_dict_list _construct_graph_from_tuple_list_export_graph_to_tuple_list_construct_graph_from_list_dict_export_graph_to_list_dict_construct_graph_from_dict_dict_export_graph_to_dict_dict_construct_graph_from_dataframe_export_vertex_dataframe_export_edge_dataframe)_construct_graph_from_adjacency(_construct_graph_from_weighted_adjacency)_construct_graph_from_networkx_export_graph_to_networkx _construct_graph_from_graph_tool_export_graph_to_graph_tool)!_construct_random_geometric_graph)_construct_bipartite_graph$_construct_incidence_bipartite_graph_construct_full_bipartite_graph!_construct_random_bipartite_graph)_write_graph_to_svg)Layout_layout_layout_auto_layout_sugiyama_layout_method_wrapper_3d_version_for_layout_mapping)Matching)disjoint_unionunionintersectionoperator_method_registry)EdgeSeq	VertexSeq_add_proxy_methods)FittedPowerLaw	HistogramRunningMeanmeanmedian
percentilequantilepower_law_fit)	_indegree
_outdegree_degree_distribution	_pagerank_shortest_paths)GraphSummarysummary)
deprecatednumpy_to_contiguous_memoryviewrescale)__version____version_info__Nc                       s(  e Zd ZdZejZejZej	Z
ejZejZejZejZejZejZejZeZeZejZ fddZeeZe Z!ee"Z#e$Z%ee&Z'e(Z)ee*Z+e,Z-ee.Z/e0Z1ee2Z3e4Z5ee6Z7e8Z9e:Z;ee<Z=e=Z>e?Z@e@ZAeeBZCeDZEeeFZGeHZIeeJZKeLZMeeNZOePZQeeRZSeeTZUeeVZWeXZYeZZ[ee\Z]ee^Z_ee`ZaeebZceedZeeefZgdd Zhd8dd	Zid
d Zjdd Zkeldd Zmeldd ZneoZpeqZresZteuZvewZxeyZze{Z|e}Z~ed Zed Zed Zed Zed Zed Zed Zed Zed Zed ZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZd9ddZd:d!d"Zefd#d$Zd;d%d&Zd'd( Zd)d* Zd<d,d-Zeld.d/ Zd0d1 Zd2d3 Zed4d5 Zd6d7 ZdZdZ  ZS )=Grapha^  Generic graph.

    This class is built on top of L{GraphBase}, so the order of the
    methods in the generated API documentation is a little bit obscure:
    inherited methods come after the ones implemented directly in the
    subclass. L{Graph} provides many functions that L{GraphBase} does not,
    mostly because these functions are not speed critical and they were
    easier to implement in Python than in pure C. An example is the
    attribute handling in the constructor: the constructor of L{Graph}
    accepts three dictionaries corresponding to the graph, vertex and edge
    attributes while the constructor of L{GraphBase} does not. This extension
    was needed to make L{Graph} serializable through the C{pickle} module.
    L{Graph} also overrides some functions from L{GraphBase} to provide a
    more convenient interface; e.g., layout functions return a L{Layout}
    instance from L{Graph} instead of a list of coordinate pairs.

    Graphs can also be indexed by strings or pairs of vertex indices or vertex
    names.  When a graph is indexed by a string, the operation translates to
    the retrieval, creation, modification or deletion of a graph attribute:

      >>> g = Graph.Full(3)
      >>> g["name"] = "Triangle graph"
      >>> g["name"]
      'Triangle graph'
      >>> del g["name"]

    When a graph is indexed by a pair of vertex indices or names, the graph
    itself is treated as an adjacency matrix and the corresponding cell of
    the matrix is returned:

      >>> g = Graph.Full(3)
      >>> g.vs["name"] = ["A", "B", "C"]
      >>> g[1, 2]
      1
      >>> g["A", "B"]
      1
      >>> g["A", "B"] = 0
      >>> g.ecount()
      2

    Assigning values different from zero or one to the adjacency matrix will
    be translated to one, unless the graph is weighted, in which case the
    numbers will be treated as weights:

      >>> g.is_weighted()
      False
      >>> g["A", "B"] = 2
      >>> g["A", "B"]
      1
      >>> g.es["weight"] = 1.0
      >>> g.is_weighted()
      True
      >>> g["A", "B"] = 2
      >>> g["A", "B"]
      2
      >>> g.es["weight"]
      [1.0, 1.0, 2]
    c                    s  | dd}d}dg di i i g}t| }|| |rRtd| jj|  t|}t	|dkrt
|d dr|d|d  ||dt	|< t|D ]\}}||kr|| ||< q|\}	}
}}}}|	dkrd}	|
dkrg }
z,ddlm}m} t|
||frt|
}
W n tk
r$   Y nX |r<t j|d	 nt |	|
| | D ]&\}}t|trpt|}|| |< qT| D ](\}}t|trt|}|| j|< q| D ](\}}t|trt|}|| j|< qdS )
a  __init__(n=0, edges=None, directed=False, graph_attrs=None,
        vertex_attrs=None, edge_attrs=None)

        Constructs a graph from scratch.

        @keyword n: the number of vertices. Can be omitted, the default is
          zero. Note that if the edge list contains vertices with indexes
          larger than or equal to M{m}, then the number of vertices will
          be adjusted accordingly.
        @keyword edges: the edge list where every list item is a pair of
          integers. If any of the integers is larger than M{n-1}, the number
          of vertices is adjusted accordingly. C{None} means no edges.
        @keyword directed: whether the graph should be directed
        @keyword graph_attrs: the attributes of the graph as a dictionary.
        @keyword vertex_attrs: the attributes of the vertices as a dictionary.
          The keys of the dictionary must be the names of the attributes; the
          values must be iterables with exactly M{n} items where M{n} is the
          number of vertices.
        @keyword edge_attrs: the attributes of the edges as a dictionary. The
          keys of the dictionary must be the names of the attributes; the values
          must be iterables with exactly M{m} items where M{m} is the number of
          edges.
        __ptrN)nedgesdirectedgraph_attrsvertex_attrs
edge_attrsr   Fz5{0}.__init__ got an unexpected keyword argument {1!r}__iter__)ndarraymatrix)r   )popsetkeysdifference_update	TypeErrorformat	__class____name__listlenhasattrinsert	enumeratenumpyr   r   
isinstancer   ImportErrorsuper__init__itemsintstrvses)selfargskwdsZptrZ	kwd_orderparamsZunknown_kwdsidxkZnvertsr   r   r   r   r   r   r   keyvaluer    H/home/sam/Atlas/atlas_env/lib/python3.8/site-packages/igraph/__init__.pyr   ]  sZ    
 zGraph.__init__c                 C   s   t dddddd}| jf |S )aL  Returns a string representation of the graph.

        Behind the scenes, this method constructs a L{GraphSummary}
        instance and invokes its C{__str__} method with a verbosity of 1
        and attribute printing turned off.

        See the documentation of L{GraphSummary} for more details about the
        output.
           N   F)	verbositywidthZprint_graph_attributesZprint_vertex_attributesZprint_edge_attributes)dictr   )r   r   r   r   r   __str__  s    
zGraph.__str__r   Nc                 O   s   t t| ||f||S )a  Returns the summary of the graph.

        The output of this method is similar to the output of the
        C{__str__} method. If I{verbosity} is zero, only the header line
        is returned (see C{__str__} for more details), otherwise the
        header line and the edge list is printed.

        Behind the scenes, this method constructs a L{GraphSummary}
        object and invokes its C{__str__} method.

        @param verbosity: if zero, only the header line is returned
          (see C{__str__} for more details), otherwise the header line
          and the full edge list is printed.
        @param width: the number of characters to use in one line.
          If C{None}, no limit will be enforced on the line lengths.
        @return: the summary of the graph.
        )r   r   )r   r  r  r   r   r   r   r   r   #  s    zGraph.summaryc                 C   s   d|   kS )zzReturns whether the graph is named.

        A graph is named if and only if it has a C{"name"} vertex attribute.
        name)Zvertex_attributesr   r   r   r   is_named9  s    zGraph.is_namedc                 C   s   d|   kS )zReturns whether the graph is weighted.

        A graph is weighted if and only if it has a C{"weight"} edge attribute.
        weight)Zedge_attributesr  r   r   r   is_weighted@  s    zGraph.is_weightedc                 C   s   t | S )z The vertex sequence of the graph)r   r  r   r   r   r   I  s    zGraph.vsc                 C   s   t | S )zThe edge sequence of the graph)r   r  r   r   r   r   N  s    zGraph.es__iadd____add____and____isub____sub____mul____or__r   r   r   outc           
      C   sP   |  ||||}d}g }t|D ]*\}}	|	dk r ||||  |d }q |S )a-  Calculates all the simple paths from a given node to some other nodes
        (or all of them) in a graph.

        A path is simple if its vertices are unique, i.e. no vertex is visited
        more than once.

        Note that potentially there are exponentially many paths between two
        vertices of a graph, especially if your graph is lattice-like. In this
        case, you may run out of memory when using this function.

        @param v: the source for the calculated paths
        @param to: a vertex selector describing the destination for the calculated
          paths. This can be a single vertex ID, a list of vertex IDs, a single
          vertex name, a list of vertex names or a L{VertexSeq} object. C{None}
          means all the vertices.
        @param cutoff: maximum length of path that is considered. If negative,
          paths of all lengths are considered.
        @param mode: the directionality of the paths. C{"in"} means to calculate
          incoming paths, C{"out"} means to calculate outgoing paths, C{"all"} means
          to calculate both ones.
        @return: all of the simple paths from the given node to every other
          reachable node in the graph in a list. Note that in case of mode=C{"in"},
          the vertices in a path are returned in reversed order!
        r   r   )Z_get_all_simple_pathsr   append)
r   vtocutoffmodepathsprevresultindexitemr   r   r   get_all_simple_paths  s    
zGraph.get_all_simple_pathsTc                 C   sJ   t | |\}}tdd}t|D ]\}}||d | q"t||_|S )a  Returns the path length histogram of the graph

        @param directed: whether to consider directed paths. Ignored for
          undirected graphs.
        @return: a L{Histogram} object. The object will also have an
          C{unconnected} attribute that stores the number of unconnected
          vertex pairs (where the second vertex can not be reached from
          the first one). The latter one will be of type long (and not
          a simple integer), since this can be I{very} large.
        r   )Z	bin_width)r   path_length_histr   r   addr   Zunconnected)r   r   dataZunconnhistilengthr   r   r   r    s    

zGraph.path_length_histc           
      C   s   |   }dd t|D }g }g }g }||| j||df || |d d||< |r|d \}}|r| }	||	 s||	| j|	|df ||	 || d||	< qZ|  qZ||fS )a]  Conducts a depth first search (DFS) on the graph.

        @param vid: the root vertex ID
        @param mode: either C{"in"} or C{"out"} or C{"all"}, ignored
          for undirected graphs.
        @return: a tuple with the following items:
           - The vertex IDs visited (in order)
           - The parent of every vertex in the DFS
        c                 S   s   g | ]}d qS )Fr   ).0r  r   r   r   
<listcomp>  s     zGraph.dfs.<locals>.<listcomp>)r  r  T)vcountranger  	neighborsr   )
r   Zvidr  nvaddedstackZvidsparentsr(  Zneighborr   r   r   dfs  s(    






z	Graph.dfsc                 C   s"   t | |}|r| j|ddS |S )a  Calculates a minimum spanning tree for a graph.

        @param weights: a vector containing weights for every edge in
          the graph. C{None} means that the graph is unweighted.
        @param return_tree: whether to return the minimum spanning tree (when
          C{return_tree} is C{True}) or to return the IDs of the edges in
          the minimum spanning tree instead (when C{return_tree} is C{False}).
          The default is C{True} for historical reasons as this argument was
          introduced in igraph 0.6.
        @return: the spanning tree as a L{Graph} object if C{return_tree}
          is C{True} or the IDs of the edges that constitute the spanning
          tree if C{return_tree} is C{False}.

        @newfield ref: Reference
        @ref: Prim, R.C.: I{Shortest connection networks and some
          generalizations}. Bell System Technical Journal 36:1389-1401, 1957.
        F)Zdelete_vertices)r   Z_spanning_treeZsubgraph_edges)r   weightsZreturn_treer  r   r   r   spanning_tree  s    zGraph.spanning_treec                 O   s   t tj| f||S )a  Calculates the dyad census of the graph.

        Dyad census means classifying each pair of vertices of a directed
        graph into three categories: mutual (there is an edge from I{a} to
        I{b} and also from I{b} to I{a}), asymmetric (there is an edge
        from I{a} to I{b} or from I{b} to I{a} but not the other way round)
        and null (there is no connection between I{a} and I{b}).

        @return: a L{DyadCensus} object.
        @newfield ref: Reference
        @ref: Holland, P.W. and Leinhardt, S.  (1970).  A Method for Detecting
          Structure in Sociometric Data.  American Journal of Sociology, 70,
          492-513.
        )r   r   dyad_censusr   r   r   r   r   r   r0  +  s    zGraph.dyad_censusc                 O   s   t tj| f||S )a{  Calculates the triad census of the graph.

        @return: a L{TriadCensus} object.
        @newfield ref: Reference
        @ref: Davis, J.A. and Leinhardt, S.  (1972).  The Structure of
          Positive Interpersonal Relations in Small Groups.  In:
          J. Berger (Ed.), Sociological Theories in Progress, Volume 2,
          218-251. Boston: Houghton Mifflin.
        )r   r   triad_censusr1  r   r   r   r2  <  s    
zGraph.triad_censusnanc                 C   s6   |dkrt | |S | j||d}t|tt| S )a  Calculates the average of the vertex transitivities of the graph.

        In the unweighted case, the transitivity measures the probability that
        two neighbors of a vertex are connected. In case of the average local
        transitivity, this probability is calculated for each vertex and then
        the average is taken. Vertices with less than two neighbors require
        special treatment, they will either be left out from the calculation
        or they will be considered as having zero transitivity, depending on
        the I{mode} parameter. The calculation is slightly more involved for
        weighted graphs; in this case, weights are taken into account according
        to the formula of Barrat et al (see the references).

        Note that this measure is different from the global transitivity
        measure (see L{transitivity_undirected()}) as it simply takes the
        average local transitivity across the whole network.

        @param mode: defines how to treat vertices with degree less than two.
          If C{TRANSITIVITY_ZERO} or C{"zero"}, these vertices will have zero
          transitivity. If C{TRANSITIVITY_NAN} or C{"nan"}, these vertices
          will be excluded from the average.
        @param weights: edge weights to be used. Can be a sequence or iterable
          or even an edge attribute name.

        @see: L{transitivity_undirected()}, L{transitivity_local_undirected()}
        @newfield ref: Reference
        @ref: Watts DJ and Strogatz S: I{Collective dynamics of small-world
          networks}. Nature 393(6884):440-442, 1998.
        @ref: Barrat A, Barthelemy M, Pastor-Satorras R and Vespignani A:
          I{The architecture of complex weighted networks}. PNAS 101, 3747 (2004).
          U{http://arxiv.org/abs/cond-mat/0311416}.
        N)r  r.  )r    transitivity_avglocal_undirectedZtransitivity_local_undirectedsumfloatr   )r   r  r.  Zxsr   r   r   r4  J  s     z&Graph.transitivity_avglocal_undirectedc                 C   s   |   S )N)Z_raw_pointerr  r   r   r   _as_parameter_r  s    zGraph._as_parameter_c                 C   s   |   dkS )zCReturns True if the graph has at least one vertex, False otherwise.r   )r&  r  r   r   r   __bool__w  s    zGraph.__bool__c                 C   sf   t |ttttfr| |fS t |tr,| |fS t |tr>| |fS t |trP| |fS t |trb| |fS t	S )zCoercion rules.

        This method is needed to allow the graph to react to additions
        with lists, tuples, integers, strings, vertices, edges and so on.
        )
r   r   tupler   r   r'   r   r   r   NotImplemented)r   otherr   r   r   
__coerce__{  s    



zGraph.__coerce__c                 O   s   | ||}|j | |S )zReconstructs a Graph object from Python's pickled format.

        This method is for internal use only, it should not be called
        directly.)__dict__update)clsattrsr   r   r  r   r   r   _reconstruct  s    
zGraph._reconstructc                 C   s   | j }i i i   }}}|  D ]}| | ||< q| j D ]}| j| ||< q:| j D ]}| j| ||< qX|  |  |  |||f}||| jfS )zSupport for pickling.)	r   
attributesr   Zattribute_namesr   r&  Zget_edgelistZis_directedr=  )r   constructorZgattrsZvattrsZeattrsattr
parametersr   r   r   
__reduce__  s     zGraph.__reduce__)r   N)Nr  r  )T)NT)r3  N)r   
__module____qualname____doc__r   Zclique_numberomegaZindependence_numberalphaZcorenessZshell_indexZarticulation_pointsZcut_verticesZbiconnected_componentsblocksZeigenvector_centralityZevcentZvertex_connectivityZvertex_disjoint_pathsZedge_connectivityZedge_disjoint_pathsZcohesionZadhesionr   Zshortest_pathsZshortest_paths_dijkstraZinduced_subgraphZsubgraphr   classmethodr   Zfrom_networkxr   Zto_networkxr   Zfrom_graph_toolr   Zto_graph_toolr   ZRead_DIMACSr   Zwrite_dimacsr   ZRead_GraphMLzr   Zwrite_graphmlzr   ZRead_Pickler   Zwrite_pickler   ZRead_Picklezr   Zwrite_picklezr   ZRead_Adjacencyr   Zwrite_adjacencyr   Z	write_svgr   ReadLoadr   writesaver   ZDictListr   Zto_dict_listr   Z	TupleListr   Zto_tuple_listr   ZListDictr   Zto_list_dictr   ZDictDictr   Zto_dict_dictr   Z	Adjacencyr   ZWeighted_Adjacencyr   Z	DataFramer   Zget_vertex_dataframer   Zget_edge_dataframer   Z	Bipartiter   Z	Incidencer   ZFull_Bipartiter   ZRandom_Bipartiter   ZGRGr   ZFormular  r   r  r	  propertyr   r   r;   Zadd_edger<   Z	add_edgesr=   Z
add_vertexr>   Zadd_verticesr?   Zdelete_edgesr@   clearrA   Zas_directedrB   Zas_undirected_operator_method_registryr
  r  r  r  r  r  r  r   r   r   r4   Zget_adjacencyr5   Zget_adjacency_sparser6   Zget_adjlistr7   Zget_incidencer8   Zget_inclistr   Zindegreer   Z	outdegreer   Zdegree_distributionr   Zpagerankrb   Zall_st_cutsrc   Zall_st_mincutsrd   Zgomory_hu_treere   Zmaxflowrf   Zmincutrg   Z	st_mincutr\   r_   Zclustersr]   Zcohesive_blocksr^   Zconnected_components
componentsrF   Zcommunity_fastgreedyrG   Zcommunity_infomaprH   Z#community_leading_eigenvector_naiverI   Zcommunity_leading_eigenvectorrJ   Zcommunity_label_propagationrK   Zcommunity_multilevelrL   Zcommunity_optimal_modularityrM   Zcommunity_edge_betweennessrN   Zcommunity_spinglassrO   Zcommunity_walktraprP   Zk_corerQ   Zcommunity_leidenrR   Z
modularityr   Zlayoutr   layout_autor   layout_sugiyama_graph_plotr   rC   Zmaximum_bipartite_matchingrD   Zbipartite_projectionrE   Zbipartite_projection_sizer9   Zcount_automorphisms_vf2r:   Zget_automorphisms_vf2r  r  r   r-  r/  r0  r2  r4  r7  r8  r<  rA  rF  r   __hash____classcell__r   r   r   r   r     s  <n
	


"
*

(

	r   Zlayout_)rV  rW  c                  C   s|   ddl } tjtjddjtj dtjtj| j	dddg}|D ]*}tj
tj|d	rDtj|  S qDtd
dS )zYReturns the folder that contains the C API headers of the Python
    interface of igraph.r   Nincludezpython{0}.{1}igraphz..srcZ_igraphzigraphmodule_api.hz>cannot find the header files of the Python interface of igraph)r\  ospathjoinsysprefixr   version_infodirname__file__existsabspath
ValueError)r\  r  r_  r   r   r   get_include  s    
ri  c                 O   s   t j| f||S )zLoads a graph from the given filename.

    This is just a convenience function, calls L{Graph.Read} directly.
    All arguments are passed unchanged to L{Graph.Read}

    @param filename: the name of the file to be loaded
    )r   rN  )filenamer   r   r   r   r   read  s    rk  c                 O   s   | j |f||S )a  Saves a graph to the given file.

    This is just a convenience function, calls L{Graph.write} directly.
    All arguments are passed unchanged to L{Graph.write}

    @param graph: the graph to be saved
    @param filename: the name of the file to be written
    )rP  )graphrj  r   r   r   r   r   rP    s    	rP  )tconfigrt   rj   rk   rw   rS   rY   rh   rW   r`   rl   rU   r   r   r   r   ra   rs   r   r   r   r   r   r   r   rm   r   rr   rn   ro   rv   ru   rp   r   r   r   r'   rT   rX   rV   r   r   rx   ry   r*   rZ   r+   default_arpack_optionsr   ri  r}   r|   r{   rz   r,   r-   r.   r   r   loadr   r   r   r   rq   r   r   rk  r   r   r   r   r~   rQ  r/   r0   r1   r[   r   r   rP  r   r   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r(   (  rI  __license__Zigraph._igraphr   r   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   rn  r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   Zigraph.adjacencyr4   r5   r6   r7   r8   Zigraph.automorphismsr9   r:   Zigraph.basicr;   r<   r=   r>   r?   r@   rA   rB   Zigraph.bipartiterC   rD   rE   Zigraph.communityrF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   Zigraph.clusteringrS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   Z
igraph.cutr`   ra   rb   rc   rd   re   rf   rg   Zigraph.configurationrh   ri   Zinit_configurationZigraph.drawingrj   rk   rl   rm   rn   ro   rp   rq   Zigraph.drawing.colorsrr   rs   rt   ru   rv   rw   rx   ry   rz   r{   r|   r}   r~   r   r   r   r   r   Zigraph.drawing.graphr   rX  Zigraph.drawing.utilsr   Zigraph.datatypesr   r   r   r   Zigraph.formular   Z	igraph.ior   Zigraph.io.filesr   r   r   r   r   r   r   r   r   r   r   r   Zigraph.io.objectsr   r   r   r   r   r   r   r   r   r   r   Zigraph.io.adjacencyr   r   Zigraph.io.librariesr   r   r   r   Zigraph.io.randomr   Zigraph.io.bipartiter   r   r   r   Zigraph.io.imagesr   Zigraph.layoutr   r   r   r   r   r   r   Zigraph.matchingr   Zigraph.operatorsr   r   r   r   rT  Z
igraph.seqr   r   r   Zigraph.statisticsr   r   r   r   r   r   r   r   Zigraph.structuralr   r   r   r   r   Zigraph.summaryr   r   Zigraph.utilsr   r   r   Zigraph.versionr   r   r^  ra  r   dirr  
startswithsetattrgetattrZlayout_fruchterman_reingoldZlayout_fruchterman_reingold_3dZlayout_kamada_kawaiZlayout_kamada_kawai_3dZlayout_randomZlayout_random_3dZlayout_gridZlayout_grid_3dZlayout_circleZlayout_sphereri  rk  ro  rP  rQ  rm  __all__r   r   r   r   <module>   s  4(
<<(
(
P84$	(
     &



	