Created
May 4, 2011 02:36
-
-
Save alienrobotwizard/954661 to your computer and use it in GitHub Desktop.
This file contains 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
edges = LOAD 'graph.tsv' AS (v1:chararray, v2:chararray); | |
-- | |
-- Augment the edges with the sizes of their outgoing adjacency lists. | |
-- | |
grouped_edges = GROUP edges BY v1; | |
aug_edges = FOREACH grouped_edges GENERATE FLATTEN(edges) AS (v1, v2), COUNT(edges) AS v1_out; | |
aug_dups = FOREACH aug_edges GENERATE v1, v2, v1_out; | |
-- | |
-- Compute the sizes of the intersections of outgoing adjacency lists | |
-- | |
edges_joined = JOIN aug_edges BY v2, aug_dups BY v2; | |
intersection = FOREACH edges_joined { | |
-- | |
-- results in: | |
-- (X, Y, |X| + |Y|) | |
-- | |
added_size = aug_edges::v1_out + aug_dups::v1_out; | |
GENERATE | |
aug_edges::v1 AS v1, | |
aug_dups::v1 AS v2, | |
added_size AS added_size | |
; | |
}; | |
DUMP intersection; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment