diff --git a/README.md b/README.md index 388be3d..36a4bdf 100644 --- a/README.md +++ b/README.md @@ -49,12 +49,12 @@ The main class `Neo4jGraphWidget` provides the following API: - `Neo4jGraphWidget`: Creates a new class instance with the following arguments -| Argument | Description | Default | -|--------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------| -| `driver` | The neo4j `driver` that is used to execute cypher queries. | `None` | -| `widget_layout` | Can be used to specify general widget appearance through css attributes. See ipywidget's [`layout`](https://ipywidgets.readthedocs.io/en/stable/examples/Widget%20Layout.html#the-layout-attribute) for more information. | `None` | -| `overview_enabled` | Enable graph overview component. Default behaviour depends on cell width. | `None` | -| `graph_layout` | Can be used to specify a general default node and edge layout. Available algorithms are: ["circular", "hierarchic", "organic", "orthogonal", "radial", "tree", "orthogonal_edge_router", "organic_edge_router", "interactive_organic_layout", "map"] | `organic` | +| Argument | Description | Default | +|--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------| +| `driver` | The neo4j `driver` that is used to execute cypher queries. | `None` | +| `widget_layout` | Can be used to specify general widget appearance through css attributes. See ipywidget's [`layout`](https://ipywidgets.readthedocs.io/en/stable/examples/Widget%20Layout.html#the-layout-attribute) for more information. | `None` | +| `overview_enabled` | Enable graph overview component. Default behaviour depends on cell width. | `None` | +| `graph_layout` | Can be used to specify a general default node and edge layout. Available algorithms are: "circular", "hierarchic", "organic", "interactive_organic_layout", "orthogonal", "radial", "tree", "map", "orthogonal_edge_router", "organic_edge_router" | `organic` | ### Methods @@ -64,14 +64,14 @@ The main class `Neo4jGraphWidget` provides the following API: - `graph_layout`: The graph layout that is used. This overwrites the general graph_layout in this specific graph instance. The following arguments are supported: - `hierarchic` - `organic` + - `interactive_organic_layout` - `circular` - `orthogonal` - `tree` - `radial` + - `map` - `orthogonal_edge_router` - `organic_edge_router` - - `interactive_organic_layout` - - `map` - `**kwargs`: Additional parameters that should be passed to the cypher query (e.g., see the [selection example](https://github.com/yWorks/yfiles-jupyter-graphs-for-neo4j/blob/main/examples/selection_example.ipynb)). diff --git a/src/yfiles_jupyter_graphs_for_neo4j/Yfiles_Neo4j_Graphs.py b/src/yfiles_jupyter_graphs_for_neo4j/Yfiles_Neo4j_Graphs.py index 4100a3e..605af2a 100644 --- a/src/yfiles_jupyter_graphs_for_neo4j/Yfiles_Neo4j_Graphs.py +++ b/src/yfiles_jupyter_graphs_for_neo4j/Yfiles_Neo4j_Graphs.py @@ -18,7 +18,7 @@ class Neo4jGraphWidget: def __init__(self, driver=None, widget_layout=None, overview_enabled=None, context_start_with=None, license=None, - autocomplete_relationships=False, graph_layout='organic'): + autocomplete_relationships=False, layout='organic'): self._widget = GraphWidget() self._driver = driver self._session = driver.session() @@ -27,7 +27,7 @@ def __init__(self, driver=None, widget_layout=None, self._layout = widget_layout self._context_start_with = context_start_with self.set_autocomplete_relationships(autocomplete_relationships) - self._graph_layout = graph_layout + self._graph_layout = layout self._node_configurations = {} self._edge_configurations = {} @@ -76,11 +76,15 @@ def _get_relationship_types_expression(self): return "AND type(rel) IN $relationship_types" return "" - def show_cypher(self, cypher, graph_layout=None, **kwargs): + def show_cypher(self, cypher, layout=None, **kwargs): """ main function :param cypher: str, Send a data query to the neo4j database - **kwargs: variable declarations usable in cypher + layout: str, The graph layout for this request. Overwrites the general graph_layout in this specific graph + instance. Allowed values are (one of "circular", "hierarchic", "organic", + "interactive_organic_layout", "orthogonal", "radial", "tree", "map", "orthogonal_edge_router", + "organic_edge_router"). + **kwargs: Variable declarations usable in cypher """ if self._driver is not None: if self._is_autocomplete_enabled(): @@ -108,10 +112,10 @@ def show_cypher(self, cypher, graph_layout=None, **kwargs): self.__apply_edge_mappings(widget) self.__apply_heat_mapping({**self._node_configurations, **self._edge_configurations}, widget) self.__apply_parent_mapping(widget) - if graph_layout is None: + if layout is None: widget.set_graph_layout(self._graph_layout) else: - widget.set_graph_layout(graph_layout) + widget.set_graph_layout(layout) self._widget = widget widget.show()