Last active
April 2, 2017 22:39
-
-
Save josep2/a111a259eeb6c4c959175d5159d9641f to your computer and use it in GitHub Desktop.
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
// Borrowed some parts from the GraphFrame docs for my blog: https://graphframes.github.io/user-guide.html | |
import org.graphframes._ | |
val v = sqlContext.createDataFrame(List( | |
("a", "Alice", 34, 234, "Apples"), | |
("b", "Bob", 36, 23232323, "Bananas"), | |
("c", "Charlie", 30, 2123, "Grapefruit"), | |
("d", "David", 29, 2321111, "Bananas"), | |
("e", "Esther", 32, 1, "Watermelon"), | |
("f", "Fanny", 36, 333, "Apples" ), | |
("g", "Gabby", 60, 23433, "Oranges") | |
)).toDF("id", "name", "age", "cash", "fruit") | |
// Edge DataFrame | |
val e = sqlContext.createDataFrame(List( | |
("a", "b", "friend"), | |
("b", "c", "follow"), | |
("c", "b", "follow"), | |
("f", "c", "follow"), | |
("e", "f", "follow"), | |
("e", "d", "friend"), | |
("d", "a", "friend"), | |
("a", "e", "friend") | |
)).toDF("src", "dst", "relationship") | |
// Create a GraphFrame | |
val g = GraphFrame(v, e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment