Github user wesolowskim commented on a diff in the pull request:
https://github.com/apache/spark/pull/14137#discussion_r70637549
--- Diff:
graphx/src/main/scala/org/apache/spark/graphx/lib/StronglyConnectedComponents.scala
---
@@ -64,11 +69,20 @@ object StronglyConnectedComponents {
// write values to sccGraph
sccGraph = sccGraph.outerJoinVertices(finalVertices) {
(vid, scc, opt) => opt.getOrElse(scc)
- }
+ }.cache()
+ // take triplet to materialize vertices and edges (faster then
count on both)
+ sccGraph.triplets.take(1)
--- End diff --
I wasn't sure about this take to be honest. I checked both solutions - with
take on triplets and with count on vertices and edges separately. After return
from scc count on vertices and edges showed it was generally faster with take,
but it could be due to small amount of partitions.
Count on both vertices and edges with randomly generated graph of 500k
vertices and 2mln vertices adds about 20s to scc, but may be worth it (didn't
show during my tests but I guess you could be right). It could also be that one
partition of triplet depends on whole verticesRDD and edgesRDD so, it would be
sufficient to make take(1).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]