I am new to Spark , what I want to do is to create a Graph connecting a seller
and a device
, the device
is a String
, when I am creating a Edge
,I have to give a VertexId
, how to generate VertexId
from VertexProperty
in spark
Asked
Active
Viewed 84 times
0

tintin
- 1,459
- 1
- 10
- 27
-
You are trying to build a bipartite graph? – eliasah Oct 26 '15 at 11:05
-
@eliasah, yes, it's a bipartite graph – tintin Oct 26 '15 at 11:09
-
1Could you provide example input? – zero323 Oct 26 '15 at 11:43
-
1@zero323 isn't it similar to this question http://stackoverflow.com/a/33243012/3415409 – eliasah Oct 26 '15 at 12:03
-
I thought about an it is possible but I think this one is more about adding an ID (`StringIndexer` or `distinct.zipWithIndex.collectAsMap`). Still it is just a guess. – zero323 Oct 26 '15 at 12:35
-
@zero323, like I (123, "abc"), (456, "cde") – tintin Oct 26 '15 at 13:40
-
@zero323, after checking the document, StringIndexer is exactly the function am looking for , thx – tintin Oct 26 '15 at 14:08