Skip to content

Commit 5ec9f83

Browse files
authored
Merge pull request #397 from brs96/promote-gds-alpha-graph-construct
Promote gds.alpha.graph.construct and improve deprecation warnings and tests
2 parents 0431a0b + 3fea36a commit 5ec9f83

20 files changed

+236
-107
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* `gds.graph.ogbl.load` for link property prediction datasets.
1414
* Added possibility to load NetworkX graphs via the new method `gds.graph.networkx.load`.
1515
* Added new sphinx API reference documentation for all procedures.
16+
* Promoted `gds.alpha.graph.construct` to `gds.graph.construct`.
1617

1718
## Bug fixes
1819

doc/modules/ROOT/pages/common-datasets.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,3 +285,5 @@ assert G.relationship_count() == 5_088_434
285285
assert len(G.relationship_types()) == 51 * 3
286286
assert G.relationship_properties()["drug-drug_polycystic_ovary_syndrome_TRAIN"] == ["classLabel"]
287287
----
288+
289+
include::ROOT:partial$/graph-construct-limitation.adoc[]

doc/modules/ROOT/pages/graph-object.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,15 @@ In addition to those aforementioned there are five more methods that create grap
7272
* `gds.graph.project.cypher`
7373
* `gds.beta.graph.subgraph`
7474
* `gds.beta.graph.generate`
75-
* `gds.alpha.graph.sample.rwr`
75+
* `gds.graph.sample.rwr`
7676
* `gds.graph.sample.cnarw`
7777

7878
Their Cypher signatures map to Python in much the same way as `gds.graph.project` above.
7979

8080

81-
[.alpha]
8281
[[construct]]
8382
== Constructing a graph from DataFrames
8483

85-
include::ROOT:partial$/alpha-note.adoc[]
86-
8784
Instead of projecting a graph from the Neo4j database it is also possible to construct new graphs using pandas `DataFrames` from the client.
8885

8986
=== Syntax
@@ -122,7 +119,7 @@ relationships = pandas.DataFrame(
122119
}
123120
)
124121
125-
G = gds.alpha.graph.construct(
122+
G = gds.graph.construct(
126123
"my-graph", # Graph name
127124
nodes, # One or more dataframes containing node data
128125
relationships # One or more dataframes containing relationship data
@@ -162,6 +159,7 @@ This in particular means that:
162159
If multiple node dataframes are used, they need to contain distinct node ids across all node data frames.
163160
* Prior to the `construct` call, a call to `GraphDataScience.set_database` must have been made to explicitly specify which Neo4j database should be targeted.
164161

162+
include::ROOT:partial$/graph-construct-limitation.adoc[]
165163

166164
[[networkx]]
167165
== Loading a NetworkX graph
@@ -280,6 +278,8 @@ The direction (`DIRECTED` or `UNDIRECTED`) of the relationships in the projected
280278
If the given NetworkX graph is directed, so a (sub)class of either `networkx.DiGraph` or `networkx.MultiDiGraph`, the relationships will be `DIRECTED` in the projection.
281279
Otherwise, they will be `UNDIRECTED`.
282280

281+
include::ROOT:partial$/graph-construct-limitation.adoc[]
282+
283283

284284
== Inspecting a graph object
285285

doc/modules/ROOT/pages/tutorials/heterogeneous-node-classification-with-hashgnn.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ graph with `Movie`, `Actor` and `Director` nodes, connected by
7171

7272
Note that a ``real world scenario'', we would probably project our own
7373
data from a Neo4j database into GDS instead, or using
74-
`gds.alpha.graph.construct` to create a graph from our own client side
74+
`gds.graph.construct` to create a graph from our own client side
7575
data.
7676

7777
[source, python, role=no-test]

doc/modules/ROOT/pages/tutorials/import-sample-export-gnn.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ It’s looks correct! Now let’s go ahead and sample the graph.
115115
[source, python, role=no-test]
116116
----
117117
# We use the random walk with restarts sampling algorithm with default values
118-
G_sample, _ = gds.alpha.graph.sample.rwr("cora_sample", G, randomSeed=42, concurrency=1)
118+
G_sample, _ = gds.graph.sample.rwr("cora_sample", G, randomSeed=42, concurrency=1)
119119
----
120120

121121
[source, python, role=no-test]

doc/modules/ROOT/pages/tutorials/load-data-via-graph-construction.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This Jupyter notebook is hosted
1111
https://github.com/neo4j/graph-data-science-client/blob/main/examples/load-data-via-graph-construction.ipynb[here]
1212
in the Neo4j Graph Data Science Client Github repository.
1313

14-
The notebook shows the usage of the `gds.alpha.graph.construct` method
14+
The notebook shows the usage of the `gds.graph.construct` method
1515
(available only in GDS 2.1+) to build a graph directly in memory.
1616

1717
NOTE: If you are using AuraDS, it is currently not possible to write the
@@ -155,7 +155,7 @@ Finally, we can create the in-memory graph.
155155

156156
[source, python, role=no-test]
157157
----
158-
G = gds.alpha.graph.construct("cora-graph", nodes, relationships)
158+
G = gds.graph.construct("cora-graph", nodes, relationships)
159159
----
160160

161161
== Use the graph
@@ -186,7 +186,7 @@ the graph, printing only the first 10.
186186

187187
[source, python, role=no-test]
188188
----
189-
gds.graph.streamNodeProperties(G, ["subject"]).head(10)
189+
gds.graph.nodeProperties.stream(G, ["subject"]).head(10)
190190
----
191191

192192
== Cleanup

doc/modules/ROOT/pages/tutorials/ml-pipelines-node-classification.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ model_fastrp.predict_mutate(
465465
targetNodeLabels=["UnclassifiedPaper"],
466466
)
467467
468-
predicted_fastrp = gds.graph.streamNodeProperty(G, "predictedClass", ["UnclassifiedPaper"])
468+
predicted_fastrp = gds.graph.nodeProperty.stream(G, "predictedClass", ["UnclassifiedPaper"])
469469
----
470470

471471
[source, python, role=no-test]

doc/modules/ROOT/pages/tutorials/node-regression-with-subgraph-and-graph-sample.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ print("MEAN_ABSOLUTE_ERROR test score: " + str(train_result["modelInfo"]["me
451451
[source, python, role=no-test]
452452
----
453453
# Let's sample the graph to see if we can get a similarly good model
454-
G_chameleon_sample, _ = gds.alpha.graph.sample.rwr(
454+
G_chameleon_sample, _ = gds.graph.sample.rwr(
455455
"cham_sample",
456456
G_chameleon,
457457
samplingRatio=0.30, # We'll use 30% of the graph
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
=== Limitations on community edition
2+
3+
For users of GDS community edition, performance can be impacted for large graphs.
4+
It is possible that socket connection with the database times out.
5+
If this happens, a possible workaround is to modify the server configuration https://neo4j.com/docs/operations-manual/current/configuration/configuration-settings/#config_server.bolt.connection_keep_alive[`server.bolt.connection_keep_alive`]
6+
or https://neo4j.com/docs/operations-manual/current/configuration/configuration-settings/#config_server.bolt.connection_keep_alive_probes[`server.bolt.connection_keep_alive_probes`].
7+
However, be aware of the side effects such as a genuine connection issue now taking longer to be detected.

doc/sphinx/source/graph.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This includes all the methods for projecting, deleting, and listing graphs, as w
55
These all assume that an object of :class:`.GraphDataScience` is available as `gds`.
66

77

8-
.. py:function:: gds.alpha.graph.construct(graph_name: str, nodes: Union[DataFrame, List[DataFrame]], relationships: Union[DataFrame, List[DataFrame]], concurrency: int = 4, undirected_relationship_types: Optional[List[str]] = None) -> Graph
8+
.. py:function:: gds.graph.construct(graph_name: str, nodes: Union[DataFrame, List[DataFrame]], relationships: Union[DataFrame, List[DataFrame]], concurrency: int = 4, undirected_relationship_types: Optional[List[str]] = None) -> Graph
99
1010
Constructs a new graph in the graph catalog, using the provided node and relationship data frames.
1111

0 commit comments

Comments
 (0)