BFjњddlZddlZddlZddlZddlZddlmZddlZddlZ ddl m Z ddl m Z mZddlmZddlmZddlmZmZdd lmZGd d eZdS) N) defaultdict)IFrame) EnvironmentFileSystemLoader)Edge)Node)Options Configure) check_htmlcneZdZdZ dId Zd Zd ZdJdZdZdZ dZ dZ dZ dZ dZdKdZdLdZdMdZ dNdZdefdZdOdZd Zd!Zd"Zd#d$d%d&ddfd'Zd(Zd)Zd*Z dPd1Z dQd6Z dRd:Z dSd>Z dTd?Z!d@Z"dAZ#dBZ$dCZ%dUdDZ&dEZ'dFZ(dGZ)dHZ*dS)VNetworkz The Network class is the focus of this library. All viz functionality should be implemented off of a Network instance. To instantiate: >>> nt = Network() 600px100%F#ffffffNlocalc g|_g|_||_||_| |_d|_d|_| |_||_||_ d|_ d|_ t| |_ d|_g|_i|_d|_d|_||_||_||_| dvs Jdd|_t.jt2dz|_t7t9|j |_| d kr|d krt=d | |_|r| dSdS) a :param height: The height of the canvas :param width: The width of the canvas :param directed: Whether or not to use a directed graph. This is false by default. :param notebook: True if using jupyter notebook. :param select_menu: sets the option to highlight nodes and the neighborhood :param filter_menu: sets the option to filter nodes and edges based on attributes :param bgcolor: The background color of the canvas. :param cdn_resources: Where to pull resources for css and js files. Defaults to local. Options ['local','in_line','remote']. local: pull resources from local lib folder. in_line: insert lib resources as inline script tags. remote: pull resources from hash checked cdns. :font_color: The color of the node labels text :layout: Use hierarchical layout if this is set :type height: num or str :type width: num or str :type directed: bool :type notebook: bool :type select_menu: bool :type filter_menu: bool :type bgcolor: str :type font_color: str :type layout: bool :type cdn_resources: str rdotFN)rin_lineremotez.cdn_resources not in [local, in_line, remote]. template.htmlz /templates/loaderrTzWarning: When cdn_resources is 'local' jupyter notebook has issues displaying graphics on chrome/safari. Use cdn_resources='in_line' or cdn_resources='remote' if you have issues viewing graphics in a notebook.)!nodesedgesheightwidthheadinghtmlshape font_colordirectedbgcoloruse_DOTdot_langr optionswidgetnode_idsnode_maptemplateconfneighborhood_highlight select_menu filter_menupathosdirname__file__ template_dirrr templateEnvprint cdn_resources prep_notebook) selfrrr#notebookr-r.r/r$r"layoutrr7s ;C:\PYTHON\_runtimes\venv\Lib\site-packages\pyvis/network.py__init__zNetwork.__init__s]R       $     v      &<#&& >>>>@p>>># GOOH55 E&.>t?P.Q.QRRR G # #D(8(8 4 5 5 5+  !     ! !c ttj|j|j|j|j|jddS)z< override print to show readable graph data )NodesEdgesHeightWidthHeading)indent)strjsondumpsr)rrrrr9s r<__str__zNetwork.__str__jsR J!]!Z"k!Z#|       r>cd|j||S)Nz{} |N|={} |E|={:,})format __class__ num_nodes num_edgesrJs r<__repr__zNetwork.__repr__{s7#** NDNN,,dnn.>.>   r>r#97c2fcc vt|tst|tsJ|r|}n|}||jvr|d|vrt ||f||jd|}nt ||f|||jd|}|j|j|j||j|j |<dSdS)a This method adds a node to the network, given a mandatory node ID. Node labels default to node ids if no label is specified during the call. >>> nt = Network("500px", "500px") >>> nt.add_node(0, label="Node 0") >>> nt.add_node(1, label="Node 1", color = "blue") :param n_id: The id of the node. The id is mandatory for nodes and they have to be unique. This should obviously be set per node, not globally. :param label: The label is the piece of text shown in or under the node, depending on the shape. :param borderWidth: The width of the border of the node. :param borderWidthSelected: The width of the border of the node when it is selected. When undefined, the borderWidth * 2 is used. :param brokenImage: When the shape is set to image or circularImage, this option can be an URL to a backup image in case the URL supplied in the image option cannot be resolved. :param group: When not undefined, the node will belong to the defined group. Styling information of that group will apply to this node. Node specific styling overrides group styling. :param hidden: When true, the node will not be shown. It will still be part of the physics simulation though! :param image: When the shape is set to image or circularImage, this option should be the URL to an image. If the image cannot be found, the brokenImage option can be used. :param labelHighlightBold: Determines whether or not the label becomes bold when the node is selected. :param level: When using the hierarchical layout, the level determines where the node is going to be positioned. :param mass: The barnesHut physics model (which is enabled by default) is based on an inverted gravity model. By increasing the mass of a node, you increase it's repulsion. Values lower than 1 are not recommended. :param physics: When false, the node is not part of the physics simulation. It will not move except for from manual dragging. :param shape: The shape defines what the node looks like. There are two types of nodes. One type has the label inside of it and the other type has the label underneath it. The types with the label inside of it are: ellipse, circle, database, box, text. The ones with the label outside of it are: image, circularImage, diamond, dot, star, triangle, triangleDown, square and icon. :param size: The size is used to determine the size of node shapes that do not have the label inside of them. These shapes are: image, circularImage, diamond, dot, star, triangle, triangleDown, square and icon. :param title: Title to be displayed when the user hovers over the node. The title can be an HTML element or a string containing plain text or HTML. :param value: When a value is set, the nodes will be scaled using the options in the scaling object defined above. :param x: This gives a node an initial x position. When using the hierarchical layout, either the x or y position is set by the layout engine depending on the type of view. The other value remains untouched. When using stabilization, the stabilized position may be different from the initial one. To lock the node to that position use the physics or fixed options. :param y: This gives a node an initial y position. When using the hierarchical layout,either the x or y position is set by the layout engine depending on the type of view. The other value remains untouched. When using stabilization, the stabilized position may be different from the initial one. To lock the node to that position use the physics or fixed options. :type n_id: str or int :type label: str or int :type borderWidth: num (optional) :type borderWidthSelected: num (optional) :type brokenImage: str (optional) :type group: str (optional) :type hidden: bool (optional) :type image: str (optional) :type labelHighlightBold: bool (optional) :type level: num (optional) :type mass: num (optional) :type physics: bool (optional) :type shape: str (optional) :type size: num (optional) :type title: str or html element (optional) :type value: num (optional) :type x: num (optional) :type y: num (optional) group)labelr")rUcolorr"N) isinstancerGintr)r r"rappendr'r*)r9n_idrUr!rVr' node_labelns r<add_nodezNetwork.add_nodesX$$$= 4(=(====  JJJ t} $ $'!!u^J4?^^V]^^ukJePTP_kkcjkk J  ai ( ( ( M  & & &"#)DM$    % $r>c ~gd}|D]}||vsJd|zdztt}tt|D]}|D]|\}}t|t|ks.Jd|dt|dt|d||||||i}|D]X} t |}|j|fi||'#t|tsJ|j|fi||YVxYwdS) a This method adds multiple nodes to the network from a list. Default behavior uses values of 'nodes' for node ID and node label properties. You can also specify other lists of properties to go along each node. Example: >>> g = net.Network() >>> g.add_nodes([1, 2, 3], size=[2, 4, 6], title=["n1", "n2", "n3"]) >>> g.nodes >>> [{'id': 1, 'label': 1, 'shape': 'dot', 'size': 2, 'title': 'n1'}, Output: >>> {'id': 2, 'label': 2, 'shape': 'dot', 'size': 4, 'title': 'n2'}, >>> {'id': 3, 'label': 3, 'shape': 'dot', 'size': 6, 'title': 'n3'}] :param nodes: A list of nodes. :type nodes: list )sizevaluetitlexyrUrVr!z invalid arg ''z keyword arg z [length z] does not match[length z ] of nodesN) rdictrangelenitemsupdaterXr]rWrG) r9rkwargs valid_argskndivnodes r< add_nodeszNetwork.add_nodess0111  > >A ???Oa$7#$=????   s5zz"" / /A  / /1A#e**,,,,qq#a&&&&#e****-,, 58 ##Q!I.... / 0 0D 04yy d//bh//// 0!$,,,,, d//bh///// 0 0s '#D  -D:c*t|jS)zK Return number of nodes :returns: :py:class:`int` )rgr)rJs r<rOzNetwork.num_nodes-s 4=!!!r>c*t|jS)zK Return number of edges :returns: :py:class:`int` )rgrrJs r<rPzNetwork.num_edges5s 4:r>c d}||vsJdt|zdz||vsJdt|zdz|js4|jD],}|d}|d}||kr||ks ||kr||krd}-|s5t |||jfi|}|j|jdSdS)a Adding edges is done based off of the IDs of the nodes. Order does not matter unless dealing with a directed graph. >>> nt.add_edge(0, 1) # adds an edge from node ID 0 to node ID >>> nt.add_edge(0, 1, value = 4) # adds an edge with a width of 4 :param arrowStrikethrough: When false, the edge stops at the arrow. This can be useful if you have thick lines and you want the arrow to end in a point. Middle arrows are not affected by this. :param from: Edges are between two nodes, one to and one from. This is where you define the from node. You have to supply the corresponding node ID. This naturally only applies to individual edges. :param hidden: When true, the edge is not drawn. It is part still part of the physics simulation however! :param physics: When true, the edge is part of the physics simulation. When false, it will not act as a spring. :param title: The title is shown in a pop-up when the mouse moves over the edge. :param to: Edges are between two nodes, one to and one from. This is where you define the to node. You have to supply the corresponding node ID. This naturally only applies to individual edges. :param value: When a value is set, the edges' width will be scaled using the options in the scaling object defined above. :param width: The width of the edge. If value is set, this is not used. :type arrowStrikethrough: bool :type from: str or num :type hidden: bool :type physics: bool :type title: str :type to: str or num :type value: num :type width: num Fznon existent node 'rdfromtoTN) get_nodesrGr#rrrYr')r9sourcervr' edge_existsefrmdests r<add_edgezNetwork.add_edge=sb ))))) !CKK /# 5*))T^^%%%%% !CGG +c 1&%%} 'Z ' 'iw4B#II32::#'K )VR::'::A J  ai ( ( ( ( ( ) )r>c|D]b}t|dkr+||d|d|d@||d|dcdS)a This method serves to add multiple edges between existing nodes in the network instance. Adding of the edges is done based off of the IDs of the nodes. Order does not matter unless dealing with a directed graph. :param edges: A list of tuples, each tuple consists of source of edge, edge destination and and optional width. :type arrowStrikethrough: list of tuples rr)rN)rgr})r9redges r< add_edgeszNetwork.add_edgessr 0 0D4yyA~~ d1gtAwd1g >>>> d1gtAw////  0 0r>ct|jtr8|j|j|j|j|jtj |jfS|j|j|j|j|j|j fS)a] Extract relevant information about this network in order to inject into a Jinja2 template. Returns: nodes (list), edges (list), height ( string), width (string), options (object) Usage: >>> nodes, edges, heading, height, width, options = net.get_network_data() ) rWr'rerrrrrrHrIto_jsonrJs r<get_network_datazNetwork.get_network_datasx dlD ) ) 8J DL$+J 4< 8 8: :J DL$+J 4 4 6 68 8r>cNt|||dS)z Save the graph as html in the current directory with name. :param name: the name of the html file to save as :type name: str N)r write_html)r9names r< save_graphzNetwork.save_graphs* 4 r> index.htmlTcvt|d}|jD]#}|dd}|r d|vr d}n$|s |j|j}n|j}|\}} } } } } t|j tr/d|j vr#d|j dvr|j dd}nd}n|j j j }| | | || | | ||j|j|j|j|j||j|j|j||j|_|jS) z This method gets the data structures supporting the nodes, edges, and options and updates the template to write the HTML holding the visualization. :type name_html: str FraNhrefTphysicsenabled)rrrrrr'physics_enabledr%r&r(r$r, tooltip_linkr-r.r/r:r7)r rgetr5 get_templater0r+rrWr'rerrrenderr%r&r(r$r,r-r.r/r7r )r9rrr:use_link_templater\rar+rrrrrr'rs r< generate_htmlzNetwork.generate_htmlss 4!  AEE'4((E U?? )-%E %'44TY??HH}H8<8M8M8O8O5ugvug dlD ) ) ;DL((Y$,y:Q-Q-Q"&,y"9)"D"&"l2:OOO6*/*/*/,3,34C,0L-1]+/;,0L)-1B;?;V040@040@-5262D#$&& &yr>c|}t||||_|jdkrtjdst jdtjds:tj tj tddtjt j dzs:tj tj tddtjt j d zs:tj tj td d t|d 5}||jd d d n #1swxYwYnZ|jdks |jdkrCt|d 5}||jd d d n #1swxYwYn |rtj |d Sd S)a This method gets the data structures supporting the nodes, edges, and options and updates the template to write the HTML holding the visualization. To work with the old local methods local is being depricated, but not removed. :type name_html: str @param name: name of the file to save the graph as. @param local: Depricated parameter. Used to be used to determine how the graph needs deploy. Has been removed in favor of using the class cdn_resources instead. @param notebook: If true, this object will return the iframe document for use in juptyer notebook. @param open_browser: If true, will open a web browser with the generated graph. )r:rlibz lib/bindingsz/templates/lib/bindingsz/lib/tom-selectz/templates/lib/tom-selectzlib/tom-selectz/lib/vis-9.1.2z/templates/lib/vis-9.1.2z lib/vis-9.1.2zw+Nrr)r rr r7r1r0existsmakedirsshutilcopytreer2r3getcwdopenwrite webbrowser)r9rrr: open_browser getcwd_nameouts r<rzNetwork.write_htmlsu ;&&&99   ( (7>>%(( # E"""7>>.11 g27??8#<#< U U UWefff7>>")++.?"?@@ k27??8#<#< W W WYijjj7>>")++.>">?? i27??8#<#< V V VXghhhk4(( %C $)$$$ % % % % % % % % % % % % % % %  9 , ,0Bh0N0Nk4(( %C $)$$$ % % % % % % % % % % % % % % % K  ) OK ( ( ( ( ( ) )s$/GGGH//H36H3ct||r||ddn||d|rt||j|jSdS)z Writes a static HTML file and saves it locally before opening. :param: name: the name of the html file to save as :type name: str FT)rr:)r)rrN)r6rrrr)r9rrr:s r<showz Network.showsv d  5 OODudO C C C C OODtO 4 4 4  F$djEEE E F Fr>c|r|r|||j|j|_dS)a~ Loads the template data into the template attribute of the network. This should be done in a jupyter notebook environment before showing the network. Example: >>> net.prep_notebook() >>> net.show("nb.html") :param path: the relative path pointing to a template html file :type path: string N) set_templater5rr0r+)r9custom_templatecustom_template_paths r<r8zNetwork.prep_notebook(sI  43 4   2 3 3 3(55di@@ r>path_to_templatec|d}|d|dddz|ddS)a Path to full template assumes that it exists inside of a template directory. Use `set_template_dir` to set the relative template path to the template directory along with the directory location itself to change both values otherwise this function will infer the results. :path_to_template path: full os path string value of the template directory /N)splitset_template_dirjoin)r9r str_partss r<rzNetwork.set_template=sP%**3//  chhy"~66rcp||_||_tt|j|_dS)a Path to template directory along with the location of the template file. :template_directory path: template directory :template_file path: name of the template file that is going to be used to generate the html doc. rN)r0r4rrr5)r9template_directory template_files r<rzNetwork.set_template_dirGs8" .&.>t?P.Q.QRRRr>cd|_t|d}t|}d||_|jdd|_dS)a This method takes the contents of .DOT file and converts it to a PyVis visualization. Assuming the contents of test.dot contains: digraph sample3 { A -> {B ; C ; D} C -> {B ; A} } Usage: >>> nt.Network("500px", "500px") >>> nt.from_DOT("test.dot") >>> nt.show("dot.html") :param dot: The path of the dotfile being converted. :type dot: .dot file Tr "z\"N)r%rrGreadr splitlinesr&replace)r9rfiless r<from_DOTzNetwork.from_DOTRse* C~~   00  --c599 r>ci}|jD]}t||d<|jr6|jD]-}|d}|d}|||.nd|jD]\}|d}|d}|||vr@|||vr6||||||]|S)z This method returns the user an adjacency list representation of the network. :returns: dictionary mapping of Node ID to list of Node IDs it is connected to. idrurv)rsetr#radd)r9a_listrnrzrxr|s r< get_adj_listzNetwork.get_adj_listms $ $A!eeF1T7OO = -Z ) )6wv""4(((( ) Z - -6wvf~--&t 2L2L6N&&t,,,4L$$V,,, r>ct|ts/t|tsJdt|z||jvs Jd|z||S)z Given a node id, return the set of neighbors of this particular node. :param node: The node to get the neighbors from :type node: str or int :returns: set z.error: expected int or str for node but got %szerror: %s node not in network)rWrGrXtyper)r)r9rps r< neighborszNetwork.neighborss4%% QD#)>)> Q QCd4jjP Q Q> %%%(G$(N%%%  ""4((r>c|SNrbs r<zNetwork.sAr>c|Srrrs r<rzNetwork.s^_r> rct|tjsJ|d}|d} t |dkr|D]} d| | dvr|| | dd<t|| | dd| | dd<d| | dvr|| | dd<t|| | dd| | dd<|j| dfi| | d|j| dfi| | dd| dvs d| dvrr|rd} nd} d | dvr || dd <|| dd | d| <| d d | d| <|j | d| dfi| dtj |D]=} d| | vr || | d<|j| fi| | >d S) a This method takes an exisitng Networkx graph and translates it to a PyVis graph format that can be accepted by the VisJs API in the Jinja2 template. This operation is done in place. :param nx_graph: The Networkx graph object that is to be translated. :type nx_graph: networkx.Graph instance :param node_size_transf: function to transform the node size for plotting :type node_size_transf: func :param edge_weight_transf: function to transform the edge weight for plotting :type edge_weight_transf: func :param default_node_size: default node size if not specified :param default_edge_weight: default edge weight if not specified >>> nx_graph = nx.cycle_graph(10) >>> nx_graph.nodes[1]['title'] = 'Number 1' >>> nx_graph.nodes[1]['group'] = 1 >>> nx_graph.nodes[3]['title'] = 'I belong to a different group!' >>> nx_graph.nodes[3]['group'] = 10 >>> nx_graph.add_node(20, size=20, title='couple', group=2) >>> nx_graph.add_node(21, size=15, title='couple', group=2) >>> nx_graph.add_edge(20, 21, weight=5) >>> nx_graph.add_node(25, size=25, label='lonely', title='lonely node', group=3) >>> nt = Network("500px", "500px") # populates the nodes and edges data structures >>> nt.from_nx(nx_graph) >>> nt.show("nx.html") T)datarr_rr`rrweightN) rWnxGraphrrrgkeysrXr]popr}isolates) r9nx_graphnode_size_transfedge_weight_transfdefault_node_sizedefault_edge_weightshow_edge_weights edge_scalingrrrz width_typerps r<from_nxzNetwork.from_nxs:(BH--..-nnDn))nnDn)) u::>> 2 2qt!1!1!3!333(9E!A$K'$'(8(8qtV9L(M(M$N$Nad F#qt!1!1!3!333(9E!A$K'$'(8(8qtV9L(M(M$N$Nad F# ad22eAaDk222 ad22eAaDk222!A$&&'1*=*=#-%, %, qtyy{{22)<!X'9'9!A$x.'I'IAaD$'(txx'9'9AaD$ adAaD11AaD1111K)) / /DU4[--////&7d F# DM$ . .%+ . . . . / /r>c|jS)zZ This method returns an iterable list of node ids :returns: list )r)rJs r<rwzNetwork.get_nodess }r>c|j|S)z Lookup node by ID and return it. :param n_id: The ID given to the node. :returns: dict containing node properties )r*)r9rZs r<get_nodezNetwork.get_nodes}T""r>c|jS)z^ This method returns an iterable list of edge objects :returns: list )rrJs r< get_edgeszNetwork.get_edgess zr>333333?MbP? ףp= ?rc\|jjtdS)a BarnesHut is a quadtree based gravity model. It is the fastest. default and recommended solver for non-hierarchical layouts. :param gravity: The more negative the gravity value is, the stronger the repulsion is. :param central_gravity: The gravity attractor to pull the entire network to the center. :param spring_length: The rest length of the edges :param spring_strength: The strong the edges springs are :param damping: A value ranging from 0 to 1 of how much of the velocity from the previous physics simulation iteration carries over to the next iteration. :param overlap: When larger than 0, the size of the node is taken into account. The distance will be calculated from the radius of the encompassing circle of the node for both the gravity model. Value 1 is maximum overlap avoidance. :type gravity: int :type central_gravity: float :type spring_length: int :type spring_strength: float :type damping: float :type overlap: float N)r'ruse_barnes_hutlocalsr9gravitycentral_gravity spring_lengthspring_strengthdampingoverlaps r< barnes_hutzNetwork.barnes_huts(D ++FHH55555r>d皙?皙?c\|jjtdS)ac Set the physics attribute of the entire network to repulsion. When called, it sets the solver attribute of physics to repulsion. :param node_distance: This is the range of influence for the repulsion. :param central_gravity: The gravity attractor to pull the entire network to the center. :param spring_length: The rest length of the edges :param spring_strength: The strong the edges springs are :param damping: A value ranging from 0 to 1 of how much of the velocity from the previous physics simulation iteration carries over to the next iteration. :type node_distance: int :type central_gravity float :type spring_length: int :type spring_strength: float :type damping: float N)r'r use_repulsionrr9 node_distancerrrrs r< repulsionzNetwork.repulsions'6 **68844444r>x{Gz?c\|jjtdS)aS This model is based on the repulsion solver but the levels are taken into account and the forces are normalized. :param node_distance: This is the range of influence for the repulsion. :param central_gravity: The gravity attractor to pull the entire network to the center. :param spring_length: The rest length of the edges :param spring_strength: The strong the edges springs are :param damping: A value ranging from 0 to 1 of how much of the velocity from the previous physics simulation iteration carries over to the next iteration. :type node_distance: int :type central_gravity float :type spring_length: int :type spring_strength: float :type damping: float N)r'ruse_hrepulsionrrs r< hrepulsionzNetwork.hrepulsion-s'6 ++FHH55555r>{Gz?皙?c\|jjtdS)a The forceAtlas2Based solver makes use of some of the equations provided by them and makes use of the barnesHut implementation in vis. The main differences are the central gravity model, which is here distance independent, and the repulsion being linear instead of quadratic. Finally, all node masses have a multiplier based on the amount of connected edges plus one. :param gravity: The more negative the gravity value is, the stronger the repulsion is. :param central_gravity: The gravity attractor to pull the entire network to the center. :param spring_length: The rest length of the edges :param spring_strength: The strong the edges springs are :param damping: A value ranging from 0 to 1 of how much of the velocity from the previous physics simulation iteration carries over to the next iteration. :param overlap: When larger than 0, the size of the node is taken into account. The distance will be calculated from the radius of the encompassing circle of the node for both the gravity model. Value 1 is maximum overlap avoidance. :type gravity: int :type central_gravity: float :type spring_length: int :type spring_strength: float :type damping: float :type overlap: float N)r'ruse_force_atlas_2basedrrs r<force_atlas_2basedzNetwork.force_atlas_2basedJs(L 33FHH=====r>c *tj|fd|i|S)N max_depth) jsonpickleencode)r9r argss r<rzNetwork.to_jsonrs  CCCdCCCr>c^d|jjj_||jjj_dS)a| Sets the smooth.type attribute of the edges. :param smooth_type: Possible options: 'dynamic', 'continuous', 'discrete', 'diagonalCross', 'straightCross', 'horizontal', 'vertical', 'curvedCW', 'curvedCCW', 'cubicBezier'. When using dynamic, the edges will have an invisible support node guiding the shape. This node is part of the physics simulation. Default is set to continous. :type smooth_type: string TN)r'rsmoothrr)r9 smooth_types r<set_edge_smoothzNetwork.set_edge_smoothus*-1 !))4 !&&&r>c(||jj_dS)z Displays or hides edges while dragging the network. This makes panning of the network easy. :param status: True if edges should be hidden on drag :type status: bool N)r' interactionhideEdgesOnDragr9statuss r<toggle_hide_edges_on_dragz!Network.toggle_hide_edges_on_drags4:  000r>c(||jj_dS)a Displays or hides nodes while dragging the network. This makes panning of the network easy. :param status: When set to True, the nodes will hide on drag. Default is set to False. :type status: bool N)r'rhideNodesOnDragrs r<toggle_hide_nodes_on_dragz!Network.toggle_hide_nodes_on_drags4:  000r>cD|jj|dS)z Edges take on the color of the node they are coming from. :param status: True if edges should adopt color coming from. :type status: bool N)r'rinherit_colorsrs r<inherit_edge_colorszNetwork.inherit_edge_colorss# ))&11111r>cXd|_td||j_d|_dS)a, Displays or hides certain widgets to dynamically modify the network. Usage: >>> g.show_buttons(filter_=['nodes', 'edges', 'physics']) Or to show all options: >>> g.show_buttons() :param status: When set to True, the widgets will be shown. Default is set to False. :param filter_: Only include widgets specified by `filter_`. Valid options: True (gives all widgets) List of `nodes`, `edges`, `layout`, `interaction`, `manipulation`, `physics`, `selection`, `renderer`. :type status: bool :type filter_: bool or list: T)rfilter_N)r,r r' configurer()r9rs r< show_buttonszNetwork.show_buttonss-. !*4!I!I!I  r>c(||jj_dS)a, Toggles physics simulation :param status: When False, nodes are not part of the physics simulation. They will not move except for from manual dragging. Default is set to True. :type status: bool N)r'rrrs r<toggle_physicszNetwork.toggle_physicss(. $$$r>c(||jj_dS)z Toggles the dragging of the nodes in the network. :param status: When set to True, the nodes can be dragged around in the network. Default is set to True. :type status: bool N)r'r dragNodesrs r<toggle_drag_nodeszNetwork.toggle_drag_nodess.4  ***r>cD|jj|dS)z Toggles the stablization of the network. :param status: Default is set to True. :type status: bool N)r'rtoggle_stabilizationrs r<r(zNetwork.toggle_stabilizations# 11&99999r>cD|j||_dS)aH Overrides the default options object passed to the VisJS framework. Delegates to the :meth:`options.Options.set` routine. :param options: The string representation of the Javascript-like object to be used to override default options. :type options: str N)r'r)r9r's r< set_optionszNetwork.set_optionss|''00 r>) rrFFFFFrFNrr)NrrR)rTF)TFF)TT)FN)r)rrrrrr)rrrrr)rrrrr)rrrrrr)rr)+__name__ __module__ __qualname____doc__r=rKrQr]rqrOrPr}rrrrrrr8rGrrrrrrrwrrrrrrrrrrrr!r#r&r(r*rr>r<rrsb (-"""!&K!K!K!K!Z   "   x,x,x,x,t101010f"""H)H)H)T000&888(::::x")")")")J F F F F CGAAAA*MSMMMM S S S S:::62 ) ) )3>+T_T_#%1PTch</</</</|###!"6"6"6"6L  5555>  6666>  &>&>&>&>PDDDD555$ : : : : : :2226 . . . 4 4 4::: 1 1 1 1 1r>r)rHr1rtempfiler collectionsrr networkxrIPython.displayrjinja2rrrrrpr r'r r utilsr objectrrr>r<r6s ######""""""00000000''''''''[1[1[1[1[1f[1[1[1[1[1r>