ó ŸÃÒYc@skddlmZmZddlZdZddgZeddddƒZed„Z e e ed „Z dS( iÿÿÿÿ(tchaintcountNs%Aric Hagberg tadjacency_datatadjacency_graphtidtkeyc CsÄ|jƒ}|d}|s"d n|d}||krJtjdƒ‚ni}|jƒ|d<||d>> from networkx.readwrite import json_graph >>> G = nx.Graph([(1,2)]) >>> data = json_graph.adjacency_data(G) To serialize with json >>> import json >>> s = json.dumps(data) Notes ----- Graph, node, and link attributes will be written when using this format but attribute keys must be strings if you want to serialize the resulting data with JSON. The default value of attrs will be changed in a future release of NetworkX. See Also -------- adjacency_graph, node_link_data, tree_data RRsAttribute names are not unique.tdirectedt multigraphtgraphtnodest adjacencyN( t is_multigraphtNonetnxt NetworkXErrort is_directedtlistRtitemsR tappendtdictRR ( tGtattrsRtid_Rtdatatntnbrdicttadjtnbrtkeystktd((s}/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/readwrite/json_graph/adjacency.pyRs,2      6?/cCsÃ|jd|ƒ}|jd|ƒ}|r9tjƒ}n tjƒ}|rZ|jƒ}n|d}|spdn|d}t|jdgƒƒ|_g}x[|dD]O}|jƒ} | j |ƒ} |j | ƒ|j | ƒ|j | j | ƒq¦WxÃt|dƒD]±\} }|| } x˜|D]} | jƒ}|j |ƒ}|sv|j| |ƒ|| |j | ƒq'|j |dƒ}|j| |d|ƒ|| ||j | ƒq'Wq W|S( s$Return graph from adjacency data format. Parameters ---------- data : dict Adjacency list formatted graph data Returns ------- G : NetworkX graph A NetworkX graph object directed : bool If True, and direction not specified in data, return a directed graph. multigraph : bool If True, and multigraph not specified in data, return a multigraph. attrs : dict A dictionary that contains two keys 'id' and 'key'. The corresponding values provide the attribute names for storing NetworkX-internal graph data. The values should be unique. Default value: :samp:`dict(id='id', key='key')`. Examples -------- >>> from networkx.readwrite import json_graph >>> G = nx.Graph([(1,2)]) >>> data = json_graph.adjacency_data(G) >>> H = json_graph.adjacency_graph(data) Notes ----- The default value of attrs will be changed in a future release of NetworkX. See Also -------- adjacency_graph, node_link_data, tree_data RRRRRR R N(tgetR t MultiGraphtGrapht to_directedR RRtcopytpopRtadd_nodeR tupdatet enumeratetadd_edge(RRRRRRRtmappingRt node_datatnodetitsourcettdatat target_datattargettky((s}/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/readwrite/json_graph/adjacency.pyR[s:(        !( t itertoolsRRtnetworkxR t __author__t__all__Rt_attrsRtFalsetTrueR(((s}/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/readwrite/json_graph/adjacency.pyts    L