Skip to content

Instantly share code, notes, and snippets.

@alienrobotwizard
Created May 4, 2011 02:35
Show Gist options
  • Save alienrobotwizard/954659 to your computer and use it in GitHub Desktop.
Save alienrobotwizard/954659 to your computer and use it in GitHub Desktop.
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;
DUMP edges_joined;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment