Created
March 27, 2017 15:14
-
-
Save jovianlin/de731e728dec486fc50a5e8bbd43da83 to your computer and use it in GitHub Desktop.
test_graphframes.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a Vertex DataFrame with unique ID column "id" | |
v = sqlContext.createDataFrame([ | |
("a", "Alice", 34), | |
("b", "Bob", 36), | |
("c", "Charlie", 30), | |
], ["id", "name", "age"]) | |
# Create an Edge DataFrame with "src" and "dst" columns | |
e = sqlContext.createDataFrame([ | |
("a", "b", "friend"), | |
("b", "c", "follow"), | |
("c", "b", "follow"), | |
], ["src", "dst", "relationship"]) | |
# Create a GraphFrame | |
from graphframes import * | |
g = GraphFrame(v, e) | |
g.inDegrees.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment