You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* test: add comprehensive PropertyGraphFrame test suite with vertex/edge operations and projections
* refactor: rewrite PropertyGraphFrameTest to pytest with fixtures
* feat: add Python API for property graphs with VertexPropertyGroup and EdgePropertyGroup
* refactor: rename to_graph_frame to to_graphframe in PropertyGraphFrame API
Copy file name to clipboardExpand all lines: docs/src/04-user-guide/11-property-graphs.md
+109-8Lines changed: 109 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,11 +24,11 @@ GraphFrames represent a property graph as a combination of multiple logical stru
24
24
25
25
### Vertex Property Group
26
26
27
-
For API details see @:scaladoc(org.graphframes.propertygraph.property.VertexPropertyGroup). It contains a name of the property group, for example, `movies`, a name of ID column and underlying data in the form of a `DataFrame`.
27
+
For API details see @:scaladoc(org.graphframes.propertygraph.property.VertexPropertyGroup) (Scala) or `graphframes.pg.VertexPropertyGroup` (Python). It contains a name of the property group, for example, `movies`, a name of ID column and underlying data in the form of a `DataFrame`.
28
28
29
29
The simple example below creates two property groups: `people` and `movies`.
For API details see @:scaladoc(org.graphframes.propertygraph.property.EdgePropertyGroup). It contains a name of the property group, links to the source and target vertex property groups, direction of the edges (`directed` or `undirected`), and underlying data in the form of a `DataFrame`. Optionally, it can contain a column with edge weights as well as names of source and target vertex ID columns.
66
+
For API details see @:scaladoc(org.graphframes.propertygraph.property.EdgePropertyGroup) (Scala) or `graphframes.pg.EdgePropertyGroup` (Python). It contains a name of the property group, links to the source and target vertex property groups, direction of the edges (`directed` or `undirected`), and underlying data in the form of a `DataFrame`. Optionally, it can contain a column with edge weights as well as names of source and target vertex ID columns.
51
67
52
68
The simple example below creates an edge property group with the name `likes` and links to the `people` and `movies` vertex property groups as well as `messages` property group that links people to people.
The `PropertyGraphFrame` can be converted to a `GraphFrame` by calling `toGraphFrame`. Users can select a subset of vertex and edge property groups to be included in the resulting `GraphFrame`. Under the hood, the conversion will take care about handling potential vertex and edge ID collisions by applying hashing to both vertex and edge IDs.
162
+
The `PropertyGraphFrame` can be converted to a `GraphFrame` by calling `toGraphFrame` (Scala) or `to_graphframe` (Python). Users can select a subset of vertex and edge property groups to be included in the resulting `GraphFrame`. Under the hood, the conversion will take care about handling potential vertex and edge ID collisions by applying hashing to both vertex and edge IDs.
101
163
102
164
```scala
103
165
valgraph= peopleMoviesGraph.toGraphFrame(
@@ -107,16 +169,37 @@ val graph = peopleMoviesGraph.toGraphFrame(
107
169
Map("people"-> lit(true)))
108
170
```
109
171
110
-
For more details see @:scaladoc(org.graphframes.propertygraph.PropertyGraphFrame).
172
+
```python
173
+
from pyspark.sql.functions import lit
174
+
175
+
graph = people_movies_graph.to_graphframe(
176
+
vertex_property_groups=["people"],
177
+
edge_property_groups=["messages"],
178
+
edge_group_filters={"messages": lit(True)},
179
+
vertex_group_filters={"people": lit(True)}
180
+
)
181
+
```
182
+
183
+
For more details see @:scaladoc(org.graphframes.propertygraph.PropertyGraphFrame) (Scala) or @:pydoc(graphframes.pg.PropertyGraphFrame) (Python).
111
184
112
185
This operation is not free, so user can also explicitly specify for each of `VertexGroup` does it need to be hashed or not.
After running graph algorithms on a `GraphFrame` created from a `PropertyGraphFrame`, you can join the results back to the original vertex data using `join_vertices` (Python) or `joinVertices` (Scala).
0 commit comments