diff --git a/02_graph_widget/index.html b/02_graph_widget/index.html index a18fdfe..fbd77b5 100644 --- a/02_graph_widget/index.html +++ b/02_graph_widget/index.html @@ -84,6 +84,8 @@
  • node_styles_mapping: Union[callable, str]
  • +
  • edge_styles_mapping: Union[callable, str] +
  • edge_color_mapping: Union[callable, str]
  • node_scale_factor_mapping: Union[callable, str] @@ -152,6 +154,8 @@
  • def default_node_styles_mapping(index, node)
  • +
  • def default_edge_styles_mapping(index, edge) +
  • def default_edge_color_mapping(index, edge)
  • def default_node_scale_factor_mapping(index, node) @@ -934,6 +938,59 @@

    edge_styles_mapping: Union[callable, str]

    +

              Data dependent change of edge styles on a per edge basis.

    +

    def get_edge_styles_mapping()
    +          Getter for the edge styles mapping property.

    +

    Notes

    +

    If no mapping is explicitly set, default_edge_styles_mapping is returned.

    +

    Returns

    + + + + + + + + + + + + + + + +
    NameTypeDescription
    edge_styles_mappingUnion[callable, str]A function that produces edge styles or the name of the property to use for binding.
    +

    def set_edge_styles_mapping(edge_styles_mapping)
    +          Setter for the edge styles mapping property.

    +

    Parameters

    + + + + + + + + + + + + + + + +
    NameTypeDescription
    edge_styles_mappingUnion[callable, str]A function that produces edge styles or the name of the property to use for binding. The function should have the same signature as default_edge_styles_mapping e.g. take in a edge dictionary and return a string.
    +

    Example

    +
    In [1]: from yfiles_jupyter_graphs import GraphWidget
    +In [2]: w = GraphWidget()
    +In [3]: def custom_edge_styles_mapping(edge: dict):
    +         ...
    +In [4]: w.set_edge_styles_mapping(custom_edge_styles_mapping)
    +
    +

    def del_edge_styles_mapping()
    +          Deleter for the edge styles mapping property.

    +

    Remove a custom edge styles mapping.

    +

     

    edge_color_mapping: Union[callable, str]

              Data dependent change of edge color on a per edge basis.

    def get_edge_color_mapping()
    @@ -1814,6 +1871,8 @@

    def default_node_label_mapping(index, node)

    @@ -2004,11 +2063,88 @@

    can contain the following key-value-pairs: "color": str - css color value + CSS color value. "shape": str - possible values: 'ellipse', 'hexagon', 'hexagon2', 'octagon', 'pill', 'rectangle', 'round-rectangle' or 'triangle' + The shape of the node. Possible values: 'ellipse', 'hexagon', 'hexagon2', 'octagon', 'pill', 'rectangle', 'round-rectangle' or 'triangle'. "image": str - url or data URL of the image + Url or data URL of the image. + +

    References

    +

    css color value

    +

    Data URL

    +

     

    +

    def default_edge_styles_mapping(index, edge)

    +

              The default styles mapping for edges.

    +

    Provides constant value of {} for all edges.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    indexint(optional) Position in edges list.
    edgetyping.Dict
    +

    Notes

    +

    This is the default value for the edge_styles_mapping property.
    +Can be 'overwritten' by setting the property with a function of the same signature.

    +

    If the given mapping function has only one parameter (that is not typed as int), +then it will be called with the element (typing.Dict) as first parameter.

    +

    Example

    +
    In [1]: from yfiles_jupyter_graphs import GraphWidget
    +In [2]: w = GraphWidget()
    +In [3]: def custom_edge_styles_mapping(edge: typing.Dict):
    +          ...
    +In [4]: w.set_edge_styles_mapping(custom_edge_styles_mapping)
    +
    +

    Returns

    + + + + + + + + + + + + + + + +
    NameTypeDescription
    stylestyping.DictA Dict with mappings for style attributes. See below for supported values.
    +

    Supported style attributes in the return Dict:

    +
    can contain the following key-value-pairs:
    +    "color": str
    +        CSS color value.
    +    "directed": bool
    +        Whether the edge should be visualized with a target arrow.
    +    "thickness": float
    +        The thickness of the stroke of the edge.
    +    "dashStyle": str
    +        The dash styling of the edge. Can be one of the following strings:
    +            - "solid"
    +            - "dash"
    +            - "dot"
    +            - "dash-dot"
    +            - "dash-dot-dot"
    +            - "5 10"
    +            - "5, 10"
    +            - ...
     

    References

    css color value

    diff --git a/index.html b/index.html index 2acf8d4..df0a12f 100644 --- a/index.html +++ b/index.html @@ -242,5 +242,5 @@

    License

    diff --git a/search/search_index.json b/search/search_index.json index 723a12f..a70b38f 100644 --- a/search/search_index.json +++ b/search/search_index.json @@ -1 +1 @@ -{"config":{"indexing":"full","lang":["en"],"min_search_length":3,"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"yFiles Graphs for Jupyter A graph diagram visualization widget for Jupyter Notebooks and Labs powered by yFiles for HTML . yfiles-jupyter-graphs-for-neo4j For working with Neo4j databases, we built yfiles-jupyter-graphs-for-neo4j , an open-source extension on top of yfiles-jupyter-graphs . This extension provides an easier Python interface for the driver and allows direct configuration of data mappings depending on the label or type of the node or relationship. So if you are planning to use the extension with Neo4j databases, consider using yfiles-jupyter-graphs-for-neo4j . Supported Environments JupyterLab or Jupyter Notebook Visual Studio Code Google Colaboratory Google Vertex AI Workbench Google Dataproc Azure Machine Learning Studio Notebooks Amazon SageMaker Kaggle Just try it in your preferred platform for Jupyter notebooks Features See Node Neighborhood Choose Graph Layout Investigate Nodes or Edges Data Search for Nodes or Edges Import Graph Data Make Data Dependent Property Changes Define a Heatmap Background Use a Map Background Visualize nested data For example code look here . Code of Conduct This project and everyone participating in it is governed by the Code of Conduct . By participating, you are expected to uphold this code. Please report unacceptable behavior to contact@yworks.com . Feedback This widget is by no means perfect. If you find something is not working as expected we are glad to receive an issue report from you. Please make sure to search for existing issues first and check if the issue is not an unsupported feature or known issue. If you did not find anything related, report a new issue with necessary information. Please also provide a clear and descriptive title and stick to the issue templates. See issues . Dependencies @ctrl/tinycolor @jupyter-widgets/base @mdi/js Vue vue-json-viewer License See LICENSE file.","title":"yFiles Graphs for Jupyter"},{"location":"#yfiles-graphs-for-jupyter","text":"A graph diagram visualization widget for Jupyter Notebooks and Labs powered by yFiles for HTML .","title":"yFiles Graphs for Jupyter"},{"location":"#yfiles-jupyter-graphs-for-neo4j","text":"For working with Neo4j databases, we built yfiles-jupyter-graphs-for-neo4j , an open-source extension on top of yfiles-jupyter-graphs . This extension provides an easier Python interface for the driver and allows direct configuration of data mappings depending on the label or type of the node or relationship. So if you are planning to use the extension with Neo4j databases, consider using yfiles-jupyter-graphs-for-neo4j .","title":"yfiles-jupyter-graphs-for-neo4j"},{"location":"#supported-environments","text":"JupyterLab or Jupyter Notebook Visual Studio Code Google Colaboratory Google Vertex AI Workbench Google Dataproc Azure Machine Learning Studio Notebooks Amazon SageMaker Kaggle Just try it in your preferred platform for Jupyter notebooks","title":"Supported Environments"},{"location":"#features","text":"See Node Neighborhood Choose Graph Layout Investigate Nodes or Edges Data Search for Nodes or Edges Import Graph Data Make Data Dependent Property Changes Define a Heatmap Background Use a Map Background Visualize nested data For example code look here .","title":"Features"},{"location":"#code-of-conduct","text":"This project and everyone participating in it is governed by the Code of Conduct . By participating, you are expected to uphold this code. Please report unacceptable behavior to contact@yworks.com .","title":"Code of Conduct"},{"location":"#feedback","text":"This widget is by no means perfect. If you find something is not working as expected we are glad to receive an issue report from you. Please make sure to search for existing issues first and check if the issue is not an unsupported feature or known issue. If you did not find anything related, report a new issue with necessary information. Please also provide a clear and descriptive title and stick to the issue templates. See issues .","title":"Feedback"},{"location":"#dependencies","text":"@ctrl/tinycolor @jupyter-widgets/base @mdi/js Vue vue-json-viewer","title":"Dependencies"},{"location":"#license","text":"See LICENSE file.","title":"License"},{"location":"01_getting_started/","text":"Getting started Requirements python >= 3.6 jupyter notebook or lab ipywidgets >= 7.6.0 Installation If you already have Jupyter installed, just pip install the prebuilt extension from the Python Package Index . pip install yfiles_jupyter_graphs If you want to start clean and get a fresh new Jupyter Lab with the widget readily installed and available, you can use docker , too: Form a shell, create a docker image that contains all that is required: mkdir yfiles-jupyter && cd yfiles-jupyter echo -e \"FROM jupyter/scipy-notebook\\nRUN pip install yfiles-jupyter-graphs\" > Dockerfile docker build -t yfiles-jupyter-graphs-on-docker . (the above has been tested successfully with scipy-notebook:lab-3.4.7 and yfiles-jupyter-graphs==1.2.1 ), but we want to make sure that it will also work with upcoming versions - file an issue if it doesn't work for you!) You can then create a fresh new instance of your server from this image like so: docker run -it -p 8888:8888 --name yfiles-jupyter yfiles-jupyter-graphs-on-docker Usage In a notebook which has the wiget installed in the server, in a Python cell, you can then do this: Usage \"\"\"Execute in jupyter notebook or jupyter lab\"\"\" from yfiles_jupyter_graphs import GraphWidget # shows empty widget GraphWidget()","title":"Getting started"},{"location":"01_getting_started/#getting-started","text":"","title":"Getting started"},{"location":"01_getting_started/#requirements","text":"python >= 3.6 jupyter notebook or lab ipywidgets >= 7.6.0","title":"Requirements"},{"location":"01_getting_started/#installation","text":"If you already have Jupyter installed, just pip install the prebuilt extension from the Python Package Index . pip install yfiles_jupyter_graphs If you want to start clean and get a fresh new Jupyter Lab with the widget readily installed and available, you can use docker , too: Form a shell, create a docker image that contains all that is required: mkdir yfiles-jupyter && cd yfiles-jupyter echo -e \"FROM jupyter/scipy-notebook\\nRUN pip install yfiles-jupyter-graphs\" > Dockerfile docker build -t yfiles-jupyter-graphs-on-docker . (the above has been tested successfully with scipy-notebook:lab-3.4.7 and yfiles-jupyter-graphs==1.2.1 ), but we want to make sure that it will also work with upcoming versions - file an issue if it doesn't work for you!) You can then create a fresh new instance of your server from this image like so: docker run -it -p 8888:8888 --name yfiles-jupyter yfiles-jupyter-graphs-on-docker","title":"Installation"},{"location":"01_getting_started/#usage","text":"In a notebook which has the wiget installed in the server, in a Python cell, you can then do this:","title":"Usage"},{"location":"01_getting_started/#usage_1","text":"\"\"\"Execute in jupyter notebook or jupyter lab\"\"\" from yfiles_jupyter_graphs import GraphWidget # shows empty widget GraphWidget()","title":"Usage"},{"location":"02_graph_widget/","text":"GraphWidget Class Inherits from ipywidgets.DOMWidget The main widget class. To be used in jupyter-notebook or jupyter-lab. Example from yfiles_jupyter_graphs import GraphWidget w = GraphWidget() w.show() See notebooks for more examples. Notes Nodes and edges properties should be constructed recursively with basic python types otherwise {de-}serializers will fail. Properties nodes: typing.List[typing.Dict] Data structure. def get_nodes() Getter for the nodes traitlets property. Notes This function acts as an alias for using GraphWidget.nodes property e.g. w.nodes == w.get_nodes() . Returns Name Type Description nodes typing.List[typing.Dict] Each node has the keys id: int and properties: typing.Dict . It might include keys that are not set directly, see (default) node mappings for details. def set_nodes(nodes) Setter for the nodes traitlets property. Parameters Name Type Description nodes typing.List[typing.Dict] Each node should have the keys id: int and properties: typing.Dict . Properties should be constructed recursively with basic python types, otherwise {de-}serializers will fail. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: w.set_nodes([ {'id': 0, 'properties': {'label': 'Hello World'}}, {'id': 1, 'properties': {'label': 'This is a second node.'}} ]) Notes This function acts as an alias for using GraphWidget.nodes property e.g. w.nodes = [{...}] has the same effect as using w.set_nodes([{...}]) . edges: typing.List[typing.Dict] Data structure. def get_edges() Getter for the edges traitlets property. Notes This function acts as an alias for using GraphWidget.edges property e.g. w.edges == w.get_edges() is true . Returns Name Type Description edges typing.List[typing.Dict] Each edge has the keys id: int , start: int , end: int and properties: typing.Dict . It might include keys that are not set directly, see (default) edge mappings for details. def set_edges(edges) Setter for the edges traitlets property. Parameters Name Type Description edges typing.List[typing.Dict] Each edge should have the keys id: int , start: int , end:int and properties: typing.Dict . Ids for start and end should be among used node ids, otherwise the edge does not appear. Properties should be constructed recursively with basic python types, otherwise {de-}serializers will fail. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: w.set_edges([ {'id': 0, 'start': 0, 'end': 1, 'properties': {'label': 'edge between first and second node'}} ]) Notes This function acts as an alias for using GraphWidget.edges property e.g. w.edges = [{...}] has the same effect as using w.set_edges([{...}]) . def get_selection() Returns the nodes and edges, that are selected in the displayed widget. Returns Name Type Description nodes typing.List[typing.Dict] List of selected nodes. edges typing.List[typing.Dict] List of selected edges. directed: bool Graph wide flag for edge type. def get_directed() Getter for the directed traitlets property. Notes This function acts as an alias for using GraphWidget.directed property e.g. w.directed == w.get_directed() is true . Returns Name Type Description directed bool Whether the graph is interpreted as directed. def set_directed(directed) Setter for the directed traitlets property. Parameters Name Type Description directed bool Whether the graph is interpreted as directed. Notes This function acts as an alias for using GraphWidget.directed property e.g. w.directed = x has the same effect as using w.set_directed(x) . graph_layout: typing.Dict Choose an algorithm for positioning nodes and/or edges. def get_graph_layout() Getter for the graph layout traitlet property. Notes This function acts as an alias for using GraphWidget.graph_layout property e.g. w.graph_layout == w.get_graph_layout() is true . Returns Name Type Description graph_layout typing.Dict Returned dict has keys algorithm: str and options: dict, however options are empty because the algorithms use default settings from yFiles library. def set_graph_layout(algorithm) Choose graph layout. Currently the algorithms use default settings from yFiles library. Parameters Name Type Description algorithm str Specify graph layout (or edge router) algorithm. Available algorithms are: [\"circular\", \"circular_straight_line\", \"hierarchic\", \"organic\", \"interactive_organic\", \"orthogonal\", \"radial\", \"tree\", \"map\", \"orthogonal_edge_router\", \"organic_edge_router\"] Notes This function acts as an alias for using GraphWidget.graph_layout property e.g. w.graph_layout = 'organic' has the same effect as using w.set_graph_layout('organic') . Setting w.graph_layout = {'algorithm': 'organic', 'options': {}} works as well, which corresponds to using value given through the associated getter. In case you want to use the edge routers you should set a custom node position mapping as well. See yFiles docs for more details about the algorithms. neighborhood: typing.Dict Control neighborhood view component. def get_neighborhood() Getter for the neighborhood traitlets property. Returns Name Type Description neighborhood typing.Dict Returned dict has keys max_distance: int and selected_nodes: list, a list of node ids. def set_neighborhood(max_distance, selected_nodes) Specify the neighborhood view in the widget. The number of hops and focused nodes can be chosen. Parameters Name Type Description max_distance int Set the maximum distance between selected and included nodes. If there are multiple paths to one (or multiple) selected nodes, the smallest path length is considered for this threshold. selected_nodes typing.List (optional) Choose a list of node ids that are highlighted in both main and neighborhood component. They act as starting points for neighborhood calculation. Notes This function acts as an alias for using GraphWidget.neighborhood property. You can assign values by w.neighborhood = {'max_distance': 2, 'selected_nodes':[2]} or w.set_neighborhood(2, [2]) , both are equivalent. The short form w.neighborhood = 3 sets only the max_distance variable and resets the selected nodes. sidebar: typing.Dict Control sidebar component. def get_sidebar() Getter for the sidebar traitlets property. Returns Name Type Description sidebar typing.Dict Returned dict has keys enabled: bool and start_with: str, whereat first one indicates open or closed sidebar and second one indicates start panel on widget show. def set_sidebar(enabled, start_with) Specify the appearance of the sidebar in the widget. Can be used to collapse sidebar or start with any panel. Parameters Name Type Description enabled bool Whether to open or collapse sidebar at widget startup. start_with str The start panel identifier. Available are 'Neighborhood', 'Data', 'Search' and 'About' (the default). Notes This function acts as an alias for using GraphWidget.sidebar property. You can assign values by w.sidebar = {'enabled': True, 'start_with': 'Search'} or w.set_sidebar(True, 'Search') , both are equivalent. The short form w.sidebar = True sets only the enabled variable and resets the start_with back to the default. overview: bool Control overview component. def get_overview() Getter for the overview traitlets property. Returns Name Type Description overview bool Indicates open or closed overview state. A value of None means that a specific behaviour based on widget layout is followed. def set_overview(enabled) Specify the appearance of the overview component in the widget. Can be used to force open overview in case of a small widget layout or force collapsed overview in case of large widget layout. Parameters Name Type Description enabled bool Whether to open or collapse overview at widget startup. node_label_mapping: Union[callable, str] Data dependent change of node label on a per node basis. def get_node_label_mapping() Getter for the node label mapping property. Notes If no mapping is explicitly set, default_node_label_mapping is returned. Returns Name Type Description node_label_mapping Union[callable, str] A function that produces node labels or the name of the property to use for binding. def set_node_label_mapping(node_label_mapping) Setter for the node label mapping property. Parameters Name Type Description node_label_mapping Union[callable, str] A function that produces node labels or the name of the property to use for binding. The function should have the same signature as default_node_label_mapping e.g. take in a node dictionary and return a string. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: w.node_label_mapping = 'id' In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_label_mapping(node: dict): ... In [4]: w.set_node_label_mapping(custom_node_label_mapping) def del_node_label_mapping() Deleter for the name property. Remove a custom node label mapping. edge_label_mapping: Union[callable, str] Data dependent change of edge label on a per edge basis. def get_edge_label_mapping() Getter for the edge label mapping property. Notes If no mapping is explicitly set, default_edge_label_mapping is returned. Returns Name Type Description edge_label_mapping Union[callable, str] A function that produces edge labels or the name of the property to use for binding. def set_edge_label_mapping(edge_label_mapping) Setter for the edge label mapping property. Parameters Name Type Description edge_label_mapping Union[callable, str] A function that produces edge labels or the name of the property to use for binding. The funtion should have the same signature as default_edge_label_mapping e.g. take in an edge dictionary and return a string. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: w.edge_label_mapping = 'id' In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_label_mapping(node: dict): ... In [4]: w.set_edge_label_mapping(custom_edge_label_mapping) def del_edge_label_mapping() Deleter for the edge label mapping property. Remove a custom edge label mapping. node_property_mapping: Union[callable, str] Data dependent change of node properties on a per node basis. def get_node_property_mapping() Getter for the node property mapping property. Notes If no mapping is explicitly set, default_node_property_mapping is returned. Returns Name Type Description node_property_mapping Union[callable, str] A function that produces node properties or the name of the property to use for binding. def set_node_property_mapping(node_property_mapping) Setter for the node property mapping property. Parameters Name Type Description node_property_mapping Union[callable, str] A function that produces node properties or the name of the property to use for binding. The function should have the same signature as default_node_property_mapping e.g. take in a node dictionary and return a dictionary. Notes Properties are changed inplace by this mapping. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_property_mapping(node: dict): ... In [4]: w.set_node_property_mapping(custom_node_property_mapping) def del_node_property_mapping() Deleter for the node property mapping property. Remove a custom node property mapping. edge_property_mapping: Union[callable, str] Data dependent change of edge properties on a per edge basis. def get_edge_property_mapping() Getter for the edge property mapping property. Notes If no mapping is explicitly set, default_edge_property_mapping is returned. Returns Name Type Description edge_property_mapping Union[callable, str] A function that produces edge properties or the name of the property to use for binding. def set_edge_property_mapping(edge_property_mapping) Setter for the edge property mapping property. Parameters Name Type Description edge_property_mapping Union[callable, str] A function that produces edge properties or the name of the property to use for binding. The function should have the same signature as default_edge_property_mapping e.g. take in an edge dictionary and return a dictionary. Notes Properties are changed inplace by this mapping. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_property_mapping(node: dict): ... In [4]: w.set_edge_property_mapping(custom_edge_property_mapping) def del_edge_property_mapping() Deleter for the edge property mapping property. Remove a custom edge property mapping. node_color_mapping: Union[callable, str] Data dependent change of node color on a per node basis. def get_node_color_mapping() Getter for the node color mapping property. Notes If no mapping is explicitly set, default_node_color_mapping is returned. Returns Name Type Description node_color_mapping Union[callable, str] A function that produces node colors or the name of the property to use for binding. def set_node_color_mapping(node_color_mapping) Setter for the node color mapping property. Parameters Name Type Description node_color_mapping Union[callable, str] A function that produces node colors or the name of the property to use for binding. The function should have the same signature as default_node_color_mapping e.g. take in a node dictionary and return a string. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_color_mapping(node: dict): ... In [4]: w.set_node_color_mapping(custom_node_color_mapping) def del_node_color_mapping() Deleter for the node color mapping property. Remove a custom node color mapping. node_styles_mapping: Union[callable, str] Data dependent change of node styles on a per node basis. def get_node_styles_mapping() Getter for the node styles mapping property. Notes If no mapping is explicitly set, default_node_styles_mapping is returned. Returns Name Type Description node_styles_mapping Union[callable, str] A function that produces node styles or the name of the property to use for binding. def set_node_styles_mapping(node_styles_mapping) Setter for the node styles mapping property. Parameters Name Type Description node_styles_mapping Union[callable, str] A function that produces node styles or the name of the property to use for binding. The function should have the same signature as default_node_styles_mapping e.g. take in a node dictionary and return a string. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_styles_mapping(node: dict): ... In [4]: w.set_node_styles_mapping(custom_node_styles_mapping) def del_node_styles_mapping() Deleter for the node styles mapping property. Remove a custom node styles mapping. edge_color_mapping: Union[callable, str] Data dependent change of edge color on a per edge basis. def get_edge_color_mapping() Getter for the edge color mapping property. Notes If no mapping is explicitly set, default_edge_color_mapping is returned. Returns Name Type Description edge_color_mapping Union[callable, str] A function that produces edge colors or the name of the property to use for binding. def set_edge_color_mapping(edge_color_mapping) Setter for the edge color mapping property. Parameters Name Type Description edge_color_mapping Union[callable, str] A function that produces edge colors or the name of the property to use for binding. The function should have the same signature as default_edge_color_mapping e.g. take in an edge dictionary and return a string. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_color_mapping(node: dict): ... In [4]: w.set_edge_color_mapping(custom_edge_color_mapping) def del_edge_color_mapping() Deleter for the edge color mapping property. Remove a custom edge color mapping. node_scale_factor_mapping: Union[callable, str] Data dependent change of node scale factor on a per node basis. def get_node_scale_factor_mapping() Getter for the node scale factor mapping property. Notes If no mapping is explicitly set, default_node_scale_factor_mapping is returned. Returns Name Type Description node_scale_factor_mapping Union[callable, str] A function that produces node scale factor or the name of the property to use for binding. def set_node_scale_factor_mapping(node_scale_factor_mapping) Setter for the node scale factor mapping property. Parameters Name Type Description node_scale_factor_mapping Union[callable, str] A function that produces node scale factors or the name of the property to use for binding. The function should have the same signature as default_node_scale_factor_mapping e.g. take in a node dictionary and return a positive float. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_scale_factor_mapping(node: dict): ... In [4]: w.set_node_scale_factor_mapping(custom_node_scale_factor_mapping) def del_node_scale_factor_mapping() Deleter for the node scale factor mapping property. Remove a custom node scale factor mapping. node_size_mapping: Union[callable, str] Data dependent change of node size on a per node basis. def get_node_size_mapping() Getter for the node size mapping property. Notes If no mapping is explicitly set, default_node_size_mapping is returned. Returns Name Type Description node_size_mapping Union[callable, str] A function that produces node sizes or the name of the property to use for binding. def set_node_size_mapping(node_size_mapping) Setter for the node size mapping property. A custom size mapping is only used if there is no custom node_layout mapping. If a custom node layout mapping and a custom size mapping is set, the node layout mapping always takes precedence. Parameters Name Type Description node_size_mapping Union[callable, str] A function that produces node sizes or the name of the property to use for binding. The function should have the same signature as default_node_size_mapping e.g. take in a node dictionary and return a positive float 2-tuple. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_size_mapping(node: dict): ... In [4]: w.set_node_size_mapping(custom_node_size_mapping) def del_node_size_mapping() Deleter for the node size mapping property. Remove a custom node size mapping. node_layout_mapping: Union[callable, str] Data dependent change of node layout on a per node basis. def get_node_layout_mapping() Getter for the node layout mapping property. Notes If no mapping is explicitly set, default_node_layout_mapping is returned. Node layouts combine node position and node size. The default node layout mapping is the currently set position and size mapping. If a custom size or position mapping is set using set_node_size_mapping or set_node_position_mapping , the default layout changes. If a custom node layout mapping and a custom size/position mapping is set, the layout mapping takes precedence. Returns Name Type Description node_layout_mapping Union[callable, str] A function that produces node layouts or the name of the property to use for binding. def set_node_layout_mapping(node_layout_mapping) Setter for the node layout mapping property. Parameters Name Type Description node_layout_mapping Union[callable, str] A function that produces node layouts or the name of the property to use for binding. The function should have the same signature as default_node_layout_mapping e.g. take in a node dictionary and return a positive float 4-tuple. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_layout_mapping(node: dict): ... In [4]: w.set_node_layout_mapping(custom_node_layout_mapping) def del_node_layout_mapping() Deleter for the node layout mapping property. Remove a custom node layout mapping. edge_thickness_factor_mapping: Union[callable, str] Data dependent change of edge thickness factor on a per edge basis. def get_edge_thickness_factor_mapping() Getter for the edge thickness factor mapping property. Notes If no mapping is explicitly set, default_edge_thickness_factor_mapping is returned. Returns Name Type Description edge_thickness_factor_mapping Union[callable, str] A function that produces edge thickness factors or the name of the property to use for binding. def set_edge_thickness_factor_mapping(edge_thickness_factor_mapping) Setter for the edge thickness factor mapping property. Parameters Name Type Description edge_thickness_factor_mapping Union[callable, str] A function that produces edge thickness factors or the name of the property to use for binding. The function should have the same signature as default_edge_thickness_factor_mapping e.g. take in an edge dictionary and return a positive float. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_thickness_factor_mapping(node: dict): ... In [4]: w.set_edge_thickness_factor_mapping(custom_edge_thickness_factor_mapping) def del_edge_thickness_factor_mapping() Deleter for the edge thickness factor mapping property. Remove a custom edge thickness factor mapping. node_type_mapping: Union[callable, str] Data dependent change of node type on a per node basis. def get_node_type_mapping() Getter for the node type mapping property. Notes If no mapping is explicitly set, default_node_type_mapping is returned. Returns Name Type Description node_type_mapping Union[callable, str] A function that produces node types or the name of the property to use for binding. def set_node_type_mapping(node_type_mapping) Setter for the node type mapping property. Parameters Name Type Description node_type_mapping Union[callable, str] A function that produces node types or the name of the property to use for binding. The function should have the same signature as default_node_type_mapping e.g. take in a node dictionary and return a bool/int/float or str value. Notes Node types give more information for some layout algorithms. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_type_mapping(node: dict): ... In [4]: w.set_node_type_mapping(custom_node_type_mapping) References Layout with Custom Node Types def del_node_type_mapping() Deleter for the node type mapping property. Remove a custom node type mapping. node_parent_mapping: Union[callable, str] Data dependent change of node parent on a per node basis. def get_node_parent_mapping() Getter for the node parent mapping property. Notes If no mapping is explicitly set, default_node_parent_mapping is returned. Returns Name parent Description node_parent_mapping Union[callable, str] A function that produces node parents or the name of the property to use for binding. def set_node_parent_mapping(node_parent_mapping) Setter for the node parent mapping property. Parameters Name parent Description node_parent_mapping Union[callable, str] A function that produces node parent ids or the name of the property to use for binding. The function should have the same signature as default_node_parent_mapping e.g. take in a node dictionary and return a bool/int/float or str value. Notes Given node parent ids create group nodes instead of regular nodes. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_parent_mapping(node: dict): ... In [4]: w.set_node_parent_mapping(custom_node_parent_mapping) def del_node_parent_mapping() Deleter for the node parent mapping property. Remove a custom node parent mapping. ### node_parent_group_mapping: Union[callable, str] Data dependent change of node parent group on a per node basis. def get_node_parent_group_mapping() Getter for the node parent group mapping property. Notes If no mapping is explicitly set, default_node_parent_group_mapping is returned. Returns Name Type Description node_parent_group_mapping Union[callable, str] A function that produces node parents or the name of the property to use for binding. def set_node_parent_group_mapping(node_parent_group_mapping) Setter for the node parent group mapping property. Parameters Name Type Description node_parent_group_mapping Union[callable, str] A function that produces node parents ids or the name of the property to use for binding. The function should have the same signature as default_node_parent_group_mapping e.g. take in a node dictionary and return a str/int/float or dict with a required label property. Notes For every returned parent group, a new group node is created. In contrast to node_parent_mapping this mapping does not require the group nodes to be part of the given node dataset. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_parent_group_mapping(node: dict): ... In [4]: w.set_node_parent_group_mapping(custom_node_parent_group_mapping) def del_node_parent_group_mapping() Deleter for the node parent group mapping property. Remove a custom node parent group mapping. node_position_mapping: Union[callable, str] Data dependent change of node position on a per node basis. def get_node_position_mapping() Getter for the node position mapping property. Notes If no mapping is explicitly set, default_node_position_mapping is returned. Returns Name Type Description node_position_mapping Union[callable, str] A function that produces node positions or the name of the property to use for binding. def set_node_position_mapping(node_position_mapping) Setter for the node position mapping property. A custom position mapping is only used if there is no custom node_layout mapping. If a custom node layout mapping and a custom position mapping is set, the node layout mapping takes precedence. Parameters Name Type Description node_position_mapping Union[callable, str] A function that produces node positions or the name of the property to use for binding. The function should have the same signature as default_node_position_mapping e.g. take in a node dictionary and return a float 2-tuple. Notes Only edge router algorithms consider node positions, all other algorithms calculate node positions themselves. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_position_mapping(node: dict): ... In [4]: w.set_node_position_mapping(custom_node_position_mapping) def del_node_position_mapping() Deleter for the node position mapping property. Remove a custom node position mapping. heat_mapping: Union[callable, str] Data dependent change of heat value on a per node and edge basis. def get_heat_mapping() Getter for the heat mapping property. Notes If no mapping is explicitly set, default_heat_mapping is returned. Returns Name Type Description heat_mapping Union[callable, str] A function that produces heat values or the name of the property to use for binding. def set_heat_mapping(heat_mapping) Setter for the heat mapping property. Parameters Name Type Description heat_mapping Union[callable, str] A function that produces heat values or the name of the property to use for binding. The function should have the same signature as default_heat_mapping e.g. take in a element dictionary and return a float. Notes This mapping is used for both edges and nodes Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_heat_mapping(element: dict): ... In [4]: w.set_heat_mapping(custom_heat_mapping) def del_heat_mapping() Deleter for the heat mapping property. Remove a custom heat mapping. node_coordinate_mapping: Union[callable, str] Data dependent change of node coordinate on a per node basis. def get_node_coordinate_mapping() Getter for the node coordinate mapping property. Notes If no mapping is explicitly set, default_node_coordinate_mapping is returned. Returns Name Type Description node_coordinate_mapping Union[callable, str] A function that produces node coordinates or the name of the property to use for binding. def set_node_coordinate_mapping(node_coordinate_mapping) Setter for the node coordinate mapping property. Parameters Name Type Description node_coordinate_mapping Union[callable, str] A function that produces node coordinates or the name of the property to use for binding. The function should have the same signature as default_node_coordinate_mapping e.g. take in a node dictionary and return a float 2-tuple. Notes Only the map layout consider node coordinates, all other algorithms ignore node coordinates. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_coordinate_mapping(node: dict): ... In [4]: w.set_node_coordinate_mapping(custom_node_coordinate_mapping) def del_node_coordinate_mapping() Deleter for the node coordinate mapping property. Remove a custom node coordinate mapping. directed_mapping: Union[callable, str] Data dependent change if an edge is directed or not. def get_directed_mapping() Getter for the directed mapping property. Notes If no mapping is explicitly set, default_directed_mapping is returned. Returns Name Type Description directed_mapping Union[callable, str] A function that produces edge directions or the name of the property to use for binding. def set_directed_mapping(directed_mapping) Setter for the directed mapping property. Parameters Name Type Description directed_mapping Union[callable, str] A function that produces edge directions or the name of the property to use for binding. The function should have the same signature as default_directed_mapping e.g. take in an edge dictionary and return a boolean value. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_directed_mapping(node: dict): ... In [4]: w.set_directed_mapping(custom_directed_mapping) def del_directed_mapping() Deleter for the directed mapping property. Remove a custom directed mapping. Methods def init (widget_layout = None, overview_enabled = None, context_start_with = '') GraphWidget constructor. Parameters Name Type Description widget_layout ipywidgets.Layout (optional) Can be used to specify general widget appearance through css attributes. See references for a link to their documentation and available keywords. overview_enabled bool (optional) Enable graph overview component. Default behaviour depends on cell width. context_start_with str (optional) Specify context tab name to start with that tab opened. Default behaviour is open with About dialog. Use None to start with closed sidebar. Available are Neighborhood , Data , Search and About . def show() Display widget in Jupyter. Same as using single object reference in cell directly. Notes Mappings will only be applied shortly before showing the widget. def import_graph(graph) Import a graph object defined in an external module. Sets the nodes , edges and directed traitlets properties with information extracted from the graph object. See graph importers for object specific transformation details. Parameters Name Type Description graph networkx.{Multi}{Di}Graph | graph_tool.Graph | igraph.Graph | pygraphviz.AGraph The graph data structure. Example In [1]: from networkx import florentine_families_graph In [2]: from yfiles_jupyter_graphs import GraphWidget In [3]: w = GraphWidget() In [4]: w.import_graph(florentine_families_graph()) Notes Some graph data structures have special attributes for labels, some don't. Same goes for other graph properties. This method and the underlying transformations should be seen as best effort to provide an easy way to input data into the widget. For more granular control use nodes and edges properties directly. def circular_layout() Alias for GraphWidget. graph_layout = \"circular\". See yFiles circular layout guide for more details about this specific algorithm. def circular_straight_line_layout() Alias for GraphWidget. graph_layout = \"circular_straight_line\". Similar to circular layout but with straight edge paths instead of bundled paths. See yFiles circular layout guide for more details about this specific algorithm. def hierarchic_layout() Alias for GraphWidget. graph_layout = \"hierarchic\". See yFiles hierarchic layout guide for more details about this specific algorithm. def organic_layout() Alias for GraphWidget. graph_layout = \"organic\". See yFiles organic layout guide for more details about this specific algorithm. def orthogonal_layout() Alias for GraphWidget. graph_layout = \"orthogonal\". See yFiles orthogonal layout guide for more details about this specific algorithm. def radial_layout() Alias for GraphWidget. graph_layout = \"radial\". See yFiles radial layout guide for more details about this specific algorithm. def tree_layout() Alias for GraphWidget. graph_layout = \"tree\". See yFiles tree layout guide for more details about this specific algorithm. def orthogonal_edge_router() Alias for GraphWidget. graph_layout = \"orthogonal_edge_router\". See yFiles orthogonal edge router guide for more details about this specific algorithm. def interactive_organic_layout() Alias for GraphWidget. graph_layout = \"interactive_organic_layout\". See yFiles interactive organic layout guide for more details about this specific algorithm. def organic_edge_router() Alias for GraphWidget. graph_layout = \"organic_edge_router\". See yFiles organic edge router guide for more details about this specific algorithm. def default_element_label_mapping(index, element) The default property mapping for graph elements. The default label mapping for graph elements. Element (dict) should have key properties which itself should be a dict. Then one of the following values (in descending priority) is used as label if the label is a string: - properties[\"label\"] - properties[\"yf_label\"] When importing a Neo4j graph, the following properties are values are used as labels (in descending priority): properties['name'] properties['title'] properties['label'] properties['description'] properties['caption'] properties['text'] Parameters Name Type Description index int (optional) Position in corresponding nodes or edges list. element typing.Dict Can be both node or edge. Notes This is the default value for the { node | edge }_label_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: w.{node|edge}_label_mapping = 'id' In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_element_label_mapping(element: typing.Dict): ... In [4]: w.set_{node|edge}_label_mapping(custom_element_label_mapping) Returns Name Type Description label str The node or edge label. label typing.Dict | A Dict` with mappings for style attributes. See below for supported values. Supported style attributes in the return Dict : can contain the following key-value-pairs: \"text\": str Is used as the label. \"fontSize\": number Sets the size of the font. \"color\": string Css color value for the text color. \"backgroundColor\": str Css color value for the background color. \"position\": 'center' | 'north' | 'east' | 'south' | 'west' The label position at the node. Applies only to node labels. \"maximumWidth\": number The maximum width of the label. By default, the label is clipped at the given size, or wrapped when \"wrapping\" is set. \"maximumHeight\": number The maximum height of the label. Clips the label at the given height. May be combined with \"wrapping\". \"wrapping\": 'character' | 'character_ellipsis' | 'none' | 'word' | 'word_ellipsis' Text wrapping for the label. Must be set in combination with \"maximumWidth\". \"textAlignment\": 'center' | 'left' | 'right' The horizontal text alignment when \"wrapping\" is enabled. def default_node_label_mapping(index, node) The default label mapping for nodes. See default_element_label_mapping . def default_edge_label_mapping(index, edge) The default label mapping for edges. See default_element_label_mapping . def default_element_property_mapping(index, element) The default property mapping for graph elements. Simply selects the properties value of element dictionary. Parameters Name Type Description index int (optional) Position in corresponding nodes or edges list. element typing.Dict Can be both node or edge. Notes This is the default value for the { node | edge }_property_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. When a string is provided as the function argument, the key will be searched for in both the properties dictionary and the element keys. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_element_property_mapping(element: typing.Dict): ... In [4]: w.set_{node|edge}_property_mapping(custom_element_property_mapping) Returns Name Type Description properties typing.Dict The node or edge properties. def default_node_property_mapping(index, node) The default property mapping for nodes. See default_element_property_mapping . def default_edge_property_mapping(index, edge) The default property mapping for edges. See default_element_property_mapping . def default_node_color_mapping(index, node) The default color mapping for nodes. Provides constant value of '#15afac' for all nodes. Parameters Name Type Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_color_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_color_mapping(node: typing.Dict): ... In [4]: w.set_node_color_mapping(custom_node_color_mapping) Returns Name Type Description color str CSS color value. References css color value yFiles docs Fill api def default_node_styles_mapping(index, node) The default styles mapping for nodes. Provides constant value of {} for all nodes. Parameters Name Type Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_styles_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_styles_mapping(node: typing.Dict): ... In [4]: w.set_node_styles_mapping(custom_node_styles_mapping) Returns Name Type Description styles typing.Dict A Dict with mappings for style attributes. See below for supported values. Supported style attributes in the return Dict : can contain the following key-value-pairs: \"color\": str css color value \"shape\": str possible values: 'ellipse', 'hexagon', 'hexagon2', 'octagon', 'pill', 'rectangle', 'round-rectangle' or 'triangle' \"image\": str url or data URL of the image References css color value Data URL def default_edge_color_mapping(index, edge) The default color mapping for edges. Provides constant value of '#15afac' for all edges. Parameters Name Type Description index int (optional) Position in edges list. edge typing.Dict Notes This is the default value for the edge_color_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_color_mapping(edge: typing.Dict): ... In [4]: w.set_edge_color_mapping(custom_edge_color_mapping) Returns Name Type Description color str CSS color value. References css color value yFiles docs Fill api def default_node_scale_factor_mapping(index, node) The default scale factor mapping for nodes. Provides constant value of 1.0 for all nodes. Parameters Name Type Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_scale_factor_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_scale_factor_mapping(node: typing.Dict): ... In [4]: w.set_node_scale_factor_mapping(custom_node_scale_factor_mapping) Returns Name Type Description node_scale_factor float Positive scale factor. def default_node_size_mapping(index, node) The default size mapping for nodes. Provides constant value of [55.0,55.0] for all nodes. Parameters Name Type Description index int Position in nodes list. node typing.Dict Notes This is the default value for the node_size_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_size_mapping(node: typing.Dict): ... In [4]: w.set_node_size_mapping(custom_node_size_mapping) Returns Name Type Description node_size float 2-tuple size in (width, height). def default_node_layout_mapping(index, node) The default layout mapping for nodes. Provides constant value of [0.00, 0.00, 55.0, 55.0] for all nodes. Parameters Name Type Description index int Position in nodes list. node typing.Dict Notes This is the default value for the node_layout_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_layout_mapping(node: typing.Dict): ... In [4]: w.set_node_layout_mapping(custom_node_layout_mapping) Returns Name Type Description node_layout float 4-tuple layout containin position and size: (x, y, width, height). def default_heat_mapping(index, node) The default heat mapping for nodes and edges. Provides constant value of None for all nodes and edges. Parameters Name Type Description index int Position in element list. element typing.Dict Notes This is the default value for the heat_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_heat_mapping(node: typing.Dict): ... In [4]: w.set_heat_mapping(custom_heat_mapping) Returns Name Type Description heat float The heat can be a number between 0 and 1. def default_edge_thickness_factor_mapping(index, edge) The default thickness factor mapping for edges. Provides constant value of 1.0 for all edges. Parameters Name Type Description index int (optional) Position in edges list. edge typing.Dict Notes This is the default value for the edge_thickness_factor_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_thickness_factor_mapping(edge: typing.Dict): ... In [4]: w.set_edge_thickness_factor_mapping(custom_edge_thickness_factor_mapping) Returns Name Type Description edge_thickness_factor float Positive thickness factor. def default_node_type_mapping(index, node) The default type mapping for nodes. Provides constant value of None for all nodes. Parameters Name Type Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_type_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_type_mapping(node: typing.Dict): ... In [4]: w.set_node_type_mapping(custom_node_type_mapping) Returns Name Type Description node_type None Node Type. def default_node_parent_mapping(index, node) The default parent mapping for nodes. Provides constant value of None for all nodes. Parameters Name parent Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_parent_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_parent_mapping(node: typing.Dict): ... In [4]: w.set_node_parent_mapping(custom_node_parent_mapping) Returns Name parent Description node_parent None Node parent Id. def default_node_parent_group_mapping(index, node) The default parent group mapping for nodes. Provides constant value of None for all nodes. Parameters Name parent Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_parent_group_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_parent_group_mapping(node: typing.Dict): ... In [4]: w.set_node_parent_group_mapping(custom_node_parent_group_mapping) Returns Name parent Description node_parent_group None Node parent label. def default_node_position_mapping(index, node) The default position mapping for nodes. Provides constant value of [0.0, 0.0] for all nodes. Parameters Name Type Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_position_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_position_mapping(node: typing.Dict): ... In [4]: w.set_node_position_mapping(custom_node_position_mapping) Returns Name Type Description node_position float 2-tuple Position in euclidian plane. def default_node_coordinate_mapping(index, node) The default coordinate mapping for nodes. Provides constant value of None for all nodes. There is no coordinate mapping unless explicitly set. Parameters Name Type Description index int (optional) position in nodes list. node typing.Dict Notes This is the default value for the node_coordinate_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_coordinate_mapping(node: typing.Dict): ... In [4]: w.set_node_coordinate_mapping(custom_node_coordinate_mapping) Returns Name Type Description node_coordinate float 2-tuple geo coordinates in latitude and longitude . def default_directed_mapping(index, edge) The default directed mapping for edges. Uses the graph wide directed attribute for all edges. Parameters Name Type Description index int (optional) Position in edges list. edge typing.Dict Notes This is the default value for the directed_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_directed_mapping(edge: typing.Dict): ... In [4]: w.set_directed_mapping(custom_directed_mapping) Returns Name Type Description directed bool Whether the edge is directed or not.","title":"GraphWidget"},{"location":"02_graph_widget/#graphwidget","text":"Class Inherits from ipywidgets.DOMWidget The main widget class. To be used in jupyter-notebook or jupyter-lab.","title":"GraphWidget"},{"location":"02_graph_widget/#example","text":"from yfiles_jupyter_graphs import GraphWidget w = GraphWidget() w.show() See notebooks for more examples.","title":"Example"},{"location":"02_graph_widget/#notes","text":"Nodes and edges properties should be constructed recursively with basic python types otherwise {de-}serializers will fail.","title":"Notes"},{"location":"02_graph_widget/#properties","text":"","title":"Properties"},{"location":"02_graph_widget/#nodes-typinglisttypingdict","text":"Data structure. def get_nodes() Getter for the nodes traitlets property. Notes This function acts as an alias for using GraphWidget.nodes property e.g. w.nodes == w.get_nodes() . Returns Name Type Description nodes typing.List[typing.Dict] Each node has the keys id: int and properties: typing.Dict . It might include keys that are not set directly, see (default) node mappings for details. def set_nodes(nodes) Setter for the nodes traitlets property. Parameters Name Type Description nodes typing.List[typing.Dict] Each node should have the keys id: int and properties: typing.Dict . Properties should be constructed recursively with basic python types, otherwise {de-}serializers will fail. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: w.set_nodes([ {'id': 0, 'properties': {'label': 'Hello World'}}, {'id': 1, 'properties': {'label': 'This is a second node.'}} ]) Notes This function acts as an alias for using GraphWidget.nodes property e.g. w.nodes = [{...}] has the same effect as using w.set_nodes([{...}]) .","title":"nodes: typing.List[typing.Dict]"},{"location":"02_graph_widget/#edges-typinglisttypingdict","text":"Data structure. def get_edges() Getter for the edges traitlets property. Notes This function acts as an alias for using GraphWidget.edges property e.g. w.edges == w.get_edges() is true . Returns Name Type Description edges typing.List[typing.Dict] Each edge has the keys id: int , start: int , end: int and properties: typing.Dict . It might include keys that are not set directly, see (default) edge mappings for details. def set_edges(edges) Setter for the edges traitlets property. Parameters Name Type Description edges typing.List[typing.Dict] Each edge should have the keys id: int , start: int , end:int and properties: typing.Dict . Ids for start and end should be among used node ids, otherwise the edge does not appear. Properties should be constructed recursively with basic python types, otherwise {de-}serializers will fail. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: w.set_edges([ {'id': 0, 'start': 0, 'end': 1, 'properties': {'label': 'edge between first and second node'}} ]) Notes This function acts as an alias for using GraphWidget.edges property e.g. w.edges = [{...}] has the same effect as using w.set_edges([{...}]) .","title":"edges: typing.List[typing.Dict]"},{"location":"02_graph_widget/#def-get_selection","text":"Returns the nodes and edges, that are selected in the displayed widget. Returns Name Type Description nodes typing.List[typing.Dict] List of selected nodes. edges typing.List[typing.Dict] List of selected edges.","title":"def get_selection()"},{"location":"02_graph_widget/#directed-bool","text":"Graph wide flag for edge type. def get_directed() Getter for the directed traitlets property. Notes This function acts as an alias for using GraphWidget.directed property e.g. w.directed == w.get_directed() is true . Returns Name Type Description directed bool Whether the graph is interpreted as directed. def set_directed(directed) Setter for the directed traitlets property. Parameters Name Type Description directed bool Whether the graph is interpreted as directed. Notes This function acts as an alias for using GraphWidget.directed property e.g. w.directed = x has the same effect as using w.set_directed(x) .","title":"directed: bool"},{"location":"02_graph_widget/#graph_layout-typingdict","text":"Choose an algorithm for positioning nodes and/or edges. def get_graph_layout() Getter for the graph layout traitlet property. Notes This function acts as an alias for using GraphWidget.graph_layout property e.g. w.graph_layout == w.get_graph_layout() is true . Returns Name Type Description graph_layout typing.Dict Returned dict has keys algorithm: str and options: dict, however options are empty because the algorithms use default settings from yFiles library. def set_graph_layout(algorithm) Choose graph layout. Currently the algorithms use default settings from yFiles library. Parameters Name Type Description algorithm str Specify graph layout (or edge router) algorithm. Available algorithms are: [\"circular\", \"circular_straight_line\", \"hierarchic\", \"organic\", \"interactive_organic\", \"orthogonal\", \"radial\", \"tree\", \"map\", \"orthogonal_edge_router\", \"organic_edge_router\"] Notes This function acts as an alias for using GraphWidget.graph_layout property e.g. w.graph_layout = 'organic' has the same effect as using w.set_graph_layout('organic') . Setting w.graph_layout = {'algorithm': 'organic', 'options': {}} works as well, which corresponds to using value given through the associated getter. In case you want to use the edge routers you should set a custom node position mapping as well. See yFiles docs for more details about the algorithms.","title":"graph_layout: typing.Dict"},{"location":"02_graph_widget/#neighborhood-typingdict","text":"Control neighborhood view component. def get_neighborhood() Getter for the neighborhood traitlets property. Returns Name Type Description neighborhood typing.Dict Returned dict has keys max_distance: int and selected_nodes: list, a list of node ids. def set_neighborhood(max_distance, selected_nodes) Specify the neighborhood view in the widget. The number of hops and focused nodes can be chosen. Parameters Name Type Description max_distance int Set the maximum distance between selected and included nodes. If there are multiple paths to one (or multiple) selected nodes, the smallest path length is considered for this threshold. selected_nodes typing.List (optional) Choose a list of node ids that are highlighted in both main and neighborhood component. They act as starting points for neighborhood calculation. Notes This function acts as an alias for using GraphWidget.neighborhood property. You can assign values by w.neighborhood = {'max_distance': 2, 'selected_nodes':[2]} or w.set_neighborhood(2, [2]) , both are equivalent. The short form w.neighborhood = 3 sets only the max_distance variable and resets the selected nodes.","title":"neighborhood: typing.Dict"},{"location":"02_graph_widget/#sidebar-typingdict","text":"Control sidebar component. def get_sidebar() Getter for the sidebar traitlets property. Returns Name Type Description sidebar typing.Dict Returned dict has keys enabled: bool and start_with: str, whereat first one indicates open or closed sidebar and second one indicates start panel on widget show. def set_sidebar(enabled, start_with) Specify the appearance of the sidebar in the widget. Can be used to collapse sidebar or start with any panel. Parameters Name Type Description enabled bool Whether to open or collapse sidebar at widget startup. start_with str The start panel identifier. Available are 'Neighborhood', 'Data', 'Search' and 'About' (the default). Notes This function acts as an alias for using GraphWidget.sidebar property. You can assign values by w.sidebar = {'enabled': True, 'start_with': 'Search'} or w.set_sidebar(True, 'Search') , both are equivalent. The short form w.sidebar = True sets only the enabled variable and resets the start_with back to the default.","title":"sidebar: typing.Dict"},{"location":"02_graph_widget/#overview-bool","text":"Control overview component. def get_overview() Getter for the overview traitlets property. Returns Name Type Description overview bool Indicates open or closed overview state. A value of None means that a specific behaviour based on widget layout is followed. def set_overview(enabled) Specify the appearance of the overview component in the widget. Can be used to force open overview in case of a small widget layout or force collapsed overview in case of large widget layout. Parameters Name Type Description enabled bool Whether to open or collapse overview at widget startup.","title":"overview: bool"},{"location":"02_graph_widget/#node_label_mapping-unioncallable-str","text":"Data dependent change of node label on a per node basis. def get_node_label_mapping() Getter for the node label mapping property. Notes If no mapping is explicitly set, default_node_label_mapping is returned. Returns Name Type Description node_label_mapping Union[callable, str] A function that produces node labels or the name of the property to use for binding. def set_node_label_mapping(node_label_mapping) Setter for the node label mapping property. Parameters Name Type Description node_label_mapping Union[callable, str] A function that produces node labels or the name of the property to use for binding. The function should have the same signature as default_node_label_mapping e.g. take in a node dictionary and return a string. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: w.node_label_mapping = 'id' In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_label_mapping(node: dict): ... In [4]: w.set_node_label_mapping(custom_node_label_mapping) def del_node_label_mapping() Deleter for the name property. Remove a custom node label mapping.","title":"node_label_mapping: Union[callable, str]"},{"location":"02_graph_widget/#edge_label_mapping-unioncallable-str","text":"Data dependent change of edge label on a per edge basis. def get_edge_label_mapping() Getter for the edge label mapping property. Notes If no mapping is explicitly set, default_edge_label_mapping is returned. Returns Name Type Description edge_label_mapping Union[callable, str] A function that produces edge labels or the name of the property to use for binding. def set_edge_label_mapping(edge_label_mapping) Setter for the edge label mapping property. Parameters Name Type Description edge_label_mapping Union[callable, str] A function that produces edge labels or the name of the property to use for binding. The funtion should have the same signature as default_edge_label_mapping e.g. take in an edge dictionary and return a string. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: w.edge_label_mapping = 'id' In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_label_mapping(node: dict): ... In [4]: w.set_edge_label_mapping(custom_edge_label_mapping) def del_edge_label_mapping() Deleter for the edge label mapping property. Remove a custom edge label mapping.","title":"edge_label_mapping: Union[callable, str]"},{"location":"02_graph_widget/#node_property_mapping-unioncallable-str","text":"Data dependent change of node properties on a per node basis. def get_node_property_mapping() Getter for the node property mapping property. Notes If no mapping is explicitly set, default_node_property_mapping is returned. Returns Name Type Description node_property_mapping Union[callable, str] A function that produces node properties or the name of the property to use for binding. def set_node_property_mapping(node_property_mapping) Setter for the node property mapping property. Parameters Name Type Description node_property_mapping Union[callable, str] A function that produces node properties or the name of the property to use for binding. The function should have the same signature as default_node_property_mapping e.g. take in a node dictionary and return a dictionary. Notes Properties are changed inplace by this mapping. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_property_mapping(node: dict): ... In [4]: w.set_node_property_mapping(custom_node_property_mapping) def del_node_property_mapping() Deleter for the node property mapping property. Remove a custom node property mapping.","title":"node_property_mapping: Union[callable, str]"},{"location":"02_graph_widget/#edge_property_mapping-unioncallable-str","text":"Data dependent change of edge properties on a per edge basis. def get_edge_property_mapping() Getter for the edge property mapping property. Notes If no mapping is explicitly set, default_edge_property_mapping is returned. Returns Name Type Description edge_property_mapping Union[callable, str] A function that produces edge properties or the name of the property to use for binding. def set_edge_property_mapping(edge_property_mapping) Setter for the edge property mapping property. Parameters Name Type Description edge_property_mapping Union[callable, str] A function that produces edge properties or the name of the property to use for binding. The function should have the same signature as default_edge_property_mapping e.g. take in an edge dictionary and return a dictionary. Notes Properties are changed inplace by this mapping. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_property_mapping(node: dict): ... In [4]: w.set_edge_property_mapping(custom_edge_property_mapping) def del_edge_property_mapping() Deleter for the edge property mapping property. Remove a custom edge property mapping.","title":"edge_property_mapping: Union[callable, str]"},{"location":"02_graph_widget/#node_color_mapping-unioncallable-str","text":"Data dependent change of node color on a per node basis. def get_node_color_mapping() Getter for the node color mapping property. Notes If no mapping is explicitly set, default_node_color_mapping is returned. Returns Name Type Description node_color_mapping Union[callable, str] A function that produces node colors or the name of the property to use for binding. def set_node_color_mapping(node_color_mapping) Setter for the node color mapping property. Parameters Name Type Description node_color_mapping Union[callable, str] A function that produces node colors or the name of the property to use for binding. The function should have the same signature as default_node_color_mapping e.g. take in a node dictionary and return a string. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_color_mapping(node: dict): ... In [4]: w.set_node_color_mapping(custom_node_color_mapping) def del_node_color_mapping() Deleter for the node color mapping property. Remove a custom node color mapping.","title":"node_color_mapping: Union[callable, str]"},{"location":"02_graph_widget/#node_styles_mapping-unioncallable-str","text":"Data dependent change of node styles on a per node basis. def get_node_styles_mapping() Getter for the node styles mapping property. Notes If no mapping is explicitly set, default_node_styles_mapping is returned. Returns Name Type Description node_styles_mapping Union[callable, str] A function that produces node styles or the name of the property to use for binding. def set_node_styles_mapping(node_styles_mapping) Setter for the node styles mapping property. Parameters Name Type Description node_styles_mapping Union[callable, str] A function that produces node styles or the name of the property to use for binding. The function should have the same signature as default_node_styles_mapping e.g. take in a node dictionary and return a string. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_styles_mapping(node: dict): ... In [4]: w.set_node_styles_mapping(custom_node_styles_mapping) def del_node_styles_mapping() Deleter for the node styles mapping property. Remove a custom node styles mapping.","title":"node_styles_mapping: Union[callable, str]"},{"location":"02_graph_widget/#edge_color_mapping-unioncallable-str","text":"Data dependent change of edge color on a per edge basis. def get_edge_color_mapping() Getter for the edge color mapping property. Notes If no mapping is explicitly set, default_edge_color_mapping is returned. Returns Name Type Description edge_color_mapping Union[callable, str] A function that produces edge colors or the name of the property to use for binding. def set_edge_color_mapping(edge_color_mapping) Setter for the edge color mapping property. Parameters Name Type Description edge_color_mapping Union[callable, str] A function that produces edge colors or the name of the property to use for binding. The function should have the same signature as default_edge_color_mapping e.g. take in an edge dictionary and return a string. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_color_mapping(node: dict): ... In [4]: w.set_edge_color_mapping(custom_edge_color_mapping) def del_edge_color_mapping() Deleter for the edge color mapping property. Remove a custom edge color mapping.","title":"edge_color_mapping: Union[callable, str]"},{"location":"02_graph_widget/#node_scale_factor_mapping-unioncallable-str","text":"Data dependent change of node scale factor on a per node basis. def get_node_scale_factor_mapping() Getter for the node scale factor mapping property. Notes If no mapping is explicitly set, default_node_scale_factor_mapping is returned. Returns Name Type Description node_scale_factor_mapping Union[callable, str] A function that produces node scale factor or the name of the property to use for binding. def set_node_scale_factor_mapping(node_scale_factor_mapping) Setter for the node scale factor mapping property. Parameters Name Type Description node_scale_factor_mapping Union[callable, str] A function that produces node scale factors or the name of the property to use for binding. The function should have the same signature as default_node_scale_factor_mapping e.g. take in a node dictionary and return a positive float. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_scale_factor_mapping(node: dict): ... In [4]: w.set_node_scale_factor_mapping(custom_node_scale_factor_mapping) def del_node_scale_factor_mapping() Deleter for the node scale factor mapping property. Remove a custom node scale factor mapping.","title":"node_scale_factor_mapping: Union[callable, str]"},{"location":"02_graph_widget/#node_size_mapping-unioncallable-str","text":"Data dependent change of node size on a per node basis. def get_node_size_mapping() Getter for the node size mapping property. Notes If no mapping is explicitly set, default_node_size_mapping is returned. Returns Name Type Description node_size_mapping Union[callable, str] A function that produces node sizes or the name of the property to use for binding. def set_node_size_mapping(node_size_mapping) Setter for the node size mapping property. A custom size mapping is only used if there is no custom node_layout mapping. If a custom node layout mapping and a custom size mapping is set, the node layout mapping always takes precedence. Parameters Name Type Description node_size_mapping Union[callable, str] A function that produces node sizes or the name of the property to use for binding. The function should have the same signature as default_node_size_mapping e.g. take in a node dictionary and return a positive float 2-tuple. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_size_mapping(node: dict): ... In [4]: w.set_node_size_mapping(custom_node_size_mapping) def del_node_size_mapping() Deleter for the node size mapping property. Remove a custom node size mapping.","title":"node_size_mapping: Union[callable, str]"},{"location":"02_graph_widget/#node_layout_mapping-unioncallable-str","text":"Data dependent change of node layout on a per node basis. def get_node_layout_mapping() Getter for the node layout mapping property. Notes If no mapping is explicitly set, default_node_layout_mapping is returned. Node layouts combine node position and node size. The default node layout mapping is the currently set position and size mapping. If a custom size or position mapping is set using set_node_size_mapping or set_node_position_mapping , the default layout changes. If a custom node layout mapping and a custom size/position mapping is set, the layout mapping takes precedence. Returns Name Type Description node_layout_mapping Union[callable, str] A function that produces node layouts or the name of the property to use for binding. def set_node_layout_mapping(node_layout_mapping) Setter for the node layout mapping property. Parameters Name Type Description node_layout_mapping Union[callable, str] A function that produces node layouts or the name of the property to use for binding. The function should have the same signature as default_node_layout_mapping e.g. take in a node dictionary and return a positive float 4-tuple. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_layout_mapping(node: dict): ... In [4]: w.set_node_layout_mapping(custom_node_layout_mapping) def del_node_layout_mapping() Deleter for the node layout mapping property. Remove a custom node layout mapping.","title":"node_layout_mapping: Union[callable, str]"},{"location":"02_graph_widget/#edge_thickness_factor_mapping-unioncallable-str","text":"Data dependent change of edge thickness factor on a per edge basis. def get_edge_thickness_factor_mapping() Getter for the edge thickness factor mapping property. Notes If no mapping is explicitly set, default_edge_thickness_factor_mapping is returned. Returns Name Type Description edge_thickness_factor_mapping Union[callable, str] A function that produces edge thickness factors or the name of the property to use for binding. def set_edge_thickness_factor_mapping(edge_thickness_factor_mapping) Setter for the edge thickness factor mapping property. Parameters Name Type Description edge_thickness_factor_mapping Union[callable, str] A function that produces edge thickness factors or the name of the property to use for binding. The function should have the same signature as default_edge_thickness_factor_mapping e.g. take in an edge dictionary and return a positive float. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_thickness_factor_mapping(node: dict): ... In [4]: w.set_edge_thickness_factor_mapping(custom_edge_thickness_factor_mapping) def del_edge_thickness_factor_mapping() Deleter for the edge thickness factor mapping property. Remove a custom edge thickness factor mapping.","title":"edge_thickness_factor_mapping: Union[callable, str]"},{"location":"02_graph_widget/#node_type_mapping-unioncallable-str","text":"Data dependent change of node type on a per node basis. def get_node_type_mapping() Getter for the node type mapping property. Notes If no mapping is explicitly set, default_node_type_mapping is returned. Returns Name Type Description node_type_mapping Union[callable, str] A function that produces node types or the name of the property to use for binding. def set_node_type_mapping(node_type_mapping) Setter for the node type mapping property. Parameters Name Type Description node_type_mapping Union[callable, str] A function that produces node types or the name of the property to use for binding. The function should have the same signature as default_node_type_mapping e.g. take in a node dictionary and return a bool/int/float or str value. Notes Node types give more information for some layout algorithms. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_type_mapping(node: dict): ... In [4]: w.set_node_type_mapping(custom_node_type_mapping) References Layout with Custom Node Types def del_node_type_mapping() Deleter for the node type mapping property. Remove a custom node type mapping.","title":"node_type_mapping: Union[callable, str]"},{"location":"02_graph_widget/#node_parent_mapping-unioncallable-str","text":"Data dependent change of node parent on a per node basis. def get_node_parent_mapping() Getter for the node parent mapping property. Notes If no mapping is explicitly set, default_node_parent_mapping is returned. Returns Name parent Description node_parent_mapping Union[callable, str] A function that produces node parents or the name of the property to use for binding. def set_node_parent_mapping(node_parent_mapping) Setter for the node parent mapping property. Parameters Name parent Description node_parent_mapping Union[callable, str] A function that produces node parent ids or the name of the property to use for binding. The function should have the same signature as default_node_parent_mapping e.g. take in a node dictionary and return a bool/int/float or str value. Notes Given node parent ids create group nodes instead of regular nodes. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_parent_mapping(node: dict): ... In [4]: w.set_node_parent_mapping(custom_node_parent_mapping) def del_node_parent_mapping() Deleter for the node parent mapping property. Remove a custom node parent mapping. ### node_parent_group_mapping: Union[callable, str] Data dependent change of node parent group on a per node basis. def get_node_parent_group_mapping() Getter for the node parent group mapping property. Notes If no mapping is explicitly set, default_node_parent_group_mapping is returned. Returns Name Type Description node_parent_group_mapping Union[callable, str] A function that produces node parents or the name of the property to use for binding. def set_node_parent_group_mapping(node_parent_group_mapping) Setter for the node parent group mapping property. Parameters Name Type Description node_parent_group_mapping Union[callable, str] A function that produces node parents ids or the name of the property to use for binding. The function should have the same signature as default_node_parent_group_mapping e.g. take in a node dictionary and return a str/int/float or dict with a required label property. Notes For every returned parent group, a new group node is created. In contrast to node_parent_mapping this mapping does not require the group nodes to be part of the given node dataset. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_parent_group_mapping(node: dict): ... In [4]: w.set_node_parent_group_mapping(custom_node_parent_group_mapping) def del_node_parent_group_mapping() Deleter for the node parent group mapping property. Remove a custom node parent group mapping.","title":"node_parent_mapping: Union[callable, str]"},{"location":"02_graph_widget/#node_position_mapping-unioncallable-str","text":"Data dependent change of node position on a per node basis. def get_node_position_mapping() Getter for the node position mapping property. Notes If no mapping is explicitly set, default_node_position_mapping is returned. Returns Name Type Description node_position_mapping Union[callable, str] A function that produces node positions or the name of the property to use for binding. def set_node_position_mapping(node_position_mapping) Setter for the node position mapping property. A custom position mapping is only used if there is no custom node_layout mapping. If a custom node layout mapping and a custom position mapping is set, the node layout mapping takes precedence. Parameters Name Type Description node_position_mapping Union[callable, str] A function that produces node positions or the name of the property to use for binding. The function should have the same signature as default_node_position_mapping e.g. take in a node dictionary and return a float 2-tuple. Notes Only edge router algorithms consider node positions, all other algorithms calculate node positions themselves. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_position_mapping(node: dict): ... In [4]: w.set_node_position_mapping(custom_node_position_mapping) def del_node_position_mapping() Deleter for the node position mapping property. Remove a custom node position mapping.","title":"node_position_mapping: Union[callable, str]"},{"location":"02_graph_widget/#heat_mapping-unioncallable-str","text":"Data dependent change of heat value on a per node and edge basis. def get_heat_mapping() Getter for the heat mapping property. Notes If no mapping is explicitly set, default_heat_mapping is returned. Returns Name Type Description heat_mapping Union[callable, str] A function that produces heat values or the name of the property to use for binding. def set_heat_mapping(heat_mapping) Setter for the heat mapping property. Parameters Name Type Description heat_mapping Union[callable, str] A function that produces heat values or the name of the property to use for binding. The function should have the same signature as default_heat_mapping e.g. take in a element dictionary and return a float. Notes This mapping is used for both edges and nodes Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_heat_mapping(element: dict): ... In [4]: w.set_heat_mapping(custom_heat_mapping) def del_heat_mapping() Deleter for the heat mapping property. Remove a custom heat mapping.","title":"heat_mapping: Union[callable, str]"},{"location":"02_graph_widget/#node_coordinate_mapping-unioncallable-str","text":"Data dependent change of node coordinate on a per node basis. def get_node_coordinate_mapping() Getter for the node coordinate mapping property. Notes If no mapping is explicitly set, default_node_coordinate_mapping is returned. Returns Name Type Description node_coordinate_mapping Union[callable, str] A function that produces node coordinates or the name of the property to use for binding. def set_node_coordinate_mapping(node_coordinate_mapping) Setter for the node coordinate mapping property. Parameters Name Type Description node_coordinate_mapping Union[callable, str] A function that produces node coordinates or the name of the property to use for binding. The function should have the same signature as default_node_coordinate_mapping e.g. take in a node dictionary and return a float 2-tuple. Notes Only the map layout consider node coordinates, all other algorithms ignore node coordinates. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_coordinate_mapping(node: dict): ... In [4]: w.set_node_coordinate_mapping(custom_node_coordinate_mapping) def del_node_coordinate_mapping() Deleter for the node coordinate mapping property. Remove a custom node coordinate mapping.","title":"node_coordinate_mapping: Union[callable, str]"},{"location":"02_graph_widget/#directed_mapping-unioncallable-str","text":"Data dependent change if an edge is directed or not. def get_directed_mapping() Getter for the directed mapping property. Notes If no mapping is explicitly set, default_directed_mapping is returned. Returns Name Type Description directed_mapping Union[callable, str] A function that produces edge directions or the name of the property to use for binding. def set_directed_mapping(directed_mapping) Setter for the directed mapping property. Parameters Name Type Description directed_mapping Union[callable, str] A function that produces edge directions or the name of the property to use for binding. The function should have the same signature as default_directed_mapping e.g. take in an edge dictionary and return a boolean value. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_directed_mapping(node: dict): ... In [4]: w.set_directed_mapping(custom_directed_mapping) def del_directed_mapping() Deleter for the directed mapping property. Remove a custom directed mapping.","title":"directed_mapping: Union[callable, str]"},{"location":"02_graph_widget/#methods","text":"","title":"Methods"},{"location":"02_graph_widget/#def-initwidget_layout-none-overview_enabled-none-context_start_with","text":"GraphWidget constructor. Parameters Name Type Description widget_layout ipywidgets.Layout (optional) Can be used to specify general widget appearance through css attributes. See references for a link to their documentation and available keywords. overview_enabled bool (optional) Enable graph overview component. Default behaviour depends on cell width. context_start_with str (optional) Specify context tab name to start with that tab opened. Default behaviour is open with About dialog. Use None to start with closed sidebar. Available are Neighborhood , Data , Search and About .","title":"def init(widget_layout = None, overview_enabled = None, context_start_with = '')"},{"location":"02_graph_widget/#def-show","text":"Display widget in Jupyter. Same as using single object reference in cell directly. Notes Mappings will only be applied shortly before showing the widget.","title":"def show()"},{"location":"02_graph_widget/#def-import_graphgraph","text":"Import a graph object defined in an external module. Sets the nodes , edges and directed traitlets properties with information extracted from the graph object. See graph importers for object specific transformation details. Parameters Name Type Description graph networkx.{Multi}{Di}Graph | graph_tool.Graph | igraph.Graph | pygraphviz.AGraph The graph data structure. Example In [1]: from networkx import florentine_families_graph In [2]: from yfiles_jupyter_graphs import GraphWidget In [3]: w = GraphWidget() In [4]: w.import_graph(florentine_families_graph()) Notes Some graph data structures have special attributes for labels, some don't. Same goes for other graph properties. This method and the underlying transformations should be seen as best effort to provide an easy way to input data into the widget. For more granular control use nodes and edges properties directly.","title":"def import_graph(graph)"},{"location":"02_graph_widget/#def-circular_layout","text":"Alias for GraphWidget. graph_layout = \"circular\". See yFiles circular layout guide for more details about this specific algorithm.","title":"def circular_layout()"},{"location":"02_graph_widget/#def-circular_straight_line_layout","text":"Alias for GraphWidget. graph_layout = \"circular_straight_line\". Similar to circular layout but with straight edge paths instead of bundled paths. See yFiles circular layout guide for more details about this specific algorithm.","title":"def circular_straight_line_layout()"},{"location":"02_graph_widget/#def-hierarchic_layout","text":"Alias for GraphWidget. graph_layout = \"hierarchic\". See yFiles hierarchic layout guide for more details about this specific algorithm.","title":"def hierarchic_layout()"},{"location":"02_graph_widget/#def-organic_layout","text":"Alias for GraphWidget. graph_layout = \"organic\". See yFiles organic layout guide for more details about this specific algorithm.","title":"def organic_layout()"},{"location":"02_graph_widget/#def-orthogonal_layout","text":"Alias for GraphWidget. graph_layout = \"orthogonal\". See yFiles orthogonal layout guide for more details about this specific algorithm.","title":"def orthogonal_layout()"},{"location":"02_graph_widget/#def-radial_layout","text":"Alias for GraphWidget. graph_layout = \"radial\". See yFiles radial layout guide for more details about this specific algorithm.","title":"def radial_layout()"},{"location":"02_graph_widget/#def-tree_layout","text":"Alias for GraphWidget. graph_layout = \"tree\". See yFiles tree layout guide for more details about this specific algorithm.","title":"def tree_layout()"},{"location":"02_graph_widget/#def-orthogonal_edge_router","text":"Alias for GraphWidget. graph_layout = \"orthogonal_edge_router\". See yFiles orthogonal edge router guide for more details about this specific algorithm.","title":"def orthogonal_edge_router()"},{"location":"02_graph_widget/#def-interactive_organic_layout","text":"Alias for GraphWidget. graph_layout = \"interactive_organic_layout\". See yFiles interactive organic layout guide for more details about this specific algorithm.","title":"def interactive_organic_layout()"},{"location":"02_graph_widget/#def-organic_edge_router","text":"Alias for GraphWidget. graph_layout = \"organic_edge_router\". See yFiles organic edge router guide for more details about this specific algorithm.","title":"def organic_edge_router()"},{"location":"02_graph_widget/#def-default_element_label_mappingindex-element","text":"The default property mapping for graph elements. The default label mapping for graph elements. Element (dict) should have key properties which itself should be a dict. Then one of the following values (in descending priority) is used as label if the label is a string: - properties[\"label\"] - properties[\"yf_label\"] When importing a Neo4j graph, the following properties are values are used as labels (in descending priority): properties['name'] properties['title'] properties['label'] properties['description'] properties['caption'] properties['text'] Parameters Name Type Description index int (optional) Position in corresponding nodes or edges list. element typing.Dict Can be both node or edge. Notes This is the default value for the { node | edge }_label_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: w.{node|edge}_label_mapping = 'id' In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_element_label_mapping(element: typing.Dict): ... In [4]: w.set_{node|edge}_label_mapping(custom_element_label_mapping) Returns Name Type Description label str The node or edge label. label typing.Dict | A Dict` with mappings for style attributes. See below for supported values. Supported style attributes in the return Dict : can contain the following key-value-pairs: \"text\": str Is used as the label. \"fontSize\": number Sets the size of the font. \"color\": string Css color value for the text color. \"backgroundColor\": str Css color value for the background color. \"position\": 'center' | 'north' | 'east' | 'south' | 'west' The label position at the node. Applies only to node labels. \"maximumWidth\": number The maximum width of the label. By default, the label is clipped at the given size, or wrapped when \"wrapping\" is set. \"maximumHeight\": number The maximum height of the label. Clips the label at the given height. May be combined with \"wrapping\". \"wrapping\": 'character' | 'character_ellipsis' | 'none' | 'word' | 'word_ellipsis' Text wrapping for the label. Must be set in combination with \"maximumWidth\". \"textAlignment\": 'center' | 'left' | 'right' The horizontal text alignment when \"wrapping\" is enabled.","title":"def default_element_label_mapping(index, element)"},{"location":"02_graph_widget/#def-default_node_label_mappingindex-node","text":"The default label mapping for nodes. See default_element_label_mapping .","title":"def default_node_label_mapping(index, node)"},{"location":"02_graph_widget/#def-default_edge_label_mappingindex-edge","text":"The default label mapping for edges. See default_element_label_mapping .","title":"def default_edge_label_mapping(index, edge)"},{"location":"02_graph_widget/#def-default_element_property_mappingindex-element","text":"The default property mapping for graph elements. Simply selects the properties value of element dictionary. Parameters Name Type Description index int (optional) Position in corresponding nodes or edges list. element typing.Dict Can be both node or edge. Notes This is the default value for the { node | edge }_property_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. When a string is provided as the function argument, the key will be searched for in both the properties dictionary and the element keys. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_element_property_mapping(element: typing.Dict): ... In [4]: w.set_{node|edge}_property_mapping(custom_element_property_mapping) Returns Name Type Description properties typing.Dict The node or edge properties.","title":"def default_element_property_mapping(index, element)"},{"location":"02_graph_widget/#def-default_node_property_mappingindex-node","text":"The default property mapping for nodes. See default_element_property_mapping .","title":"def default_node_property_mapping(index, node)"},{"location":"02_graph_widget/#def-default_edge_property_mappingindex-edge","text":"The default property mapping for edges. See default_element_property_mapping .","title":"def default_edge_property_mapping(index, edge)"},{"location":"02_graph_widget/#def-default_node_color_mappingindex-node","text":"The default color mapping for nodes. Provides constant value of '#15afac' for all nodes. Parameters Name Type Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_color_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_color_mapping(node: typing.Dict): ... In [4]: w.set_node_color_mapping(custom_node_color_mapping) Returns Name Type Description color str CSS color value. References css color value yFiles docs Fill api","title":"def default_node_color_mapping(index, node)"},{"location":"02_graph_widget/#def-default_node_styles_mappingindex-node","text":"The default styles mapping for nodes. Provides constant value of {} for all nodes. Parameters Name Type Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_styles_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_styles_mapping(node: typing.Dict): ... In [4]: w.set_node_styles_mapping(custom_node_styles_mapping) Returns Name Type Description styles typing.Dict A Dict with mappings for style attributes. See below for supported values. Supported style attributes in the return Dict : can contain the following key-value-pairs: \"color\": str css color value \"shape\": str possible values: 'ellipse', 'hexagon', 'hexagon2', 'octagon', 'pill', 'rectangle', 'round-rectangle' or 'triangle' \"image\": str url or data URL of the image References css color value Data URL","title":"def default_node_styles_mapping(index, node)"},{"location":"02_graph_widget/#def-default_edge_color_mappingindex-edge","text":"The default color mapping for edges. Provides constant value of '#15afac' for all edges. Parameters Name Type Description index int (optional) Position in edges list. edge typing.Dict Notes This is the default value for the edge_color_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_color_mapping(edge: typing.Dict): ... In [4]: w.set_edge_color_mapping(custom_edge_color_mapping) Returns Name Type Description color str CSS color value. References css color value yFiles docs Fill api","title":"def default_edge_color_mapping(index, edge)"},{"location":"02_graph_widget/#def-default_node_scale_factor_mappingindex-node","text":"The default scale factor mapping for nodes. Provides constant value of 1.0 for all nodes. Parameters Name Type Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_scale_factor_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_scale_factor_mapping(node: typing.Dict): ... In [4]: w.set_node_scale_factor_mapping(custom_node_scale_factor_mapping) Returns Name Type Description node_scale_factor float Positive scale factor.","title":"def default_node_scale_factor_mapping(index, node)"},{"location":"02_graph_widget/#def-default_node_size_mappingindex-node","text":"The default size mapping for nodes. Provides constant value of [55.0,55.0] for all nodes. Parameters Name Type Description index int Position in nodes list. node typing.Dict Notes This is the default value for the node_size_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_size_mapping(node: typing.Dict): ... In [4]: w.set_node_size_mapping(custom_node_size_mapping) Returns Name Type Description node_size float 2-tuple size in (width, height).","title":"def default_node_size_mapping(index, node)"},{"location":"02_graph_widget/#def-default_node_layout_mappingindex-node","text":"The default layout mapping for nodes. Provides constant value of [0.00, 0.00, 55.0, 55.0] for all nodes. Parameters Name Type Description index int Position in nodes list. node typing.Dict Notes This is the default value for the node_layout_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_layout_mapping(node: typing.Dict): ... In [4]: w.set_node_layout_mapping(custom_node_layout_mapping) Returns Name Type Description node_layout float 4-tuple layout containin position and size: (x, y, width, height).","title":"def default_node_layout_mapping(index, node)"},{"location":"02_graph_widget/#def-default_heat_mappingindex-node","text":"The default heat mapping for nodes and edges. Provides constant value of None for all nodes and edges. Parameters Name Type Description index int Position in element list. element typing.Dict Notes This is the default value for the heat_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_heat_mapping(node: typing.Dict): ... In [4]: w.set_heat_mapping(custom_heat_mapping) Returns Name Type Description heat float The heat can be a number between 0 and 1.","title":"def default_heat_mapping(index, node)"},{"location":"02_graph_widget/#def-default_edge_thickness_factor_mappingindex-edge","text":"The default thickness factor mapping for edges. Provides constant value of 1.0 for all edges. Parameters Name Type Description index int (optional) Position in edges list. edge typing.Dict Notes This is the default value for the edge_thickness_factor_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_thickness_factor_mapping(edge: typing.Dict): ... In [4]: w.set_edge_thickness_factor_mapping(custom_edge_thickness_factor_mapping) Returns Name Type Description edge_thickness_factor float Positive thickness factor.","title":"def default_edge_thickness_factor_mapping(index, edge)"},{"location":"02_graph_widget/#def-default_node_type_mappingindex-node","text":"The default type mapping for nodes. Provides constant value of None for all nodes. Parameters Name Type Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_type_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_type_mapping(node: typing.Dict): ... In [4]: w.set_node_type_mapping(custom_node_type_mapping) Returns Name Type Description node_type None Node Type.","title":"def default_node_type_mapping(index, node)"},{"location":"02_graph_widget/#def-default_node_parent_mappingindex-node","text":"The default parent mapping for nodes. Provides constant value of None for all nodes. Parameters Name parent Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_parent_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_parent_mapping(node: typing.Dict): ... In [4]: w.set_node_parent_mapping(custom_node_parent_mapping) Returns Name parent Description node_parent None Node parent Id.","title":"def default_node_parent_mapping(index, node)"},{"location":"02_graph_widget/#def-default_node_parent_group_mappingindex-node","text":"The default parent group mapping for nodes. Provides constant value of None for all nodes. Parameters Name parent Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_parent_group_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_parent_group_mapping(node: typing.Dict): ... In [4]: w.set_node_parent_group_mapping(custom_node_parent_group_mapping) Returns Name parent Description node_parent_group None Node parent label.","title":"def default_node_parent_group_mapping(index, node)"},{"location":"02_graph_widget/#def-default_node_position_mappingindex-node","text":"The default position mapping for nodes. Provides constant value of [0.0, 0.0] for all nodes. Parameters Name Type Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_position_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_position_mapping(node: typing.Dict): ... In [4]: w.set_node_position_mapping(custom_node_position_mapping) Returns Name Type Description node_position float 2-tuple Position in euclidian plane.","title":"def default_node_position_mapping(index, node)"},{"location":"02_graph_widget/#def-default_node_coordinate_mappingindex-node","text":"The default coordinate mapping for nodes. Provides constant value of None for all nodes. There is no coordinate mapping unless explicitly set. Parameters Name Type Description index int (optional) position in nodes list. node typing.Dict Notes This is the default value for the node_coordinate_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_coordinate_mapping(node: typing.Dict): ... In [4]: w.set_node_coordinate_mapping(custom_node_coordinate_mapping) Returns Name Type Description node_coordinate float 2-tuple geo coordinates in latitude and longitude .","title":"def default_node_coordinate_mapping(index, node)"},{"location":"02_graph_widget/#def-default_directed_mappingindex-edge","text":"The default directed mapping for edges. Uses the graph wide directed attribute for all edges. Parameters Name Type Description index int (optional) Position in edges list. edge typing.Dict Notes This is the default value for the directed_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_directed_mapping(edge: typing.Dict): ... In [4]: w.set_directed_mapping(custom_directed_mapping) Returns Name Type Description directed bool Whether the edge is directed or not.","title":"def default_directed_mapping(index, edge)"},{"location":"03_graph_importers/","text":"Graph Importers Used by the GraphWidget.import_graph method. Neo4j Importer Importer for graphs from Neo4j . Notes By default, the widget displays the node's label and the edge's type as text. This may be adjusted by setting a different label-mapping, e.g., see 02_label_mapping . Node labels are combined with ':' and added as 'label' property on the item Node and relationship properties are available on the graph item's properties . Each node label or relationship type is assigned a specific color. Example First, create a Neo4j driver with access to your database from neo4j import GraphDatabase from yfiles_jupyter_graphs import GraphWidget NEO4J_URI = \"neo4j+s://demo.neo4jlabs.com\" NEO4J_USERNAME = \"movies\" NEO4J_PASSWORD = \"movies\" # create a neo4j session to run queries driver = GraphDatabase.driver(uri = NEO4J_URI, auth = (NEO4J_USERNAME, NEO4J_PASSWORD), database = 'movies') session = driver.session() This driver can then be used to query a result graph by importing the result with the yFiles Graphs for Jupyter widget: # directly show the graph resulting from the given Cypher query def showGraph(cypher: str): widget = GraphWidget(graph = session.run(cypher).graph()) # potentially configure some mappings of the widget... def node_label_mapping(node): properties = node['properties'] return properties.get('name', properties.get('label', '')) w.node_label_mapping = node_label_mapping display(widget) # display a Cypher query as graph showGraph(\"MATCH (s)-[r]->(t) RETURN s,r,t LIMIT 20\") See also this Jupyter Notebook Graph Tool Importer Importer for graphs from the graph tool package. Notes Graph properties are ignored. Nodes and edges are identified by index. Node and edge properties are extracted from corresponding property maps. Default values for unset properties are used, due to the way graph tool properties work. Example See this Jupyter Notebook igraph Importer Importer for graphs from the igraph package. Notes Nodes and edges are identified by index attribute. Node and edge properties are provided through attributes method. Edges are determined by source and target attribute. Example See this Jupyter Notebook Networkx Importer Importer for graphs from the networkx package. Notes Graph attributes are ignored. Node identifiers are saved under property key label (or yf_label if key label already exists). Node identifiers have to be unique. Subgraphs (graph as node, see here ) are not supported. Example See this Jupyter Notebook PyGraphviz Importer Importer for graphs from the pygraphviz package. Notes Graph attributes are ignored. Node names are saved under property key label (or yf_label if key label already exists). Node names have to be unique. Unspecified default node/edge attributes are empty (and shown as null in data viewer). Subgraphs are dissolved. Example See this Jupyter Notebook Pandas Importer Notes each row corresponds to an edge the edges are defined by pairs of source and target indices if you have a label column in your DataFrame, the edges automatically have this label the default edge is always directed nodes are created for every id used in source and target any additional DataFrame columns are stored in properties under the same name Example See this Jupyter Notebook","title":"Graph Importers"},{"location":"03_graph_importers/#graph-importers","text":"Used by the GraphWidget.import_graph method.","title":"Graph Importers"},{"location":"03_graph_importers/#neo4j-importer","text":"Importer for graphs from Neo4j .","title":"Neo4j Importer"},{"location":"03_graph_importers/#notes","text":"By default, the widget displays the node's label and the edge's type as text. This may be adjusted by setting a different label-mapping, e.g., see 02_label_mapping . Node labels are combined with ':' and added as 'label' property on the item Node and relationship properties are available on the graph item's properties . Each node label or relationship type is assigned a specific color.","title":"Notes"},{"location":"03_graph_importers/#example","text":"First, create a Neo4j driver with access to your database from neo4j import GraphDatabase from yfiles_jupyter_graphs import GraphWidget NEO4J_URI = \"neo4j+s://demo.neo4jlabs.com\" NEO4J_USERNAME = \"movies\" NEO4J_PASSWORD = \"movies\" # create a neo4j session to run queries driver = GraphDatabase.driver(uri = NEO4J_URI, auth = (NEO4J_USERNAME, NEO4J_PASSWORD), database = 'movies') session = driver.session() This driver can then be used to query a result graph by importing the result with the yFiles Graphs for Jupyter widget: # directly show the graph resulting from the given Cypher query def showGraph(cypher: str): widget = GraphWidget(graph = session.run(cypher).graph()) # potentially configure some mappings of the widget... def node_label_mapping(node): properties = node['properties'] return properties.get('name', properties.get('label', '')) w.node_label_mapping = node_label_mapping display(widget) # display a Cypher query as graph showGraph(\"MATCH (s)-[r]->(t) RETURN s,r,t LIMIT 20\") See also this Jupyter Notebook","title":"Example"},{"location":"03_graph_importers/#graph-tool-importer","text":"Importer for graphs from the graph tool package.","title":"Graph Tool Importer"},{"location":"03_graph_importers/#notes_1","text":"Graph properties are ignored. Nodes and edges are identified by index. Node and edge properties are extracted from corresponding property maps. Default values for unset properties are used, due to the way graph tool properties work.","title":"Notes"},{"location":"03_graph_importers/#example_1","text":"See this Jupyter Notebook","title":"Example"},{"location":"03_graph_importers/#igraph-importer","text":"Importer for graphs from the igraph package.","title":"igraph Importer"},{"location":"03_graph_importers/#notes_2","text":"Nodes and edges are identified by index attribute. Node and edge properties are provided through attributes method. Edges are determined by source and target attribute.","title":"Notes"},{"location":"03_graph_importers/#example_2","text":"See this Jupyter Notebook","title":"Example"},{"location":"03_graph_importers/#networkx-importer","text":"Importer for graphs from the networkx package.","title":"Networkx Importer"},{"location":"03_graph_importers/#notes_3","text":"Graph attributes are ignored. Node identifiers are saved under property key label (or yf_label if key label already exists). Node identifiers have to be unique. Subgraphs (graph as node, see here ) are not supported.","title":"Notes"},{"location":"03_graph_importers/#example_3","text":"See this Jupyter Notebook","title":"Example"},{"location":"03_graph_importers/#pygraphviz-importer","text":"Importer for graphs from the pygraphviz package.","title":"PyGraphviz Importer"},{"location":"03_graph_importers/#notes_4","text":"Graph attributes are ignored. Node names are saved under property key label (or yf_label if key label already exists). Node names have to be unique. Unspecified default node/edge attributes are empty (and shown as null in data viewer). Subgraphs are dissolved.","title":"Notes"},{"location":"03_graph_importers/#example_4","text":"See this Jupyter Notebook","title":"Example"},{"location":"03_graph_importers/#pandas-importer","text":"","title":"Pandas Importer"},{"location":"03_graph_importers/#notes_5","text":"each row corresponds to an edge the edges are defined by pairs of source and target indices if you have a label column in your DataFrame, the edges automatically have this label the default edge is always directed nodes are created for every id used in source and target any additional DataFrame columns are stored in properties under the same name","title":"Notes"},{"location":"03_graph_importers/#example_5","text":"See this Jupyter Notebook","title":"Example"},{"location":"04_key_activation/","text":"Key activation yFiles Graphs for Jupyter is allow-listed on well-known domains like JupyterLab or Jupyter Notebook Visual Studio Code Google Colaboratory Google Vertex AI Workbench Google Dataproc Azure Machine Learning Studio Notebooks Amazon SageMaker and localhost 127.0.0.1 Unknown domains If your domain is unknown to the widget, you will see a popup in the widget that states that it runs on an unknown domain. The widget's popup provides a button with which you can temporarily continue using yFiles Graphs for Jupyter. If you think the widget should also be allow-listed on the domain you are running it on, or if you need a specific activation license for your domain, please get in touch with us by email or on GitHub . Obtaining a domain specific license Please get in touch with us by email if you require a specific activation key for your domain. Using a license Key To use a specific activation license, provide it as license parameter to the GraphWidget constructor: w = GraphWidget(license={ \"id\": \"6440496d-b481-49a5-a824-78d591e590b4\", \"domains\": [ \"my.domain.com\" ], \"expiry\": \"2024-01-05\", \"version\": \"1.0\", \"signature\": \"8214787cc5f7e2bf25f4a25e43f9d7e9d482c...\" })","title":"Key activation"},{"location":"04_key_activation/#key-activation","text":"yFiles Graphs for Jupyter is allow-listed on well-known domains like JupyterLab or Jupyter Notebook Visual Studio Code Google Colaboratory Google Vertex AI Workbench Google Dataproc Azure Machine Learning Studio Notebooks Amazon SageMaker and localhost 127.0.0.1","title":"Key activation"},{"location":"04_key_activation/#unknown-domains","text":"If your domain is unknown to the widget, you will see a popup in the widget that states that it runs on an unknown domain. The widget's popup provides a button with which you can temporarily continue using yFiles Graphs for Jupyter. If you think the widget should also be allow-listed on the domain you are running it on, or if you need a specific activation license for your domain, please get in touch with us by email or on GitHub .","title":"Unknown domains"},{"location":"04_key_activation/#obtaining-a-domain-specific-license","text":"Please get in touch with us by email if you require a specific activation key for your domain.","title":"Obtaining a domain specific license"},{"location":"04_key_activation/#using-a-license-key","text":"To use a specific activation license, provide it as license parameter to the GraphWidget constructor: w = GraphWidget(license={ \"id\": \"6440496d-b481-49a5-a824-78d591e590b4\", \"domains\": [ \"my.domain.com\" ], \"expiry\": \"2024-01-05\", \"version\": \"1.0\", \"signature\": \"8214787cc5f7e2bf25f4a25e43f9d7e9d482c...\" })","title":"Using a license Key"}]} \ No newline at end of file +{"config":{"indexing":"full","lang":["en"],"min_search_length":3,"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"yFiles Graphs for Jupyter A graph diagram visualization widget for Jupyter Notebooks and Labs powered by yFiles for HTML . yfiles-jupyter-graphs-for-neo4j For working with Neo4j databases, we built yfiles-jupyter-graphs-for-neo4j , an open-source extension on top of yfiles-jupyter-graphs . This extension provides an easier Python interface for the driver and allows direct configuration of data mappings depending on the label or type of the node or relationship. So if you are planning to use the extension with Neo4j databases, consider using yfiles-jupyter-graphs-for-neo4j . Supported Environments JupyterLab or Jupyter Notebook Visual Studio Code Google Colaboratory Google Vertex AI Workbench Google Dataproc Azure Machine Learning Studio Notebooks Amazon SageMaker Kaggle Just try it in your preferred platform for Jupyter notebooks Features See Node Neighborhood Choose Graph Layout Investigate Nodes or Edges Data Search for Nodes or Edges Import Graph Data Make Data Dependent Property Changes Define a Heatmap Background Use a Map Background Visualize nested data For example code look here . Code of Conduct This project and everyone participating in it is governed by the Code of Conduct . By participating, you are expected to uphold this code. Please report unacceptable behavior to contact@yworks.com . Feedback This widget is by no means perfect. If you find something is not working as expected we are glad to receive an issue report from you. Please make sure to search for existing issues first and check if the issue is not an unsupported feature or known issue. If you did not find anything related, report a new issue with necessary information. Please also provide a clear and descriptive title and stick to the issue templates. See issues . Dependencies @ctrl/tinycolor @jupyter-widgets/base @mdi/js Vue vue-json-viewer License See LICENSE file.","title":"yFiles Graphs for Jupyter"},{"location":"#yfiles-graphs-for-jupyter","text":"A graph diagram visualization widget for Jupyter Notebooks and Labs powered by yFiles for HTML .","title":"yFiles Graphs for Jupyter"},{"location":"#yfiles-jupyter-graphs-for-neo4j","text":"For working with Neo4j databases, we built yfiles-jupyter-graphs-for-neo4j , an open-source extension on top of yfiles-jupyter-graphs . This extension provides an easier Python interface for the driver and allows direct configuration of data mappings depending on the label or type of the node or relationship. So if you are planning to use the extension with Neo4j databases, consider using yfiles-jupyter-graphs-for-neo4j .","title":"yfiles-jupyter-graphs-for-neo4j"},{"location":"#supported-environments","text":"JupyterLab or Jupyter Notebook Visual Studio Code Google Colaboratory Google Vertex AI Workbench Google Dataproc Azure Machine Learning Studio Notebooks Amazon SageMaker Kaggle Just try it in your preferred platform for Jupyter notebooks","title":"Supported Environments"},{"location":"#features","text":"See Node Neighborhood Choose Graph Layout Investigate Nodes or Edges Data Search for Nodes or Edges Import Graph Data Make Data Dependent Property Changes Define a Heatmap Background Use a Map Background Visualize nested data For example code look here .","title":"Features"},{"location":"#code-of-conduct","text":"This project and everyone participating in it is governed by the Code of Conduct . By participating, you are expected to uphold this code. Please report unacceptable behavior to contact@yworks.com .","title":"Code of Conduct"},{"location":"#feedback","text":"This widget is by no means perfect. If you find something is not working as expected we are glad to receive an issue report from you. Please make sure to search for existing issues first and check if the issue is not an unsupported feature or known issue. If you did not find anything related, report a new issue with necessary information. Please also provide a clear and descriptive title and stick to the issue templates. See issues .","title":"Feedback"},{"location":"#dependencies","text":"@ctrl/tinycolor @jupyter-widgets/base @mdi/js Vue vue-json-viewer","title":"Dependencies"},{"location":"#license","text":"See LICENSE file.","title":"License"},{"location":"01_getting_started/","text":"Getting started Requirements python >= 3.6 jupyter notebook or lab ipywidgets >= 7.6.0 Installation If you already have Jupyter installed, just pip install the prebuilt extension from the Python Package Index . pip install yfiles_jupyter_graphs If you want to start clean and get a fresh new Jupyter Lab with the widget readily installed and available, you can use docker , too: Form a shell, create a docker image that contains all that is required: mkdir yfiles-jupyter && cd yfiles-jupyter echo -e \"FROM jupyter/scipy-notebook\\nRUN pip install yfiles-jupyter-graphs\" > Dockerfile docker build -t yfiles-jupyter-graphs-on-docker . (the above has been tested successfully with scipy-notebook:lab-3.4.7 and yfiles-jupyter-graphs==1.2.1 ), but we want to make sure that it will also work with upcoming versions - file an issue if it doesn't work for you!) You can then create a fresh new instance of your server from this image like so: docker run -it -p 8888:8888 --name yfiles-jupyter yfiles-jupyter-graphs-on-docker Usage In a notebook which has the wiget installed in the server, in a Python cell, you can then do this: Usage \"\"\"Execute in jupyter notebook or jupyter lab\"\"\" from yfiles_jupyter_graphs import GraphWidget # shows empty widget GraphWidget()","title":"Getting started"},{"location":"01_getting_started/#getting-started","text":"","title":"Getting started"},{"location":"01_getting_started/#requirements","text":"python >= 3.6 jupyter notebook or lab ipywidgets >= 7.6.0","title":"Requirements"},{"location":"01_getting_started/#installation","text":"If you already have Jupyter installed, just pip install the prebuilt extension from the Python Package Index . pip install yfiles_jupyter_graphs If you want to start clean and get a fresh new Jupyter Lab with the widget readily installed and available, you can use docker , too: Form a shell, create a docker image that contains all that is required: mkdir yfiles-jupyter && cd yfiles-jupyter echo -e \"FROM jupyter/scipy-notebook\\nRUN pip install yfiles-jupyter-graphs\" > Dockerfile docker build -t yfiles-jupyter-graphs-on-docker . (the above has been tested successfully with scipy-notebook:lab-3.4.7 and yfiles-jupyter-graphs==1.2.1 ), but we want to make sure that it will also work with upcoming versions - file an issue if it doesn't work for you!) You can then create a fresh new instance of your server from this image like so: docker run -it -p 8888:8888 --name yfiles-jupyter yfiles-jupyter-graphs-on-docker","title":"Installation"},{"location":"01_getting_started/#usage","text":"In a notebook which has the wiget installed in the server, in a Python cell, you can then do this:","title":"Usage"},{"location":"01_getting_started/#usage_1","text":"\"\"\"Execute in jupyter notebook or jupyter lab\"\"\" from yfiles_jupyter_graphs import GraphWidget # shows empty widget GraphWidget()","title":"Usage"},{"location":"02_graph_widget/","text":"GraphWidget Class Inherits from ipywidgets.DOMWidget The main widget class. To be used in jupyter-notebook or jupyter-lab. Example from yfiles_jupyter_graphs import GraphWidget w = GraphWidget() w.show() See notebooks for more examples. Notes Nodes and edges properties should be constructed recursively with basic python types otherwise {de-}serializers will fail. Properties nodes: typing.List[typing.Dict] Data structure. def get_nodes() Getter for the nodes traitlets property. Notes This function acts as an alias for using GraphWidget.nodes property e.g. w.nodes == w.get_nodes() . Returns Name Type Description nodes typing.List[typing.Dict] Each node has the keys id: int and properties: typing.Dict . It might include keys that are not set directly, see (default) node mappings for details. def set_nodes(nodes) Setter for the nodes traitlets property. Parameters Name Type Description nodes typing.List[typing.Dict] Each node should have the keys id: int and properties: typing.Dict . Properties should be constructed recursively with basic python types, otherwise {de-}serializers will fail. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: w.set_nodes([ {'id': 0, 'properties': {'label': 'Hello World'}}, {'id': 1, 'properties': {'label': 'This is a second node.'}} ]) Notes This function acts as an alias for using GraphWidget.nodes property e.g. w.nodes = [{...}] has the same effect as using w.set_nodes([{...}]) . edges: typing.List[typing.Dict] Data structure. def get_edges() Getter for the edges traitlets property. Notes This function acts as an alias for using GraphWidget.edges property e.g. w.edges == w.get_edges() is true . Returns Name Type Description edges typing.List[typing.Dict] Each edge has the keys id: int , start: int , end: int and properties: typing.Dict . It might include keys that are not set directly, see (default) edge mappings for details. def set_edges(edges) Setter for the edges traitlets property. Parameters Name Type Description edges typing.List[typing.Dict] Each edge should have the keys id: int , start: int , end:int and properties: typing.Dict . Ids for start and end should be among used node ids, otherwise the edge does not appear. Properties should be constructed recursively with basic python types, otherwise {de-}serializers will fail. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: w.set_edges([ {'id': 0, 'start': 0, 'end': 1, 'properties': {'label': 'edge between first and second node'}} ]) Notes This function acts as an alias for using GraphWidget.edges property e.g. w.edges = [{...}] has the same effect as using w.set_edges([{...}]) . def get_selection() Returns the nodes and edges, that are selected in the displayed widget. Returns Name Type Description nodes typing.List[typing.Dict] List of selected nodes. edges typing.List[typing.Dict] List of selected edges. directed: bool Graph wide flag for edge type. def get_directed() Getter for the directed traitlets property. Notes This function acts as an alias for using GraphWidget.directed property e.g. w.directed == w.get_directed() is true . Returns Name Type Description directed bool Whether the graph is interpreted as directed. def set_directed(directed) Setter for the directed traitlets property. Parameters Name Type Description directed bool Whether the graph is interpreted as directed. Notes This function acts as an alias for using GraphWidget.directed property e.g. w.directed = x has the same effect as using w.set_directed(x) . graph_layout: typing.Dict Choose an algorithm for positioning nodes and/or edges. def get_graph_layout() Getter for the graph layout traitlet property. Notes This function acts as an alias for using GraphWidget.graph_layout property e.g. w.graph_layout == w.get_graph_layout() is true . Returns Name Type Description graph_layout typing.Dict Returned dict has keys algorithm: str and options: dict, however options are empty because the algorithms use default settings from yFiles library. def set_graph_layout(algorithm) Choose graph layout. Currently the algorithms use default settings from yFiles library. Parameters Name Type Description algorithm str Specify graph layout (or edge router) algorithm. Available algorithms are: [\"circular\", \"circular_straight_line\", \"hierarchic\", \"organic\", \"interactive_organic\", \"orthogonal\", \"radial\", \"tree\", \"map\", \"orthogonal_edge_router\", \"organic_edge_router\"] Notes This function acts as an alias for using GraphWidget.graph_layout property e.g. w.graph_layout = 'organic' has the same effect as using w.set_graph_layout('organic') . Setting w.graph_layout = {'algorithm': 'organic', 'options': {}} works as well, which corresponds to using value given through the associated getter. In case you want to use the edge routers you should set a custom node position mapping as well. See yFiles docs for more details about the algorithms. neighborhood: typing.Dict Control neighborhood view component. def get_neighborhood() Getter for the neighborhood traitlets property. Returns Name Type Description neighborhood typing.Dict Returned dict has keys max_distance: int and selected_nodes: list, a list of node ids. def set_neighborhood(max_distance, selected_nodes) Specify the neighborhood view in the widget. The number of hops and focused nodes can be chosen. Parameters Name Type Description max_distance int Set the maximum distance between selected and included nodes. If there are multiple paths to one (or multiple) selected nodes, the smallest path length is considered for this threshold. selected_nodes typing.List (optional) Choose a list of node ids that are highlighted in both main and neighborhood component. They act as starting points for neighborhood calculation. Notes This function acts as an alias for using GraphWidget.neighborhood property. You can assign values by w.neighborhood = {'max_distance': 2, 'selected_nodes':[2]} or w.set_neighborhood(2, [2]) , both are equivalent. The short form w.neighborhood = 3 sets only the max_distance variable and resets the selected nodes. sidebar: typing.Dict Control sidebar component. def get_sidebar() Getter for the sidebar traitlets property. Returns Name Type Description sidebar typing.Dict Returned dict has keys enabled: bool and start_with: str, whereat first one indicates open or closed sidebar and second one indicates start panel on widget show. def set_sidebar(enabled, start_with) Specify the appearance of the sidebar in the widget. Can be used to collapse sidebar or start with any panel. Parameters Name Type Description enabled bool Whether to open or collapse sidebar at widget startup. start_with str The start panel identifier. Available are 'Neighborhood', 'Data', 'Search' and 'About' (the default). Notes This function acts as an alias for using GraphWidget.sidebar property. You can assign values by w.sidebar = {'enabled': True, 'start_with': 'Search'} or w.set_sidebar(True, 'Search') , both are equivalent. The short form w.sidebar = True sets only the enabled variable and resets the start_with back to the default. overview: bool Control overview component. def get_overview() Getter for the overview traitlets property. Returns Name Type Description overview bool Indicates open or closed overview state. A value of None means that a specific behaviour based on widget layout is followed. def set_overview(enabled) Specify the appearance of the overview component in the widget. Can be used to force open overview in case of a small widget layout or force collapsed overview in case of large widget layout. Parameters Name Type Description enabled bool Whether to open or collapse overview at widget startup. node_label_mapping: Union[callable, str] Data dependent change of node label on a per node basis. def get_node_label_mapping() Getter for the node label mapping property. Notes If no mapping is explicitly set, default_node_label_mapping is returned. Returns Name Type Description node_label_mapping Union[callable, str] A function that produces node labels or the name of the property to use for binding. def set_node_label_mapping(node_label_mapping) Setter for the node label mapping property. Parameters Name Type Description node_label_mapping Union[callable, str] A function that produces node labels or the name of the property to use for binding. The function should have the same signature as default_node_label_mapping e.g. take in a node dictionary and return a string. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: w.node_label_mapping = 'id' In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_label_mapping(node: dict): ... In [4]: w.set_node_label_mapping(custom_node_label_mapping) def del_node_label_mapping() Deleter for the name property. Remove a custom node label mapping. edge_label_mapping: Union[callable, str] Data dependent change of edge label on a per edge basis. def get_edge_label_mapping() Getter for the edge label mapping property. Notes If no mapping is explicitly set, default_edge_label_mapping is returned. Returns Name Type Description edge_label_mapping Union[callable, str] A function that produces edge labels or the name of the property to use for binding. def set_edge_label_mapping(edge_label_mapping) Setter for the edge label mapping property. Parameters Name Type Description edge_label_mapping Union[callable, str] A function that produces edge labels or the name of the property to use for binding. The funtion should have the same signature as default_edge_label_mapping e.g. take in an edge dictionary and return a string. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: w.edge_label_mapping = 'id' In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_label_mapping(node: dict): ... In [4]: w.set_edge_label_mapping(custom_edge_label_mapping) def del_edge_label_mapping() Deleter for the edge label mapping property. Remove a custom edge label mapping. node_property_mapping: Union[callable, str] Data dependent change of node properties on a per node basis. def get_node_property_mapping() Getter for the node property mapping property. Notes If no mapping is explicitly set, default_node_property_mapping is returned. Returns Name Type Description node_property_mapping Union[callable, str] A function that produces node properties or the name of the property to use for binding. def set_node_property_mapping(node_property_mapping) Setter for the node property mapping property. Parameters Name Type Description node_property_mapping Union[callable, str] A function that produces node properties or the name of the property to use for binding. The function should have the same signature as default_node_property_mapping e.g. take in a node dictionary and return a dictionary. Notes Properties are changed inplace by this mapping. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_property_mapping(node: dict): ... In [4]: w.set_node_property_mapping(custom_node_property_mapping) def del_node_property_mapping() Deleter for the node property mapping property. Remove a custom node property mapping. edge_property_mapping: Union[callable, str] Data dependent change of edge properties on a per edge basis. def get_edge_property_mapping() Getter for the edge property mapping property. Notes If no mapping is explicitly set, default_edge_property_mapping is returned. Returns Name Type Description edge_property_mapping Union[callable, str] A function that produces edge properties or the name of the property to use for binding. def set_edge_property_mapping(edge_property_mapping) Setter for the edge property mapping property. Parameters Name Type Description edge_property_mapping Union[callable, str] A function that produces edge properties or the name of the property to use for binding. The function should have the same signature as default_edge_property_mapping e.g. take in an edge dictionary and return a dictionary. Notes Properties are changed inplace by this mapping. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_property_mapping(node: dict): ... In [4]: w.set_edge_property_mapping(custom_edge_property_mapping) def del_edge_property_mapping() Deleter for the edge property mapping property. Remove a custom edge property mapping. node_color_mapping: Union[callable, str] Data dependent change of node color on a per node basis. def get_node_color_mapping() Getter for the node color mapping property. Notes If no mapping is explicitly set, default_node_color_mapping is returned. Returns Name Type Description node_color_mapping Union[callable, str] A function that produces node colors or the name of the property to use for binding. def set_node_color_mapping(node_color_mapping) Setter for the node color mapping property. Parameters Name Type Description node_color_mapping Union[callable, str] A function that produces node colors or the name of the property to use for binding. The function should have the same signature as default_node_color_mapping e.g. take in a node dictionary and return a string. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_color_mapping(node: dict): ... In [4]: w.set_node_color_mapping(custom_node_color_mapping) def del_node_color_mapping() Deleter for the node color mapping property. Remove a custom node color mapping. node_styles_mapping: Union[callable, str] Data dependent change of node styles on a per node basis. def get_node_styles_mapping() Getter for the node styles mapping property. Notes If no mapping is explicitly set, default_node_styles_mapping is returned. Returns Name Type Description node_styles_mapping Union[callable, str] A function that produces node styles or the name of the property to use for binding. def set_node_styles_mapping(node_styles_mapping) Setter for the node styles mapping property. Parameters Name Type Description node_styles_mapping Union[callable, str] A function that produces node styles or the name of the property to use for binding. The function should have the same signature as default_node_styles_mapping e.g. take in a node dictionary and return a string. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_styles_mapping(node: dict): ... In [4]: w.set_node_styles_mapping(custom_node_styles_mapping) def del_node_styles_mapping() Deleter for the node styles mapping property. Remove a custom node styles mapping. edge_styles_mapping: Union[callable, str] Data dependent change of edge styles on a per edge basis. def get_edge_styles_mapping() Getter for the edge styles mapping property. Notes If no mapping is explicitly set, default_edge_styles_mapping is returned. Returns Name Type Description edge_styles_mapping Union[callable, str] A function that produces edge styles or the name of the property to use for binding. def set_edge_styles_mapping(edge_styles_mapping) Setter for the edge styles mapping property. Parameters Name Type Description edge_styles_mapping Union[callable, str] A function that produces edge styles or the name of the property to use for binding. The function should have the same signature as default_edge_styles_mapping e.g. take in a edge dictionary and return a string. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_styles_mapping(edge: dict): ... In [4]: w.set_edge_styles_mapping(custom_edge_styles_mapping) def del_edge_styles_mapping() Deleter for the edge styles mapping property. Remove a custom edge styles mapping. edge_color_mapping: Union[callable, str] Data dependent change of edge color on a per edge basis. def get_edge_color_mapping() Getter for the edge color mapping property. Notes If no mapping is explicitly set, default_edge_color_mapping is returned. Returns Name Type Description edge_color_mapping Union[callable, str] A function that produces edge colors or the name of the property to use for binding. def set_edge_color_mapping(edge_color_mapping) Setter for the edge color mapping property. Parameters Name Type Description edge_color_mapping Union[callable, str] A function that produces edge colors or the name of the property to use for binding. The function should have the same signature as default_edge_color_mapping e.g. take in an edge dictionary and return a string. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_color_mapping(node: dict): ... In [4]: w.set_edge_color_mapping(custom_edge_color_mapping) def del_edge_color_mapping() Deleter for the edge color mapping property. Remove a custom edge color mapping. node_scale_factor_mapping: Union[callable, str] Data dependent change of node scale factor on a per node basis. def get_node_scale_factor_mapping() Getter for the node scale factor mapping property. Notes If no mapping is explicitly set, default_node_scale_factor_mapping is returned. Returns Name Type Description node_scale_factor_mapping Union[callable, str] A function that produces node scale factor or the name of the property to use for binding. def set_node_scale_factor_mapping(node_scale_factor_mapping) Setter for the node scale factor mapping property. Parameters Name Type Description node_scale_factor_mapping Union[callable, str] A function that produces node scale factors or the name of the property to use for binding. The function should have the same signature as default_node_scale_factor_mapping e.g. take in a node dictionary and return a positive float. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_scale_factor_mapping(node: dict): ... In [4]: w.set_node_scale_factor_mapping(custom_node_scale_factor_mapping) def del_node_scale_factor_mapping() Deleter for the node scale factor mapping property. Remove a custom node scale factor mapping. node_size_mapping: Union[callable, str] Data dependent change of node size on a per node basis. def get_node_size_mapping() Getter for the node size mapping property. Notes If no mapping is explicitly set, default_node_size_mapping is returned. Returns Name Type Description node_size_mapping Union[callable, str] A function that produces node sizes or the name of the property to use for binding. def set_node_size_mapping(node_size_mapping) Setter for the node size mapping property. A custom size mapping is only used if there is no custom node_layout mapping. If a custom node layout mapping and a custom size mapping is set, the node layout mapping always takes precedence. Parameters Name Type Description node_size_mapping Union[callable, str] A function that produces node sizes or the name of the property to use for binding. The function should have the same signature as default_node_size_mapping e.g. take in a node dictionary and return a positive float 2-tuple. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_size_mapping(node: dict): ... In [4]: w.set_node_size_mapping(custom_node_size_mapping) def del_node_size_mapping() Deleter for the node size mapping property. Remove a custom node size mapping. node_layout_mapping: Union[callable, str] Data dependent change of node layout on a per node basis. def get_node_layout_mapping() Getter for the node layout mapping property. Notes If no mapping is explicitly set, default_node_layout_mapping is returned. Node layouts combine node position and node size. The default node layout mapping is the currently set position and size mapping. If a custom size or position mapping is set using set_node_size_mapping or set_node_position_mapping , the default layout changes. If a custom node layout mapping and a custom size/position mapping is set, the layout mapping takes precedence. Returns Name Type Description node_layout_mapping Union[callable, str] A function that produces node layouts or the name of the property to use for binding. def set_node_layout_mapping(node_layout_mapping) Setter for the node layout mapping property. Parameters Name Type Description node_layout_mapping Union[callable, str] A function that produces node layouts or the name of the property to use for binding. The function should have the same signature as default_node_layout_mapping e.g. take in a node dictionary and return a positive float 4-tuple. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_layout_mapping(node: dict): ... In [4]: w.set_node_layout_mapping(custom_node_layout_mapping) def del_node_layout_mapping() Deleter for the node layout mapping property. Remove a custom node layout mapping. edge_thickness_factor_mapping: Union[callable, str] Data dependent change of edge thickness factor on a per edge basis. def get_edge_thickness_factor_mapping() Getter for the edge thickness factor mapping property. Notes If no mapping is explicitly set, default_edge_thickness_factor_mapping is returned. Returns Name Type Description edge_thickness_factor_mapping Union[callable, str] A function that produces edge thickness factors or the name of the property to use for binding. def set_edge_thickness_factor_mapping(edge_thickness_factor_mapping) Setter for the edge thickness factor mapping property. Parameters Name Type Description edge_thickness_factor_mapping Union[callable, str] A function that produces edge thickness factors or the name of the property to use for binding. The function should have the same signature as default_edge_thickness_factor_mapping e.g. take in an edge dictionary and return a positive float. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_thickness_factor_mapping(node: dict): ... In [4]: w.set_edge_thickness_factor_mapping(custom_edge_thickness_factor_mapping) def del_edge_thickness_factor_mapping() Deleter for the edge thickness factor mapping property. Remove a custom edge thickness factor mapping. node_type_mapping: Union[callable, str] Data dependent change of node type on a per node basis. def get_node_type_mapping() Getter for the node type mapping property. Notes If no mapping is explicitly set, default_node_type_mapping is returned. Returns Name Type Description node_type_mapping Union[callable, str] A function that produces node types or the name of the property to use for binding. def set_node_type_mapping(node_type_mapping) Setter for the node type mapping property. Parameters Name Type Description node_type_mapping Union[callable, str] A function that produces node types or the name of the property to use for binding. The function should have the same signature as default_node_type_mapping e.g. take in a node dictionary and return a bool/int/float or str value. Notes Node types give more information for some layout algorithms. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_type_mapping(node: dict): ... In [4]: w.set_node_type_mapping(custom_node_type_mapping) References Layout with Custom Node Types def del_node_type_mapping() Deleter for the node type mapping property. Remove a custom node type mapping. node_parent_mapping: Union[callable, str] Data dependent change of node parent on a per node basis. def get_node_parent_mapping() Getter for the node parent mapping property. Notes If no mapping is explicitly set, default_node_parent_mapping is returned. Returns Name parent Description node_parent_mapping Union[callable, str] A function that produces node parents or the name of the property to use for binding. def set_node_parent_mapping(node_parent_mapping) Setter for the node parent mapping property. Parameters Name parent Description node_parent_mapping Union[callable, str] A function that produces node parent ids or the name of the property to use for binding. The function should have the same signature as default_node_parent_mapping e.g. take in a node dictionary and return a bool/int/float or str value. Notes Given node parent ids create group nodes instead of regular nodes. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_parent_mapping(node: dict): ... In [4]: w.set_node_parent_mapping(custom_node_parent_mapping) def del_node_parent_mapping() Deleter for the node parent mapping property. Remove a custom node parent mapping. ### node_parent_group_mapping: Union[callable, str] Data dependent change of node parent group on a per node basis. def get_node_parent_group_mapping() Getter for the node parent group mapping property. Notes If no mapping is explicitly set, default_node_parent_group_mapping is returned. Returns Name Type Description node_parent_group_mapping Union[callable, str] A function that produces node parents or the name of the property to use for binding. def set_node_parent_group_mapping(node_parent_group_mapping) Setter for the node parent group mapping property. Parameters Name Type Description node_parent_group_mapping Union[callable, str] A function that produces node parents ids or the name of the property to use for binding. The function should have the same signature as default_node_parent_group_mapping e.g. take in a node dictionary and return a str/int/float or dict with a required label property. Notes For every returned parent group, a new group node is created. In contrast to node_parent_mapping this mapping does not require the group nodes to be part of the given node dataset. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_parent_group_mapping(node: dict): ... In [4]: w.set_node_parent_group_mapping(custom_node_parent_group_mapping) def del_node_parent_group_mapping() Deleter for the node parent group mapping property. Remove a custom node parent group mapping. node_position_mapping: Union[callable, str] Data dependent change of node position on a per node basis. def get_node_position_mapping() Getter for the node position mapping property. Notes If no mapping is explicitly set, default_node_position_mapping is returned. Returns Name Type Description node_position_mapping Union[callable, str] A function that produces node positions or the name of the property to use for binding. def set_node_position_mapping(node_position_mapping) Setter for the node position mapping property. A custom position mapping is only used if there is no custom node_layout mapping. If a custom node layout mapping and a custom position mapping is set, the node layout mapping takes precedence. Parameters Name Type Description node_position_mapping Union[callable, str] A function that produces node positions or the name of the property to use for binding. The function should have the same signature as default_node_position_mapping e.g. take in a node dictionary and return a float 2-tuple. Notes Only edge router algorithms consider node positions, all other algorithms calculate node positions themselves. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_position_mapping(node: dict): ... In [4]: w.set_node_position_mapping(custom_node_position_mapping) def del_node_position_mapping() Deleter for the node position mapping property. Remove a custom node position mapping. heat_mapping: Union[callable, str] Data dependent change of heat value on a per node and edge basis. def get_heat_mapping() Getter for the heat mapping property. Notes If no mapping is explicitly set, default_heat_mapping is returned. Returns Name Type Description heat_mapping Union[callable, str] A function that produces heat values or the name of the property to use for binding. def set_heat_mapping(heat_mapping) Setter for the heat mapping property. Parameters Name Type Description heat_mapping Union[callable, str] A function that produces heat values or the name of the property to use for binding. The function should have the same signature as default_heat_mapping e.g. take in a element dictionary and return a float. Notes This mapping is used for both edges and nodes Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_heat_mapping(element: dict): ... In [4]: w.set_heat_mapping(custom_heat_mapping) def del_heat_mapping() Deleter for the heat mapping property. Remove a custom heat mapping. node_coordinate_mapping: Union[callable, str] Data dependent change of node coordinate on a per node basis. def get_node_coordinate_mapping() Getter for the node coordinate mapping property. Notes If no mapping is explicitly set, default_node_coordinate_mapping is returned. Returns Name Type Description node_coordinate_mapping Union[callable, str] A function that produces node coordinates or the name of the property to use for binding. def set_node_coordinate_mapping(node_coordinate_mapping) Setter for the node coordinate mapping property. Parameters Name Type Description node_coordinate_mapping Union[callable, str] A function that produces node coordinates or the name of the property to use for binding. The function should have the same signature as default_node_coordinate_mapping e.g. take in a node dictionary and return a float 2-tuple. Notes Only the map layout consider node coordinates, all other algorithms ignore node coordinates. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_coordinate_mapping(node: dict): ... In [4]: w.set_node_coordinate_mapping(custom_node_coordinate_mapping) def del_node_coordinate_mapping() Deleter for the node coordinate mapping property. Remove a custom node coordinate mapping. directed_mapping: Union[callable, str] Data dependent change if an edge is directed or not. def get_directed_mapping() Getter for the directed mapping property. Notes If no mapping is explicitly set, default_directed_mapping is returned. Returns Name Type Description directed_mapping Union[callable, str] A function that produces edge directions or the name of the property to use for binding. def set_directed_mapping(directed_mapping) Setter for the directed mapping property. Parameters Name Type Description directed_mapping Union[callable, str] A function that produces edge directions or the name of the property to use for binding. The function should have the same signature as default_directed_mapping e.g. take in an edge dictionary and return a boolean value. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_directed_mapping(node: dict): ... In [4]: w.set_directed_mapping(custom_directed_mapping) def del_directed_mapping() Deleter for the directed mapping property. Remove a custom directed mapping. Methods def init (widget_layout = None, overview_enabled = None, context_start_with = '') GraphWidget constructor. Parameters Name Type Description widget_layout ipywidgets.Layout (optional) Can be used to specify general widget appearance through css attributes. See references for a link to their documentation and available keywords. overview_enabled bool (optional) Enable graph overview component. Default behaviour depends on cell width. context_start_with str (optional) Specify context tab name to start with that tab opened. Default behaviour is open with About dialog. Use None to start with closed sidebar. Available are Neighborhood , Data , Search and About . def show() Display widget in Jupyter. Same as using single object reference in cell directly. Notes Mappings will only be applied shortly before showing the widget. def import_graph(graph) Import a graph object defined in an external module. Sets the nodes , edges and directed traitlets properties with information extracted from the graph object. See graph importers for object specific transformation details. Parameters Name Type Description graph networkx.{Multi}{Di}Graph | graph_tool.Graph | igraph.Graph | pygraphviz.AGraph The graph data structure. Example In [1]: from networkx import florentine_families_graph In [2]: from yfiles_jupyter_graphs import GraphWidget In [3]: w = GraphWidget() In [4]: w.import_graph(florentine_families_graph()) Notes Some graph data structures have special attributes for labels, some don't. Same goes for other graph properties. This method and the underlying transformations should be seen as best effort to provide an easy way to input data into the widget. For more granular control use nodes and edges properties directly. def circular_layout() Alias for GraphWidget. graph_layout = \"circular\". See yFiles circular layout guide for more details about this specific algorithm. def circular_straight_line_layout() Alias for GraphWidget. graph_layout = \"circular_straight_line\". Similar to circular layout but with straight edge paths instead of bundled paths. See yFiles circular layout guide for more details about this specific algorithm. def hierarchic_layout() Alias for GraphWidget. graph_layout = \"hierarchic\". See yFiles hierarchic layout guide for more details about this specific algorithm. def organic_layout() Alias for GraphWidget. graph_layout = \"organic\". See yFiles organic layout guide for more details about this specific algorithm. def orthogonal_layout() Alias for GraphWidget. graph_layout = \"orthogonal\". See yFiles orthogonal layout guide for more details about this specific algorithm. def radial_layout() Alias for GraphWidget. graph_layout = \"radial\". See yFiles radial layout guide for more details about this specific algorithm. def tree_layout() Alias for GraphWidget. graph_layout = \"tree\". See yFiles tree layout guide for more details about this specific algorithm. def orthogonal_edge_router() Alias for GraphWidget. graph_layout = \"orthogonal_edge_router\". See yFiles orthogonal edge router guide for more details about this specific algorithm. def interactive_organic_layout() Alias for GraphWidget. graph_layout = \"interactive_organic_layout\". See yFiles interactive organic layout guide for more details about this specific algorithm. def organic_edge_router() Alias for GraphWidget. graph_layout = \"organic_edge_router\". See yFiles organic edge router guide for more details about this specific algorithm. def default_element_label_mapping(index, element) The default property mapping for graph elements. The default label mapping for graph elements. Element (dict) should have key properties which itself should be a dict. Then one of the following values (in descending priority) is used as label if the label is a string: - properties[\"label\"] - properties[\"yf_label\"] When importing a Neo4j graph, the following properties are values are used as labels (in descending priority): properties['name'] properties['title'] properties['label'] properties['description'] properties['caption'] properties['text'] Parameters Name Type Description index int (optional) Position in corresponding nodes or edges list. element typing.Dict Can be both node or edge. Notes This is the default value for the { node | edge }_label_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: w.{node|edge}_label_mapping = 'id' In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_element_label_mapping(element: typing.Dict): ... In [4]: w.set_{node|edge}_label_mapping(custom_element_label_mapping) Returns Name Type Description label str The node or edge label. label typing.Dict | A Dict` with mappings for style attributes. See below for supported values. Supported style attributes in the return Dict : can contain the following key-value-pairs: \"text\": str Is used as the label. \"fontSize\": number Sets the size of the font. \"color\": string Css color value for the text color. \"backgroundColor\": str Css color value for the background color. \"position\": 'center' | 'north' | 'east' | 'south' | 'west' The label position at the node. Applies only to node labels. \"maximumWidth\": number The maximum width of the label. By default, the label is clipped at the given size, or wrapped when \"wrapping\" is set. \"maximumHeight\": number The maximum height of the label. Clips the label at the given height. May be combined with \"wrapping\". \"wrapping\": 'character' | 'character_ellipsis' | 'none' | 'word' | 'word_ellipsis' Text wrapping for the label. Must be set in combination with \"maximumWidth\". \"textAlignment\": 'center' | 'left' | 'right' The horizontal text alignment when \"wrapping\" is enabled. \"fontWeight\": 'bold' | 'bolder' | 'lighter' | 'normal'`: The font thickness. def default_node_label_mapping(index, node) The default label mapping for nodes. See default_element_label_mapping . def default_edge_label_mapping(index, edge) The default label mapping for edges. See default_element_label_mapping . def default_element_property_mapping(index, element) The default property mapping for graph elements. Simply selects the properties value of element dictionary. Parameters Name Type Description index int (optional) Position in corresponding nodes or edges list. element typing.Dict Can be both node or edge. Notes This is the default value for the { node | edge }_property_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. When a string is provided as the function argument, the key will be searched for in both the properties dictionary and the element keys. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_element_property_mapping(element: typing.Dict): ... In [4]: w.set_{node|edge}_property_mapping(custom_element_property_mapping) Returns Name Type Description properties typing.Dict The node or edge properties. def default_node_property_mapping(index, node) The default property mapping for nodes. See default_element_property_mapping . def default_edge_property_mapping(index, edge) The default property mapping for edges. See default_element_property_mapping . def default_node_color_mapping(index, node) The default color mapping for nodes. Provides constant value of '#15afac' for all nodes. Parameters Name Type Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_color_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_color_mapping(node: typing.Dict): ... In [4]: w.set_node_color_mapping(custom_node_color_mapping) Returns Name Type Description color str CSS color value. References css color value yFiles docs Fill api def default_node_styles_mapping(index, node) The default styles mapping for nodes. Provides constant value of {} for all nodes. Parameters Name Type Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_styles_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_styles_mapping(node: typing.Dict): ... In [4]: w.set_node_styles_mapping(custom_node_styles_mapping) Returns Name Type Description styles typing.Dict A Dict with mappings for style attributes. See below for supported values. Supported style attributes in the return Dict : can contain the following key-value-pairs: \"color\": str CSS color value. \"shape\": str The shape of the node. Possible values: 'ellipse', 'hexagon', 'hexagon2', 'octagon', 'pill', 'rectangle', 'round-rectangle' or 'triangle'. \"image\": str Url or data URL of the image. References css color value Data URL def default_edge_styles_mapping(index, edge) The default styles mapping for edges. Provides constant value of {} for all edges. Parameters Name Type Description index int (optional) Position in edges list. edge typing.Dict Notes This is the default value for the edge_styles_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_styles_mapping(edge: typing.Dict): ... In [4]: w.set_edge_styles_mapping(custom_edge_styles_mapping) Returns Name Type Description styles typing.Dict A Dict with mappings for style attributes. See below for supported values. Supported style attributes in the return Dict : can contain the following key-value-pairs: \"color\": str CSS color value. \"directed\": bool Whether the edge should be visualized with a target arrow. \"thickness\": float The thickness of the stroke of the edge. \"dashStyle\": str The dash styling of the edge. Can be one of the following strings: - \"solid\" - \"dash\" - \"dot\" - \"dash-dot\" - \"dash-dot-dot\" - \"5 10\" - \"5, 10\" - ... References css color value Data URL def default_edge_color_mapping(index, edge) The default color mapping for edges. Provides constant value of '#15afac' for all edges. Parameters Name Type Description index int (optional) Position in edges list. edge typing.Dict Notes This is the default value for the edge_color_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_color_mapping(edge: typing.Dict): ... In [4]: w.set_edge_color_mapping(custom_edge_color_mapping) Returns Name Type Description color str CSS color value. References css color value yFiles docs Fill api def default_node_scale_factor_mapping(index, node) The default scale factor mapping for nodes. Provides constant value of 1.0 for all nodes. Parameters Name Type Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_scale_factor_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_scale_factor_mapping(node: typing.Dict): ... In [4]: w.set_node_scale_factor_mapping(custom_node_scale_factor_mapping) Returns Name Type Description node_scale_factor float Positive scale factor. def default_node_size_mapping(index, node) The default size mapping for nodes. Provides constant value of [55.0,55.0] for all nodes. Parameters Name Type Description index int Position in nodes list. node typing.Dict Notes This is the default value for the node_size_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_size_mapping(node: typing.Dict): ... In [4]: w.set_node_size_mapping(custom_node_size_mapping) Returns Name Type Description node_size float 2-tuple size in (width, height). def default_node_layout_mapping(index, node) The default layout mapping for nodes. Provides constant value of [0.00, 0.00, 55.0, 55.0] for all nodes. Parameters Name Type Description index int Position in nodes list. node typing.Dict Notes This is the default value for the node_layout_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_layout_mapping(node: typing.Dict): ... In [4]: w.set_node_layout_mapping(custom_node_layout_mapping) Returns Name Type Description node_layout float 4-tuple layout containin position and size: (x, y, width, height). def default_heat_mapping(index, node) The default heat mapping for nodes and edges. Provides constant value of None for all nodes and edges. Parameters Name Type Description index int Position in element list. element typing.Dict Notes This is the default value for the heat_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_heat_mapping(node: typing.Dict): ... In [4]: w.set_heat_mapping(custom_heat_mapping) Returns Name Type Description heat float The heat can be a number between 0 and 1. def default_edge_thickness_factor_mapping(index, edge) The default thickness factor mapping for edges. Provides constant value of 1.0 for all edges. Parameters Name Type Description index int (optional) Position in edges list. edge typing.Dict Notes This is the default value for the edge_thickness_factor_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_thickness_factor_mapping(edge: typing.Dict): ... In [4]: w.set_edge_thickness_factor_mapping(custom_edge_thickness_factor_mapping) Returns Name Type Description edge_thickness_factor float Positive thickness factor. def default_node_type_mapping(index, node) The default type mapping for nodes. Provides constant value of None for all nodes. Parameters Name Type Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_type_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_type_mapping(node: typing.Dict): ... In [4]: w.set_node_type_mapping(custom_node_type_mapping) Returns Name Type Description node_type None Node Type. def default_node_parent_mapping(index, node) The default parent mapping for nodes. Provides constant value of None for all nodes. Parameters Name parent Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_parent_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_parent_mapping(node: typing.Dict): ... In [4]: w.set_node_parent_mapping(custom_node_parent_mapping) Returns Name parent Description node_parent None Node parent Id. def default_node_parent_group_mapping(index, node) The default parent group mapping for nodes. Provides constant value of None for all nodes. Parameters Name parent Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_parent_group_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_parent_group_mapping(node: typing.Dict): ... In [4]: w.set_node_parent_group_mapping(custom_node_parent_group_mapping) Returns Name parent Description node_parent_group None Node parent label. def default_node_position_mapping(index, node) The default position mapping for nodes. Provides constant value of [0.0, 0.0] for all nodes. Parameters Name Type Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_position_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_position_mapping(node: typing.Dict): ... In [4]: w.set_node_position_mapping(custom_node_position_mapping) Returns Name Type Description node_position float 2-tuple Position in euclidian plane. def default_node_coordinate_mapping(index, node) The default coordinate mapping for nodes. Provides constant value of None for all nodes. There is no coordinate mapping unless explicitly set. Parameters Name Type Description index int (optional) position in nodes list. node typing.Dict Notes This is the default value for the node_coordinate_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_coordinate_mapping(node: typing.Dict): ... In [4]: w.set_node_coordinate_mapping(custom_node_coordinate_mapping) Returns Name Type Description node_coordinate float 2-tuple geo coordinates in latitude and longitude . def default_directed_mapping(index, edge) The default directed mapping for edges. Uses the graph wide directed attribute for all edges. Parameters Name Type Description index int (optional) Position in edges list. edge typing.Dict Notes This is the default value for the directed_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_directed_mapping(edge: typing.Dict): ... In [4]: w.set_directed_mapping(custom_directed_mapping) Returns Name Type Description directed bool Whether the edge is directed or not.","title":"GraphWidget"},{"location":"02_graph_widget/#graphwidget","text":"Class Inherits from ipywidgets.DOMWidget The main widget class. To be used in jupyter-notebook or jupyter-lab.","title":"GraphWidget"},{"location":"02_graph_widget/#example","text":"from yfiles_jupyter_graphs import GraphWidget w = GraphWidget() w.show() See notebooks for more examples.","title":"Example"},{"location":"02_graph_widget/#notes","text":"Nodes and edges properties should be constructed recursively with basic python types otherwise {de-}serializers will fail.","title":"Notes"},{"location":"02_graph_widget/#properties","text":"","title":"Properties"},{"location":"02_graph_widget/#nodes-typinglisttypingdict","text":"Data structure. def get_nodes() Getter for the nodes traitlets property. Notes This function acts as an alias for using GraphWidget.nodes property e.g. w.nodes == w.get_nodes() . Returns Name Type Description nodes typing.List[typing.Dict] Each node has the keys id: int and properties: typing.Dict . It might include keys that are not set directly, see (default) node mappings for details. def set_nodes(nodes) Setter for the nodes traitlets property. Parameters Name Type Description nodes typing.List[typing.Dict] Each node should have the keys id: int and properties: typing.Dict . Properties should be constructed recursively with basic python types, otherwise {de-}serializers will fail. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: w.set_nodes([ {'id': 0, 'properties': {'label': 'Hello World'}}, {'id': 1, 'properties': {'label': 'This is a second node.'}} ]) Notes This function acts as an alias for using GraphWidget.nodes property e.g. w.nodes = [{...}] has the same effect as using w.set_nodes([{...}]) .","title":"nodes: typing.List[typing.Dict]"},{"location":"02_graph_widget/#edges-typinglisttypingdict","text":"Data structure. def get_edges() Getter for the edges traitlets property. Notes This function acts as an alias for using GraphWidget.edges property e.g. w.edges == w.get_edges() is true . Returns Name Type Description edges typing.List[typing.Dict] Each edge has the keys id: int , start: int , end: int and properties: typing.Dict . It might include keys that are not set directly, see (default) edge mappings for details. def set_edges(edges) Setter for the edges traitlets property. Parameters Name Type Description edges typing.List[typing.Dict] Each edge should have the keys id: int , start: int , end:int and properties: typing.Dict . Ids for start and end should be among used node ids, otherwise the edge does not appear. Properties should be constructed recursively with basic python types, otherwise {de-}serializers will fail. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: w.set_edges([ {'id': 0, 'start': 0, 'end': 1, 'properties': {'label': 'edge between first and second node'}} ]) Notes This function acts as an alias for using GraphWidget.edges property e.g. w.edges = [{...}] has the same effect as using w.set_edges([{...}]) .","title":"edges: typing.List[typing.Dict]"},{"location":"02_graph_widget/#def-get_selection","text":"Returns the nodes and edges, that are selected in the displayed widget. Returns Name Type Description nodes typing.List[typing.Dict] List of selected nodes. edges typing.List[typing.Dict] List of selected edges.","title":"def get_selection()"},{"location":"02_graph_widget/#directed-bool","text":"Graph wide flag for edge type. def get_directed() Getter for the directed traitlets property. Notes This function acts as an alias for using GraphWidget.directed property e.g. w.directed == w.get_directed() is true . Returns Name Type Description directed bool Whether the graph is interpreted as directed. def set_directed(directed) Setter for the directed traitlets property. Parameters Name Type Description directed bool Whether the graph is interpreted as directed. Notes This function acts as an alias for using GraphWidget.directed property e.g. w.directed = x has the same effect as using w.set_directed(x) .","title":"directed: bool"},{"location":"02_graph_widget/#graph_layout-typingdict","text":"Choose an algorithm for positioning nodes and/or edges. def get_graph_layout() Getter for the graph layout traitlet property. Notes This function acts as an alias for using GraphWidget.graph_layout property e.g. w.graph_layout == w.get_graph_layout() is true . Returns Name Type Description graph_layout typing.Dict Returned dict has keys algorithm: str and options: dict, however options are empty because the algorithms use default settings from yFiles library. def set_graph_layout(algorithm) Choose graph layout. Currently the algorithms use default settings from yFiles library. Parameters Name Type Description algorithm str Specify graph layout (or edge router) algorithm. Available algorithms are: [\"circular\", \"circular_straight_line\", \"hierarchic\", \"organic\", \"interactive_organic\", \"orthogonal\", \"radial\", \"tree\", \"map\", \"orthogonal_edge_router\", \"organic_edge_router\"] Notes This function acts as an alias for using GraphWidget.graph_layout property e.g. w.graph_layout = 'organic' has the same effect as using w.set_graph_layout('organic') . Setting w.graph_layout = {'algorithm': 'organic', 'options': {}} works as well, which corresponds to using value given through the associated getter. In case you want to use the edge routers you should set a custom node position mapping as well. See yFiles docs for more details about the algorithms.","title":"graph_layout: typing.Dict"},{"location":"02_graph_widget/#neighborhood-typingdict","text":"Control neighborhood view component. def get_neighborhood() Getter for the neighborhood traitlets property. Returns Name Type Description neighborhood typing.Dict Returned dict has keys max_distance: int and selected_nodes: list, a list of node ids. def set_neighborhood(max_distance, selected_nodes) Specify the neighborhood view in the widget. The number of hops and focused nodes can be chosen. Parameters Name Type Description max_distance int Set the maximum distance between selected and included nodes. If there are multiple paths to one (or multiple) selected nodes, the smallest path length is considered for this threshold. selected_nodes typing.List (optional) Choose a list of node ids that are highlighted in both main and neighborhood component. They act as starting points for neighborhood calculation. Notes This function acts as an alias for using GraphWidget.neighborhood property. You can assign values by w.neighborhood = {'max_distance': 2, 'selected_nodes':[2]} or w.set_neighborhood(2, [2]) , both are equivalent. The short form w.neighborhood = 3 sets only the max_distance variable and resets the selected nodes.","title":"neighborhood: typing.Dict"},{"location":"02_graph_widget/#sidebar-typingdict","text":"Control sidebar component. def get_sidebar() Getter for the sidebar traitlets property. Returns Name Type Description sidebar typing.Dict Returned dict has keys enabled: bool and start_with: str, whereat first one indicates open or closed sidebar and second one indicates start panel on widget show. def set_sidebar(enabled, start_with) Specify the appearance of the sidebar in the widget. Can be used to collapse sidebar or start with any panel. Parameters Name Type Description enabled bool Whether to open or collapse sidebar at widget startup. start_with str The start panel identifier. Available are 'Neighborhood', 'Data', 'Search' and 'About' (the default). Notes This function acts as an alias for using GraphWidget.sidebar property. You can assign values by w.sidebar = {'enabled': True, 'start_with': 'Search'} or w.set_sidebar(True, 'Search') , both are equivalent. The short form w.sidebar = True sets only the enabled variable and resets the start_with back to the default.","title":"sidebar: typing.Dict"},{"location":"02_graph_widget/#overview-bool","text":"Control overview component. def get_overview() Getter for the overview traitlets property. Returns Name Type Description overview bool Indicates open or closed overview state. A value of None means that a specific behaviour based on widget layout is followed. def set_overview(enabled) Specify the appearance of the overview component in the widget. Can be used to force open overview in case of a small widget layout or force collapsed overview in case of large widget layout. Parameters Name Type Description enabled bool Whether to open or collapse overview at widget startup.","title":"overview: bool"},{"location":"02_graph_widget/#node_label_mapping-unioncallable-str","text":"Data dependent change of node label on a per node basis. def get_node_label_mapping() Getter for the node label mapping property. Notes If no mapping is explicitly set, default_node_label_mapping is returned. Returns Name Type Description node_label_mapping Union[callable, str] A function that produces node labels or the name of the property to use for binding. def set_node_label_mapping(node_label_mapping) Setter for the node label mapping property. Parameters Name Type Description node_label_mapping Union[callable, str] A function that produces node labels or the name of the property to use for binding. The function should have the same signature as default_node_label_mapping e.g. take in a node dictionary and return a string. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: w.node_label_mapping = 'id' In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_label_mapping(node: dict): ... In [4]: w.set_node_label_mapping(custom_node_label_mapping) def del_node_label_mapping() Deleter for the name property. Remove a custom node label mapping.","title":"node_label_mapping: Union[callable, str]"},{"location":"02_graph_widget/#edge_label_mapping-unioncallable-str","text":"Data dependent change of edge label on a per edge basis. def get_edge_label_mapping() Getter for the edge label mapping property. Notes If no mapping is explicitly set, default_edge_label_mapping is returned. Returns Name Type Description edge_label_mapping Union[callable, str] A function that produces edge labels or the name of the property to use for binding. def set_edge_label_mapping(edge_label_mapping) Setter for the edge label mapping property. Parameters Name Type Description edge_label_mapping Union[callable, str] A function that produces edge labels or the name of the property to use for binding. The funtion should have the same signature as default_edge_label_mapping e.g. take in an edge dictionary and return a string. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: w.edge_label_mapping = 'id' In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_label_mapping(node: dict): ... In [4]: w.set_edge_label_mapping(custom_edge_label_mapping) def del_edge_label_mapping() Deleter for the edge label mapping property. Remove a custom edge label mapping.","title":"edge_label_mapping: Union[callable, str]"},{"location":"02_graph_widget/#node_property_mapping-unioncallable-str","text":"Data dependent change of node properties on a per node basis. def get_node_property_mapping() Getter for the node property mapping property. Notes If no mapping is explicitly set, default_node_property_mapping is returned. Returns Name Type Description node_property_mapping Union[callable, str] A function that produces node properties or the name of the property to use for binding. def set_node_property_mapping(node_property_mapping) Setter for the node property mapping property. Parameters Name Type Description node_property_mapping Union[callable, str] A function that produces node properties or the name of the property to use for binding. The function should have the same signature as default_node_property_mapping e.g. take in a node dictionary and return a dictionary. Notes Properties are changed inplace by this mapping. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_property_mapping(node: dict): ... In [4]: w.set_node_property_mapping(custom_node_property_mapping) def del_node_property_mapping() Deleter for the node property mapping property. Remove a custom node property mapping.","title":"node_property_mapping: Union[callable, str]"},{"location":"02_graph_widget/#edge_property_mapping-unioncallable-str","text":"Data dependent change of edge properties on a per edge basis. def get_edge_property_mapping() Getter for the edge property mapping property. Notes If no mapping is explicitly set, default_edge_property_mapping is returned. Returns Name Type Description edge_property_mapping Union[callable, str] A function that produces edge properties or the name of the property to use for binding. def set_edge_property_mapping(edge_property_mapping) Setter for the edge property mapping property. Parameters Name Type Description edge_property_mapping Union[callable, str] A function that produces edge properties or the name of the property to use for binding. The function should have the same signature as default_edge_property_mapping e.g. take in an edge dictionary and return a dictionary. Notes Properties are changed inplace by this mapping. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_property_mapping(node: dict): ... In [4]: w.set_edge_property_mapping(custom_edge_property_mapping) def del_edge_property_mapping() Deleter for the edge property mapping property. Remove a custom edge property mapping.","title":"edge_property_mapping: Union[callable, str]"},{"location":"02_graph_widget/#node_color_mapping-unioncallable-str","text":"Data dependent change of node color on a per node basis. def get_node_color_mapping() Getter for the node color mapping property. Notes If no mapping is explicitly set, default_node_color_mapping is returned. Returns Name Type Description node_color_mapping Union[callable, str] A function that produces node colors or the name of the property to use for binding. def set_node_color_mapping(node_color_mapping) Setter for the node color mapping property. Parameters Name Type Description node_color_mapping Union[callable, str] A function that produces node colors or the name of the property to use for binding. The function should have the same signature as default_node_color_mapping e.g. take in a node dictionary and return a string. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_color_mapping(node: dict): ... In [4]: w.set_node_color_mapping(custom_node_color_mapping) def del_node_color_mapping() Deleter for the node color mapping property. Remove a custom node color mapping.","title":"node_color_mapping: Union[callable, str]"},{"location":"02_graph_widget/#node_styles_mapping-unioncallable-str","text":"Data dependent change of node styles on a per node basis. def get_node_styles_mapping() Getter for the node styles mapping property. Notes If no mapping is explicitly set, default_node_styles_mapping is returned. Returns Name Type Description node_styles_mapping Union[callable, str] A function that produces node styles or the name of the property to use for binding. def set_node_styles_mapping(node_styles_mapping) Setter for the node styles mapping property. Parameters Name Type Description node_styles_mapping Union[callable, str] A function that produces node styles or the name of the property to use for binding. The function should have the same signature as default_node_styles_mapping e.g. take in a node dictionary and return a string. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_styles_mapping(node: dict): ... In [4]: w.set_node_styles_mapping(custom_node_styles_mapping) def del_node_styles_mapping() Deleter for the node styles mapping property. Remove a custom node styles mapping.","title":"node_styles_mapping: Union[callable, str]"},{"location":"02_graph_widget/#edge_styles_mapping-unioncallable-str","text":"Data dependent change of edge styles on a per edge basis. def get_edge_styles_mapping() Getter for the edge styles mapping property. Notes If no mapping is explicitly set, default_edge_styles_mapping is returned. Returns Name Type Description edge_styles_mapping Union[callable, str] A function that produces edge styles or the name of the property to use for binding. def set_edge_styles_mapping(edge_styles_mapping) Setter for the edge styles mapping property. Parameters Name Type Description edge_styles_mapping Union[callable, str] A function that produces edge styles or the name of the property to use for binding. The function should have the same signature as default_edge_styles_mapping e.g. take in a edge dictionary and return a string. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_styles_mapping(edge: dict): ... In [4]: w.set_edge_styles_mapping(custom_edge_styles_mapping) def del_edge_styles_mapping() Deleter for the edge styles mapping property. Remove a custom edge styles mapping.","title":"edge_styles_mapping: Union[callable, str]"},{"location":"02_graph_widget/#edge_color_mapping-unioncallable-str","text":"Data dependent change of edge color on a per edge basis. def get_edge_color_mapping() Getter for the edge color mapping property. Notes If no mapping is explicitly set, default_edge_color_mapping is returned. Returns Name Type Description edge_color_mapping Union[callable, str] A function that produces edge colors or the name of the property to use for binding. def set_edge_color_mapping(edge_color_mapping) Setter for the edge color mapping property. Parameters Name Type Description edge_color_mapping Union[callable, str] A function that produces edge colors or the name of the property to use for binding. The function should have the same signature as default_edge_color_mapping e.g. take in an edge dictionary and return a string. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_color_mapping(node: dict): ... In [4]: w.set_edge_color_mapping(custom_edge_color_mapping) def del_edge_color_mapping() Deleter for the edge color mapping property. Remove a custom edge color mapping.","title":"edge_color_mapping: Union[callable, str]"},{"location":"02_graph_widget/#node_scale_factor_mapping-unioncallable-str","text":"Data dependent change of node scale factor on a per node basis. def get_node_scale_factor_mapping() Getter for the node scale factor mapping property. Notes If no mapping is explicitly set, default_node_scale_factor_mapping is returned. Returns Name Type Description node_scale_factor_mapping Union[callable, str] A function that produces node scale factor or the name of the property to use for binding. def set_node_scale_factor_mapping(node_scale_factor_mapping) Setter for the node scale factor mapping property. Parameters Name Type Description node_scale_factor_mapping Union[callable, str] A function that produces node scale factors or the name of the property to use for binding. The function should have the same signature as default_node_scale_factor_mapping e.g. take in a node dictionary and return a positive float. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_scale_factor_mapping(node: dict): ... In [4]: w.set_node_scale_factor_mapping(custom_node_scale_factor_mapping) def del_node_scale_factor_mapping() Deleter for the node scale factor mapping property. Remove a custom node scale factor mapping.","title":"node_scale_factor_mapping: Union[callable, str]"},{"location":"02_graph_widget/#node_size_mapping-unioncallable-str","text":"Data dependent change of node size on a per node basis. def get_node_size_mapping() Getter for the node size mapping property. Notes If no mapping is explicitly set, default_node_size_mapping is returned. Returns Name Type Description node_size_mapping Union[callable, str] A function that produces node sizes or the name of the property to use for binding. def set_node_size_mapping(node_size_mapping) Setter for the node size mapping property. A custom size mapping is only used if there is no custom node_layout mapping. If a custom node layout mapping and a custom size mapping is set, the node layout mapping always takes precedence. Parameters Name Type Description node_size_mapping Union[callable, str] A function that produces node sizes or the name of the property to use for binding. The function should have the same signature as default_node_size_mapping e.g. take in a node dictionary and return a positive float 2-tuple. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_size_mapping(node: dict): ... In [4]: w.set_node_size_mapping(custom_node_size_mapping) def del_node_size_mapping() Deleter for the node size mapping property. Remove a custom node size mapping.","title":"node_size_mapping: Union[callable, str]"},{"location":"02_graph_widget/#node_layout_mapping-unioncallable-str","text":"Data dependent change of node layout on a per node basis. def get_node_layout_mapping() Getter for the node layout mapping property. Notes If no mapping is explicitly set, default_node_layout_mapping is returned. Node layouts combine node position and node size. The default node layout mapping is the currently set position and size mapping. If a custom size or position mapping is set using set_node_size_mapping or set_node_position_mapping , the default layout changes. If a custom node layout mapping and a custom size/position mapping is set, the layout mapping takes precedence. Returns Name Type Description node_layout_mapping Union[callable, str] A function that produces node layouts or the name of the property to use for binding. def set_node_layout_mapping(node_layout_mapping) Setter for the node layout mapping property. Parameters Name Type Description node_layout_mapping Union[callable, str] A function that produces node layouts or the name of the property to use for binding. The function should have the same signature as default_node_layout_mapping e.g. take in a node dictionary and return a positive float 4-tuple. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_layout_mapping(node: dict): ... In [4]: w.set_node_layout_mapping(custom_node_layout_mapping) def del_node_layout_mapping() Deleter for the node layout mapping property. Remove a custom node layout mapping.","title":"node_layout_mapping: Union[callable, str]"},{"location":"02_graph_widget/#edge_thickness_factor_mapping-unioncallable-str","text":"Data dependent change of edge thickness factor on a per edge basis. def get_edge_thickness_factor_mapping() Getter for the edge thickness factor mapping property. Notes If no mapping is explicitly set, default_edge_thickness_factor_mapping is returned. Returns Name Type Description edge_thickness_factor_mapping Union[callable, str] A function that produces edge thickness factors or the name of the property to use for binding. def set_edge_thickness_factor_mapping(edge_thickness_factor_mapping) Setter for the edge thickness factor mapping property. Parameters Name Type Description edge_thickness_factor_mapping Union[callable, str] A function that produces edge thickness factors or the name of the property to use for binding. The function should have the same signature as default_edge_thickness_factor_mapping e.g. take in an edge dictionary and return a positive float. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_thickness_factor_mapping(node: dict): ... In [4]: w.set_edge_thickness_factor_mapping(custom_edge_thickness_factor_mapping) def del_edge_thickness_factor_mapping() Deleter for the edge thickness factor mapping property. Remove a custom edge thickness factor mapping.","title":"edge_thickness_factor_mapping: Union[callable, str]"},{"location":"02_graph_widget/#node_type_mapping-unioncallable-str","text":"Data dependent change of node type on a per node basis. def get_node_type_mapping() Getter for the node type mapping property. Notes If no mapping is explicitly set, default_node_type_mapping is returned. Returns Name Type Description node_type_mapping Union[callable, str] A function that produces node types or the name of the property to use for binding. def set_node_type_mapping(node_type_mapping) Setter for the node type mapping property. Parameters Name Type Description node_type_mapping Union[callable, str] A function that produces node types or the name of the property to use for binding. The function should have the same signature as default_node_type_mapping e.g. take in a node dictionary and return a bool/int/float or str value. Notes Node types give more information for some layout algorithms. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_type_mapping(node: dict): ... In [4]: w.set_node_type_mapping(custom_node_type_mapping) References Layout with Custom Node Types def del_node_type_mapping() Deleter for the node type mapping property. Remove a custom node type mapping.","title":"node_type_mapping: Union[callable, str]"},{"location":"02_graph_widget/#node_parent_mapping-unioncallable-str","text":"Data dependent change of node parent on a per node basis. def get_node_parent_mapping() Getter for the node parent mapping property. Notes If no mapping is explicitly set, default_node_parent_mapping is returned. Returns Name parent Description node_parent_mapping Union[callable, str] A function that produces node parents or the name of the property to use for binding. def set_node_parent_mapping(node_parent_mapping) Setter for the node parent mapping property. Parameters Name parent Description node_parent_mapping Union[callable, str] A function that produces node parent ids or the name of the property to use for binding. The function should have the same signature as default_node_parent_mapping e.g. take in a node dictionary and return a bool/int/float or str value. Notes Given node parent ids create group nodes instead of regular nodes. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_parent_mapping(node: dict): ... In [4]: w.set_node_parent_mapping(custom_node_parent_mapping) def del_node_parent_mapping() Deleter for the node parent mapping property. Remove a custom node parent mapping. ### node_parent_group_mapping: Union[callable, str] Data dependent change of node parent group on a per node basis. def get_node_parent_group_mapping() Getter for the node parent group mapping property. Notes If no mapping is explicitly set, default_node_parent_group_mapping is returned. Returns Name Type Description node_parent_group_mapping Union[callable, str] A function that produces node parents or the name of the property to use for binding. def set_node_parent_group_mapping(node_parent_group_mapping) Setter for the node parent group mapping property. Parameters Name Type Description node_parent_group_mapping Union[callable, str] A function that produces node parents ids or the name of the property to use for binding. The function should have the same signature as default_node_parent_group_mapping e.g. take in a node dictionary and return a str/int/float or dict with a required label property. Notes For every returned parent group, a new group node is created. In contrast to node_parent_mapping this mapping does not require the group nodes to be part of the given node dataset. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_parent_group_mapping(node: dict): ... In [4]: w.set_node_parent_group_mapping(custom_node_parent_group_mapping) def del_node_parent_group_mapping() Deleter for the node parent group mapping property. Remove a custom node parent group mapping.","title":"node_parent_mapping: Union[callable, str]"},{"location":"02_graph_widget/#node_position_mapping-unioncallable-str","text":"Data dependent change of node position on a per node basis. def get_node_position_mapping() Getter for the node position mapping property. Notes If no mapping is explicitly set, default_node_position_mapping is returned. Returns Name Type Description node_position_mapping Union[callable, str] A function that produces node positions or the name of the property to use for binding. def set_node_position_mapping(node_position_mapping) Setter for the node position mapping property. A custom position mapping is only used if there is no custom node_layout mapping. If a custom node layout mapping and a custom position mapping is set, the node layout mapping takes precedence. Parameters Name Type Description node_position_mapping Union[callable, str] A function that produces node positions or the name of the property to use for binding. The function should have the same signature as default_node_position_mapping e.g. take in a node dictionary and return a float 2-tuple. Notes Only edge router algorithms consider node positions, all other algorithms calculate node positions themselves. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_position_mapping(node: dict): ... In [4]: w.set_node_position_mapping(custom_node_position_mapping) def del_node_position_mapping() Deleter for the node position mapping property. Remove a custom node position mapping.","title":"node_position_mapping: Union[callable, str]"},{"location":"02_graph_widget/#heat_mapping-unioncallable-str","text":"Data dependent change of heat value on a per node and edge basis. def get_heat_mapping() Getter for the heat mapping property. Notes If no mapping is explicitly set, default_heat_mapping is returned. Returns Name Type Description heat_mapping Union[callable, str] A function that produces heat values or the name of the property to use for binding. def set_heat_mapping(heat_mapping) Setter for the heat mapping property. Parameters Name Type Description heat_mapping Union[callable, str] A function that produces heat values or the name of the property to use for binding. The function should have the same signature as default_heat_mapping e.g. take in a element dictionary and return a float. Notes This mapping is used for both edges and nodes Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_heat_mapping(element: dict): ... In [4]: w.set_heat_mapping(custom_heat_mapping) def del_heat_mapping() Deleter for the heat mapping property. Remove a custom heat mapping.","title":"heat_mapping: Union[callable, str]"},{"location":"02_graph_widget/#node_coordinate_mapping-unioncallable-str","text":"Data dependent change of node coordinate on a per node basis. def get_node_coordinate_mapping() Getter for the node coordinate mapping property. Notes If no mapping is explicitly set, default_node_coordinate_mapping is returned. Returns Name Type Description node_coordinate_mapping Union[callable, str] A function that produces node coordinates or the name of the property to use for binding. def set_node_coordinate_mapping(node_coordinate_mapping) Setter for the node coordinate mapping property. Parameters Name Type Description node_coordinate_mapping Union[callable, str] A function that produces node coordinates or the name of the property to use for binding. The function should have the same signature as default_node_coordinate_mapping e.g. take in a node dictionary and return a float 2-tuple. Notes Only the map layout consider node coordinates, all other algorithms ignore node coordinates. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_coordinate_mapping(node: dict): ... In [4]: w.set_node_coordinate_mapping(custom_node_coordinate_mapping) def del_node_coordinate_mapping() Deleter for the node coordinate mapping property. Remove a custom node coordinate mapping.","title":"node_coordinate_mapping: Union[callable, str]"},{"location":"02_graph_widget/#directed_mapping-unioncallable-str","text":"Data dependent change if an edge is directed or not. def get_directed_mapping() Getter for the directed mapping property. Notes If no mapping is explicitly set, default_directed_mapping is returned. Returns Name Type Description directed_mapping Union[callable, str] A function that produces edge directions or the name of the property to use for binding. def set_directed_mapping(directed_mapping) Setter for the directed mapping property. Parameters Name Type Description directed_mapping Union[callable, str] A function that produces edge directions or the name of the property to use for binding. The function should have the same signature as default_directed_mapping e.g. take in an edge dictionary and return a boolean value. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_directed_mapping(node: dict): ... In [4]: w.set_directed_mapping(custom_directed_mapping) def del_directed_mapping() Deleter for the directed mapping property. Remove a custom directed mapping.","title":"directed_mapping: Union[callable, str]"},{"location":"02_graph_widget/#methods","text":"","title":"Methods"},{"location":"02_graph_widget/#def-initwidget_layout-none-overview_enabled-none-context_start_with","text":"GraphWidget constructor. Parameters Name Type Description widget_layout ipywidgets.Layout (optional) Can be used to specify general widget appearance through css attributes. See references for a link to their documentation and available keywords. overview_enabled bool (optional) Enable graph overview component. Default behaviour depends on cell width. context_start_with str (optional) Specify context tab name to start with that tab opened. Default behaviour is open with About dialog. Use None to start with closed sidebar. Available are Neighborhood , Data , Search and About .","title":"def init(widget_layout = None, overview_enabled = None, context_start_with = '')"},{"location":"02_graph_widget/#def-show","text":"Display widget in Jupyter. Same as using single object reference in cell directly. Notes Mappings will only be applied shortly before showing the widget.","title":"def show()"},{"location":"02_graph_widget/#def-import_graphgraph","text":"Import a graph object defined in an external module. Sets the nodes , edges and directed traitlets properties with information extracted from the graph object. See graph importers for object specific transformation details. Parameters Name Type Description graph networkx.{Multi}{Di}Graph | graph_tool.Graph | igraph.Graph | pygraphviz.AGraph The graph data structure. Example In [1]: from networkx import florentine_families_graph In [2]: from yfiles_jupyter_graphs import GraphWidget In [3]: w = GraphWidget() In [4]: w.import_graph(florentine_families_graph()) Notes Some graph data structures have special attributes for labels, some don't. Same goes for other graph properties. This method and the underlying transformations should be seen as best effort to provide an easy way to input data into the widget. For more granular control use nodes and edges properties directly.","title":"def import_graph(graph)"},{"location":"02_graph_widget/#def-circular_layout","text":"Alias for GraphWidget. graph_layout = \"circular\". See yFiles circular layout guide for more details about this specific algorithm.","title":"def circular_layout()"},{"location":"02_graph_widget/#def-circular_straight_line_layout","text":"Alias for GraphWidget. graph_layout = \"circular_straight_line\". Similar to circular layout but with straight edge paths instead of bundled paths. See yFiles circular layout guide for more details about this specific algorithm.","title":"def circular_straight_line_layout()"},{"location":"02_graph_widget/#def-hierarchic_layout","text":"Alias for GraphWidget. graph_layout = \"hierarchic\". See yFiles hierarchic layout guide for more details about this specific algorithm.","title":"def hierarchic_layout()"},{"location":"02_graph_widget/#def-organic_layout","text":"Alias for GraphWidget. graph_layout = \"organic\". See yFiles organic layout guide for more details about this specific algorithm.","title":"def organic_layout()"},{"location":"02_graph_widget/#def-orthogonal_layout","text":"Alias for GraphWidget. graph_layout = \"orthogonal\". See yFiles orthogonal layout guide for more details about this specific algorithm.","title":"def orthogonal_layout()"},{"location":"02_graph_widget/#def-radial_layout","text":"Alias for GraphWidget. graph_layout = \"radial\". See yFiles radial layout guide for more details about this specific algorithm.","title":"def radial_layout()"},{"location":"02_graph_widget/#def-tree_layout","text":"Alias for GraphWidget. graph_layout = \"tree\". See yFiles tree layout guide for more details about this specific algorithm.","title":"def tree_layout()"},{"location":"02_graph_widget/#def-orthogonal_edge_router","text":"Alias for GraphWidget. graph_layout = \"orthogonal_edge_router\". See yFiles orthogonal edge router guide for more details about this specific algorithm.","title":"def orthogonal_edge_router()"},{"location":"02_graph_widget/#def-interactive_organic_layout","text":"Alias for GraphWidget. graph_layout = \"interactive_organic_layout\". See yFiles interactive organic layout guide for more details about this specific algorithm.","title":"def interactive_organic_layout()"},{"location":"02_graph_widget/#def-organic_edge_router","text":"Alias for GraphWidget. graph_layout = \"organic_edge_router\". See yFiles organic edge router guide for more details about this specific algorithm.","title":"def organic_edge_router()"},{"location":"02_graph_widget/#def-default_element_label_mappingindex-element","text":"The default property mapping for graph elements. The default label mapping for graph elements. Element (dict) should have key properties which itself should be a dict. Then one of the following values (in descending priority) is used as label if the label is a string: - properties[\"label\"] - properties[\"yf_label\"] When importing a Neo4j graph, the following properties are values are used as labels (in descending priority): properties['name'] properties['title'] properties['label'] properties['description'] properties['caption'] properties['text'] Parameters Name Type Description index int (optional) Position in corresponding nodes or edges list. element typing.Dict Can be both node or edge. Notes This is the default value for the { node | edge }_label_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: w.{node|edge}_label_mapping = 'id' In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_element_label_mapping(element: typing.Dict): ... In [4]: w.set_{node|edge}_label_mapping(custom_element_label_mapping) Returns Name Type Description label str The node or edge label. label typing.Dict | A Dict` with mappings for style attributes. See below for supported values. Supported style attributes in the return Dict : can contain the following key-value-pairs: \"text\": str Is used as the label. \"fontSize\": number Sets the size of the font. \"color\": string Css color value for the text color. \"backgroundColor\": str Css color value for the background color. \"position\": 'center' | 'north' | 'east' | 'south' | 'west' The label position at the node. Applies only to node labels. \"maximumWidth\": number The maximum width of the label. By default, the label is clipped at the given size, or wrapped when \"wrapping\" is set. \"maximumHeight\": number The maximum height of the label. Clips the label at the given height. May be combined with \"wrapping\". \"wrapping\": 'character' | 'character_ellipsis' | 'none' | 'word' | 'word_ellipsis' Text wrapping for the label. Must be set in combination with \"maximumWidth\". \"textAlignment\": 'center' | 'left' | 'right' The horizontal text alignment when \"wrapping\" is enabled. \"fontWeight\": 'bold' | 'bolder' | 'lighter' | 'normal'`: The font thickness.","title":"def default_element_label_mapping(index, element)"},{"location":"02_graph_widget/#def-default_node_label_mappingindex-node","text":"The default label mapping for nodes. See default_element_label_mapping .","title":"def default_node_label_mapping(index, node)"},{"location":"02_graph_widget/#def-default_edge_label_mappingindex-edge","text":"The default label mapping for edges. See default_element_label_mapping .","title":"def default_edge_label_mapping(index, edge)"},{"location":"02_graph_widget/#def-default_element_property_mappingindex-element","text":"The default property mapping for graph elements. Simply selects the properties value of element dictionary. Parameters Name Type Description index int (optional) Position in corresponding nodes or edges list. element typing.Dict Can be both node or edge. Notes This is the default value for the { node | edge }_property_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. When a string is provided as the function argument, the key will be searched for in both the properties dictionary and the element keys. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_element_property_mapping(element: typing.Dict): ... In [4]: w.set_{node|edge}_property_mapping(custom_element_property_mapping) Returns Name Type Description properties typing.Dict The node or edge properties.","title":"def default_element_property_mapping(index, element)"},{"location":"02_graph_widget/#def-default_node_property_mappingindex-node","text":"The default property mapping for nodes. See default_element_property_mapping .","title":"def default_node_property_mapping(index, node)"},{"location":"02_graph_widget/#def-default_edge_property_mappingindex-edge","text":"The default property mapping for edges. See default_element_property_mapping .","title":"def default_edge_property_mapping(index, edge)"},{"location":"02_graph_widget/#def-default_node_color_mappingindex-node","text":"The default color mapping for nodes. Provides constant value of '#15afac' for all nodes. Parameters Name Type Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_color_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_color_mapping(node: typing.Dict): ... In [4]: w.set_node_color_mapping(custom_node_color_mapping) Returns Name Type Description color str CSS color value. References css color value yFiles docs Fill api","title":"def default_node_color_mapping(index, node)"},{"location":"02_graph_widget/#def-default_node_styles_mappingindex-node","text":"The default styles mapping for nodes. Provides constant value of {} for all nodes. Parameters Name Type Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_styles_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_styles_mapping(node: typing.Dict): ... In [4]: w.set_node_styles_mapping(custom_node_styles_mapping) Returns Name Type Description styles typing.Dict A Dict with mappings for style attributes. See below for supported values. Supported style attributes in the return Dict : can contain the following key-value-pairs: \"color\": str CSS color value. \"shape\": str The shape of the node. Possible values: 'ellipse', 'hexagon', 'hexagon2', 'octagon', 'pill', 'rectangle', 'round-rectangle' or 'triangle'. \"image\": str Url or data URL of the image. References css color value Data URL","title":"def default_node_styles_mapping(index, node)"},{"location":"02_graph_widget/#def-default_edge_styles_mappingindex-edge","text":"The default styles mapping for edges. Provides constant value of {} for all edges. Parameters Name Type Description index int (optional) Position in edges list. edge typing.Dict Notes This is the default value for the edge_styles_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_styles_mapping(edge: typing.Dict): ... In [4]: w.set_edge_styles_mapping(custom_edge_styles_mapping) Returns Name Type Description styles typing.Dict A Dict with mappings for style attributes. See below for supported values. Supported style attributes in the return Dict : can contain the following key-value-pairs: \"color\": str CSS color value. \"directed\": bool Whether the edge should be visualized with a target arrow. \"thickness\": float The thickness of the stroke of the edge. \"dashStyle\": str The dash styling of the edge. Can be one of the following strings: - \"solid\" - \"dash\" - \"dot\" - \"dash-dot\" - \"dash-dot-dot\" - \"5 10\" - \"5, 10\" - ... References css color value Data URL","title":"def default_edge_styles_mapping(index, edge)"},{"location":"02_graph_widget/#def-default_edge_color_mappingindex-edge","text":"The default color mapping for edges. Provides constant value of '#15afac' for all edges. Parameters Name Type Description index int (optional) Position in edges list. edge typing.Dict Notes This is the default value for the edge_color_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_color_mapping(edge: typing.Dict): ... In [4]: w.set_edge_color_mapping(custom_edge_color_mapping) Returns Name Type Description color str CSS color value. References css color value yFiles docs Fill api","title":"def default_edge_color_mapping(index, edge)"},{"location":"02_graph_widget/#def-default_node_scale_factor_mappingindex-node","text":"The default scale factor mapping for nodes. Provides constant value of 1.0 for all nodes. Parameters Name Type Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_scale_factor_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_scale_factor_mapping(node: typing.Dict): ... In [4]: w.set_node_scale_factor_mapping(custom_node_scale_factor_mapping) Returns Name Type Description node_scale_factor float Positive scale factor.","title":"def default_node_scale_factor_mapping(index, node)"},{"location":"02_graph_widget/#def-default_node_size_mappingindex-node","text":"The default size mapping for nodes. Provides constant value of [55.0,55.0] for all nodes. Parameters Name Type Description index int Position in nodes list. node typing.Dict Notes This is the default value for the node_size_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_size_mapping(node: typing.Dict): ... In [4]: w.set_node_size_mapping(custom_node_size_mapping) Returns Name Type Description node_size float 2-tuple size in (width, height).","title":"def default_node_size_mapping(index, node)"},{"location":"02_graph_widget/#def-default_node_layout_mappingindex-node","text":"The default layout mapping for nodes. Provides constant value of [0.00, 0.00, 55.0, 55.0] for all nodes. Parameters Name Type Description index int Position in nodes list. node typing.Dict Notes This is the default value for the node_layout_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_layout_mapping(node: typing.Dict): ... In [4]: w.set_node_layout_mapping(custom_node_layout_mapping) Returns Name Type Description node_layout float 4-tuple layout containin position and size: (x, y, width, height).","title":"def default_node_layout_mapping(index, node)"},{"location":"02_graph_widget/#def-default_heat_mappingindex-node","text":"The default heat mapping for nodes and edges. Provides constant value of None for all nodes and edges. Parameters Name Type Description index int Position in element list. element typing.Dict Notes This is the default value for the heat_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_heat_mapping(node: typing.Dict): ... In [4]: w.set_heat_mapping(custom_heat_mapping) Returns Name Type Description heat float The heat can be a number between 0 and 1.","title":"def default_heat_mapping(index, node)"},{"location":"02_graph_widget/#def-default_edge_thickness_factor_mappingindex-edge","text":"The default thickness factor mapping for edges. Provides constant value of 1.0 for all edges. Parameters Name Type Description index int (optional) Position in edges list. edge typing.Dict Notes This is the default value for the edge_thickness_factor_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_edge_thickness_factor_mapping(edge: typing.Dict): ... In [4]: w.set_edge_thickness_factor_mapping(custom_edge_thickness_factor_mapping) Returns Name Type Description edge_thickness_factor float Positive thickness factor.","title":"def default_edge_thickness_factor_mapping(index, edge)"},{"location":"02_graph_widget/#def-default_node_type_mappingindex-node","text":"The default type mapping for nodes. Provides constant value of None for all nodes. Parameters Name Type Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_type_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_type_mapping(node: typing.Dict): ... In [4]: w.set_node_type_mapping(custom_node_type_mapping) Returns Name Type Description node_type None Node Type.","title":"def default_node_type_mapping(index, node)"},{"location":"02_graph_widget/#def-default_node_parent_mappingindex-node","text":"The default parent mapping for nodes. Provides constant value of None for all nodes. Parameters Name parent Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_parent_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_parent_mapping(node: typing.Dict): ... In [4]: w.set_node_parent_mapping(custom_node_parent_mapping) Returns Name parent Description node_parent None Node parent Id.","title":"def default_node_parent_mapping(index, node)"},{"location":"02_graph_widget/#def-default_node_parent_group_mappingindex-node","text":"The default parent group mapping for nodes. Provides constant value of None for all nodes. Parameters Name parent Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_parent_group_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_parent_group_mapping(node: typing.Dict): ... In [4]: w.set_node_parent_group_mapping(custom_node_parent_group_mapping) Returns Name parent Description node_parent_group None Node parent label.","title":"def default_node_parent_group_mapping(index, node)"},{"location":"02_graph_widget/#def-default_node_position_mappingindex-node","text":"The default position mapping for nodes. Provides constant value of [0.0, 0.0] for all nodes. Parameters Name Type Description index int (optional) Position in nodes list. node typing.Dict Notes This is the default value for the node_position_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_position_mapping(node: typing.Dict): ... In [4]: w.set_node_position_mapping(custom_node_position_mapping) Returns Name Type Description node_position float 2-tuple Position in euclidian plane.","title":"def default_node_position_mapping(index, node)"},{"location":"02_graph_widget/#def-default_node_coordinate_mappingindex-node","text":"The default coordinate mapping for nodes. Provides constant value of None for all nodes. There is no coordinate mapping unless explicitly set. Parameters Name Type Description index int (optional) position in nodes list. node typing.Dict Notes This is the default value for the node_coordinate_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_node_coordinate_mapping(node: typing.Dict): ... In [4]: w.set_node_coordinate_mapping(custom_node_coordinate_mapping) Returns Name Type Description node_coordinate float 2-tuple geo coordinates in latitude and longitude .","title":"def default_node_coordinate_mapping(index, node)"},{"location":"02_graph_widget/#def-default_directed_mappingindex-edge","text":"The default directed mapping for edges. Uses the graph wide directed attribute for all edges. Parameters Name Type Description index int (optional) Position in edges list. edge typing.Dict Notes This is the default value for the directed_mapping property. Can be 'overwritten' by setting the property with a function of the same signature. If the given mapping function has only one parameter (that is not typed as int), then it will be called with the element (typing.Dict) as first parameter. Example In [1]: from yfiles_jupyter_graphs import GraphWidget In [2]: w = GraphWidget() In [3]: def custom_directed_mapping(edge: typing.Dict): ... In [4]: w.set_directed_mapping(custom_directed_mapping) Returns Name Type Description directed bool Whether the edge is directed or not.","title":"def default_directed_mapping(index, edge)"},{"location":"03_graph_importers/","text":"Graph Importers Used by the GraphWidget.import_graph method. Neo4j Importer Importer for graphs from Neo4j . Notes By default, the widget displays the node's label and the edge's type as text. This may be adjusted by setting a different label-mapping, e.g., see 02_label_mapping . Node labels are combined with ':' and added as 'label' property on the item Node and relationship properties are available on the graph item's properties . Each node label or relationship type is assigned a specific color. Example First, create a Neo4j driver with access to your database from neo4j import GraphDatabase from yfiles_jupyter_graphs import GraphWidget NEO4J_URI = \"neo4j+s://demo.neo4jlabs.com\" NEO4J_USERNAME = \"movies\" NEO4J_PASSWORD = \"movies\" # create a neo4j session to run queries driver = GraphDatabase.driver(uri = NEO4J_URI, auth = (NEO4J_USERNAME, NEO4J_PASSWORD), database = 'movies') session = driver.session() This driver can then be used to query a result graph by importing the result with the yFiles Graphs for Jupyter widget: # directly show the graph resulting from the given Cypher query def showGraph(cypher: str): widget = GraphWidget(graph = session.run(cypher).graph()) # potentially configure some mappings of the widget... def node_label_mapping(node): properties = node['properties'] return properties.get('name', properties.get('label', '')) w.node_label_mapping = node_label_mapping display(widget) # display a Cypher query as graph showGraph(\"MATCH (s)-[r]->(t) RETURN s,r,t LIMIT 20\") See also this Jupyter Notebook Graph Tool Importer Importer for graphs from the graph tool package. Notes Graph properties are ignored. Nodes and edges are identified by index. Node and edge properties are extracted from corresponding property maps. Default values for unset properties are used, due to the way graph tool properties work. Example See this Jupyter Notebook igraph Importer Importer for graphs from the igraph package. Notes Nodes and edges are identified by index attribute. Node and edge properties are provided through attributes method. Edges are determined by source and target attribute. Example See this Jupyter Notebook Networkx Importer Importer for graphs from the networkx package. Notes Graph attributes are ignored. Node identifiers are saved under property key label (or yf_label if key label already exists). Node identifiers have to be unique. Subgraphs (graph as node, see here ) are not supported. Example See this Jupyter Notebook PyGraphviz Importer Importer for graphs from the pygraphviz package. Notes Graph attributes are ignored. Node names are saved under property key label (or yf_label if key label already exists). Node names have to be unique. Unspecified default node/edge attributes are empty (and shown as null in data viewer). Subgraphs are dissolved. Example See this Jupyter Notebook Pandas Importer Notes each row corresponds to an edge the edges are defined by pairs of source and target indices if you have a label column in your DataFrame, the edges automatically have this label the default edge is always directed nodes are created for every id used in source and target any additional DataFrame columns are stored in properties under the same name Example See this Jupyter Notebook","title":"Graph Importers"},{"location":"03_graph_importers/#graph-importers","text":"Used by the GraphWidget.import_graph method.","title":"Graph Importers"},{"location":"03_graph_importers/#neo4j-importer","text":"Importer for graphs from Neo4j .","title":"Neo4j Importer"},{"location":"03_graph_importers/#notes","text":"By default, the widget displays the node's label and the edge's type as text. This may be adjusted by setting a different label-mapping, e.g., see 02_label_mapping . Node labels are combined with ':' and added as 'label' property on the item Node and relationship properties are available on the graph item's properties . Each node label or relationship type is assigned a specific color.","title":"Notes"},{"location":"03_graph_importers/#example","text":"First, create a Neo4j driver with access to your database from neo4j import GraphDatabase from yfiles_jupyter_graphs import GraphWidget NEO4J_URI = \"neo4j+s://demo.neo4jlabs.com\" NEO4J_USERNAME = \"movies\" NEO4J_PASSWORD = \"movies\" # create a neo4j session to run queries driver = GraphDatabase.driver(uri = NEO4J_URI, auth = (NEO4J_USERNAME, NEO4J_PASSWORD), database = 'movies') session = driver.session() This driver can then be used to query a result graph by importing the result with the yFiles Graphs for Jupyter widget: # directly show the graph resulting from the given Cypher query def showGraph(cypher: str): widget = GraphWidget(graph = session.run(cypher).graph()) # potentially configure some mappings of the widget... def node_label_mapping(node): properties = node['properties'] return properties.get('name', properties.get('label', '')) w.node_label_mapping = node_label_mapping display(widget) # display a Cypher query as graph showGraph(\"MATCH (s)-[r]->(t) RETURN s,r,t LIMIT 20\") See also this Jupyter Notebook","title":"Example"},{"location":"03_graph_importers/#graph-tool-importer","text":"Importer for graphs from the graph tool package.","title":"Graph Tool Importer"},{"location":"03_graph_importers/#notes_1","text":"Graph properties are ignored. Nodes and edges are identified by index. Node and edge properties are extracted from corresponding property maps. Default values for unset properties are used, due to the way graph tool properties work.","title":"Notes"},{"location":"03_graph_importers/#example_1","text":"See this Jupyter Notebook","title":"Example"},{"location":"03_graph_importers/#igraph-importer","text":"Importer for graphs from the igraph package.","title":"igraph Importer"},{"location":"03_graph_importers/#notes_2","text":"Nodes and edges are identified by index attribute. Node and edge properties are provided through attributes method. Edges are determined by source and target attribute.","title":"Notes"},{"location":"03_graph_importers/#example_2","text":"See this Jupyter Notebook","title":"Example"},{"location":"03_graph_importers/#networkx-importer","text":"Importer for graphs from the networkx package.","title":"Networkx Importer"},{"location":"03_graph_importers/#notes_3","text":"Graph attributes are ignored. Node identifiers are saved under property key label (or yf_label if key label already exists). Node identifiers have to be unique. Subgraphs (graph as node, see here ) are not supported.","title":"Notes"},{"location":"03_graph_importers/#example_3","text":"See this Jupyter Notebook","title":"Example"},{"location":"03_graph_importers/#pygraphviz-importer","text":"Importer for graphs from the pygraphviz package.","title":"PyGraphviz Importer"},{"location":"03_graph_importers/#notes_4","text":"Graph attributes are ignored. Node names are saved under property key label (or yf_label if key label already exists). Node names have to be unique. Unspecified default node/edge attributes are empty (and shown as null in data viewer). Subgraphs are dissolved.","title":"Notes"},{"location":"03_graph_importers/#example_4","text":"See this Jupyter Notebook","title":"Example"},{"location":"03_graph_importers/#pandas-importer","text":"","title":"Pandas Importer"},{"location":"03_graph_importers/#notes_5","text":"each row corresponds to an edge the edges are defined by pairs of source and target indices if you have a label column in your DataFrame, the edges automatically have this label the default edge is always directed nodes are created for every id used in source and target any additional DataFrame columns are stored in properties under the same name","title":"Notes"},{"location":"03_graph_importers/#example_5","text":"See this Jupyter Notebook","title":"Example"},{"location":"04_key_activation/","text":"Key activation yFiles Graphs for Jupyter is allow-listed on well-known domains like JupyterLab or Jupyter Notebook Visual Studio Code Google Colaboratory Google Vertex AI Workbench Google Dataproc Azure Machine Learning Studio Notebooks Amazon SageMaker and localhost 127.0.0.1 Unknown domains If your domain is unknown to the widget, you will see a popup in the widget that states that it runs on an unknown domain. The widget's popup provides a button with which you can temporarily continue using yFiles Graphs for Jupyter. If you think the widget should also be allow-listed on the domain you are running it on, or if you need a specific activation license for your domain, please get in touch with us by email or on GitHub . Obtaining a domain specific license Please get in touch with us by email if you require a specific activation key for your domain. Using a license Key To use a specific activation license, provide it as license parameter to the GraphWidget constructor: w = GraphWidget(license={ \"id\": \"6440496d-b481-49a5-a824-78d591e590b4\", \"domains\": [ \"my.domain.com\" ], \"expiry\": \"2024-01-05\", \"version\": \"1.0\", \"signature\": \"8214787cc5f7e2bf25f4a25e43f9d7e9d482c...\" })","title":"Key activation"},{"location":"04_key_activation/#key-activation","text":"yFiles Graphs for Jupyter is allow-listed on well-known domains like JupyterLab or Jupyter Notebook Visual Studio Code Google Colaboratory Google Vertex AI Workbench Google Dataproc Azure Machine Learning Studio Notebooks Amazon SageMaker and localhost 127.0.0.1","title":"Key activation"},{"location":"04_key_activation/#unknown-domains","text":"If your domain is unknown to the widget, you will see a popup in the widget that states that it runs on an unknown domain. The widget's popup provides a button with which you can temporarily continue using yFiles Graphs for Jupyter. If you think the widget should also be allow-listed on the domain you are running it on, or if you need a specific activation license for your domain, please get in touch with us by email or on GitHub .","title":"Unknown domains"},{"location":"04_key_activation/#obtaining-a-domain-specific-license","text":"Please get in touch with us by email if you require a specific activation key for your domain.","title":"Obtaining a domain specific license"},{"location":"04_key_activation/#using-a-license-key","text":"To use a specific activation license, provide it as license parameter to the GraphWidget constructor: w = GraphWidget(license={ \"id\": \"6440496d-b481-49a5-a824-78d591e590b4\", \"domains\": [ \"my.domain.com\" ], \"expiry\": \"2024-01-05\", \"version\": \"1.0\", \"signature\": \"8214787cc5f7e2bf25f4a25e43f9d7e9d482c...\" })","title":"Using a license Key"}]} \ No newline at end of file diff --git a/sitemap.xml.gz b/sitemap.xml.gz index 412ffb4..b0758c4 100644 Binary files a/sitemap.xml.gz and b/sitemap.xml.gz differ