{"action":"created","comment":{"url":"https://api.github.com/repos/apache/flink/pulls/comments/31678387","id":31678387,"diff_hunk":"@@ -0,0 +1,131 @@\n+/*\n+ * Licensed to the Apache Software Foundation (ASF) under one\n+ * or more contributor license agreements.  See the NOTICE file\n+ * distributed with this work for additional information\n+ * regarding copyright ownership.  The ASF licenses this file\n+ * to you under the Apache License, Version 2.0 (the\n+ * \"License\"); you may not use this file except in compliance\n+ * with the License.  You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.apache.flink.graph.example;\n+\n+import org.apache.flink.api.common.ProgramDescription;\n+import org.apache.flink.api.common.functions.FlatMapFunction;\n+import org.apache.flink.api.common.functions.MapFunction;\n+import org.apache.flink.api.java.DataSet;\n+import org.apache.flink.api.java.ExecutionEnvironment;\n+import org.apache.flink.graph.Edge;\n+import org.apache.flink.graph.Graph;\n+import org.apache.flink.graph.Vertex;\n+import org.apache.flink.graph.library.HITS;\n+import org.apache.flink.graph.utils.Hits;\n+import org.apache.flink.graph.utils.Tuple3ToEdgeMap;\n+import org.apache.flink.util.Collector;\n+\n+/**\n+ * This program is an example for HITS algorithm.\n+ * the result is either a hub value or authority value base user selection.\n+ *\n+ * If no arguments are provided, the example runs with a random graph of 10 vertices\n+ * and random edge weights.\n+ */\n+\n+public class HITSExample implements ProgramDescription {\n+    @SuppressWarnings(\"serial\")\n+    public static void main(String[] args) throws Exception {\n+\n+        if(!parseParameters(args)) {\n+            return;\n+        }\n+\n+        ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();\n+        DataSet<Edge<Long, String>> links = getEdgesDataSet(env);\n+\n+        Graph<Long, Double, String> network = Graph.fromDataSet(links, new MapFunction<Long, Double>() {\n+\n+            public Double map(Long value) throws Exception {\n+                return 1.0;\n+            }\n+        }, env);\n+\n+    // add  graph to HITS class with iteration value and hub or authority enum value.\n+        DataSet<Vertex<Long, Double>> HitsValue =network.run(\n+                    new HITS<Long>(Hits.AUTHORITY,maxIterations)).getVertices();\n+\n+        if (fileOutput) {\n+            HitsValue.writeAsCsv(outputPath, \"\\n\", \"\\t\");\n+        } else {\n+            HitsValue.print();\n+        }\n+//        env.execute(\"HITS algorithm\");\n+    }\n+\n+    @Override\n+    public String getDescription() {\n+        return \"HITS algorithm example\";\n+    }\n+\n+    // *************************************************************************\n+    //     UTIL METHODS\n+    // *************************************************************************\n+\n+    private static boolean fileOutput = false;\n+    private static long numPages = 10;\n+    private static String edgeInputPath = null;\n+    private static String outputPath = null;\n+    private static int maxIterations = 5;\n+\n+    private static boolean parseParameters(String[] args) {\n+\n+        if(args.length > 0) {\n+            if(args.length != 3) {\n+                System.err.println(\"Usage: PageRank <input edges path> <output path> <num iterations>\");","path":"flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/example/HITSExample.java","position":91,"original_position":91,"commit_id":"e090067aacd34e5bad9be23bf4e8c034baf9d6f9","original_commit_id":"e090067aacd34e5bad9be23bf4e8c034baf9d6f9","user":{"login":"andralungu","id":2550549,"avatar_url":"https://avatars.githubusercontent.com/u/2550549?v=3","gravatar_id":"","url":"https://api.github.com/users/andralungu","html_url":"https://github.com/andralungu","followers_url":"https://api.github.com/users/andralungu/followers","following_url":"https://api.github.com/users/andralungu/following{/other_user}","gists_url":"https://api.github.com/users/andralungu/gists{/gist_id}","starred_url":"https://api.github.com/users/andralungu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andralungu/subscriptions","organizations_url":"https://api.github.com/users/andralungu/orgs","repos_url":"https://api.github.com/users/andralungu/repos","events_url":"https://api.github.com/users/andralungu/events{/privacy}","received_events_url":"https://api.github.com/users/andralungu/received_events","type":"User","site_admin":false},"body":"It's no longer Page Rank ;) let's not confuse people!","created_at":"2015-06-03T22:43:49Z","updated_at":"2015-06-03T22:43:49Z","html_url":"https://github.com/apache/flink/pull/765#discussion_r31678387","pull_request_url":"https://api.github.com/repos/apache/flink/pulls/765","_links":{"self":{"href":"https://api.github.com/repos/apache/flink/pulls/comments/31678387"},"html":{"href":"https://github.com/apache/flink/pull/765#discussion_r31678387"},"pull_request":{"href":"https://api.github.com/repos/apache/flink/pulls/765"}}},"pull_request":{"url":"https://api.github.com/repos/apache/flink/pulls/765","id":36785376,"html_url":"https://github.com/apache/flink/pull/765","diff_url":"https://github.com/apache/flink/pull/765.diff","patch_url":"https://github.com/apache/flink/pull/765.patch","issue_url":"https://api.github.com/repos/apache/flink/issues/765","number":765,"state":"open","locked":false,"title":"Hits","user":{"login":"mfahimazizi","id":8156845,"avatar_url":"https://avatars.githubusercontent.com/u/8156845?v=3","gravatar_id":"","url":"https://api.github.com/users/mfahimazizi","html_url":"https://github.com/mfahimazizi","followers_url":"https://api.github.com/users/mfahimazizi/followers","following_url":"https://api.github.com/users/mfahimazizi/following{/other_user}","gists_url":"https://api.github.com/users/mfahimazizi/gists{/gist_id}","starred_url":"https://api.github.com/users/mfahimazizi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mfahimazizi/subscriptions","organizations_url":"https://api.github.com/users/mfahimazizi/orgs","repos_url":"https://api.github.com/users/mfahimazizi/repos","events_url":"https://api.github.com/users/mfahimazizi/events{/privacy}","received_events_url":"https://api.github.com/users/mfahimazizi/received_events","type":"User","site_admin":false},"body":"HITS algorithm in Gelly.","created_at":"2015-06-02T23:29:37Z","updated_at":"2015-06-03T22:43:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0f6726129c76d3be9c5c03913331905ae1bc94fd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/flink/pulls/765/commits","review_comments_url":"https://api.github.com/repos/apache/flink/pulls/765/comments","review_comment_url":"https://api.github.com/repos/apache/flink/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/flink/issues/765/comments","statuses_url":"https://api.github.com/repos/apache/flink/statuses/e090067aacd34e5bad9be23bf4e8c034baf9d6f9","head":{"label":"mfahimazizi:HITS","ref":"HITS","sha":"e090067aacd34e5bad9be23bf4e8c034baf9d6f9","user":{"login":"mfahimazizi","id":8156845,"avatar_url":"https://avatars.githubusercontent.com/u/8156845?v=3","gravatar_id":"","url":"https://api.github.com/users/mfahimazizi","html_url":"https://github.com/mfahimazizi","followers_url":"https://api.github.com/users/mfahimazizi/followers","following_url":"https://api.github.com/users/mfahimazizi/following{/other_user}","gists_url":"https://api.github.com/users/mfahimazizi/gists{/gist_id}","starred_url":"https://api.github.com/users/mfahimazizi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mfahimazizi/subscriptions","organizations_url":"https://api.github.com/users/mfahimazizi/orgs","repos_url":"https://api.github.com/users/mfahimazizi/repos","events_url":"https://api.github.com/users/mfahimazizi/events{/privacy}","received_events_url":"https://api.github.com/users/mfahimazizi/received_events","type":"User","site_admin":false},"repo":{"id":35546746,"name":"flink","full_name":"mfahimazizi/flink","owner":{"login":"mfahimazizi","id":8156845,"avatar_url":"https://avatars.githubusercontent.com/u/8156845?v=3","gravatar_id":"","url":"https://api.github.com/users/mfahimazizi","html_url":"https://github.com/mfahimazizi","followers_url":"https://api.github.com/users/mfahimazizi/followers","following_url":"https://api.github.com/users/mfahimazizi/following{/other_user}","gists_url":"https://api.github.com/users/mfahimazizi/gists{/gist_id}","starred_url":"https://api.github.com/users/mfahimazizi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mfahimazizi/subscriptions","organizations_url":"https://api.github.com/users/mfahimazizi/orgs","repos_url":"https://api.github.com/users/mfahimazizi/repos","events_url":"https://api.github.com/users/mfahimazizi/events{/privacy}","received_events_url":"https://api.github.com/users/mfahimazizi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mfahimazizi/flink","description":"Mirror of Apache Flink","fork":true,"url":"https://api.github.com/repos/mfahimazizi/flink","forks_url":"https://api.github.com/repos/mfahimazizi/flink/forks","keys_url":"https://api.github.com/repos/mfahimazizi/flink/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mfahimazizi/flink/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mfahimazizi/flink/teams","hooks_url":"https://api.github.com/repos/mfahimazizi/flink/hooks","issue_events_url":"https://api.github.com/repos/mfahimazizi/flink/issues/events{/number}","events_url":"https://api.github.com/repos/mfahimazizi/flink/events","assignees_url":"https://api.github.com/repos/mfahimazizi/flink/assignees{/user}","branches_url":"https://api.github.com/repos/mfahimazizi/flink/branches{/branch}","tags_url":"https://api.github.com/repos/mfahimazizi/flink/tags","blobs_url":"https://api.github.com/repos/mfahimazizi/flink/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mfahimazizi/flink/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mfahimazizi/flink/git/refs{/sha}","trees_url":"https://api.github.com/repos/mfahimazizi/flink/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mfahimazizi/flink/statuses/{sha}","languages_url":"https://api.github.com/repos/mfahimazizi/flink/languages","stargazers_url":"https://api.github.com/repos/mfahimazizi/flink/stargazers","contributors_url":"https://api.github.com/repos/mfahimazizi/flink/contributors","subscribers_url":"https://api.github.com/repos/mfahimazizi/flink/subscribers","subscription_url":"https://api.github.com/repos/mfahimazizi/flink/subscription","commits_url":"https://api.github.com/repos/mfahimazizi/flink/commits{/sha}","git_commits_url":"https://api.github.com/repos/mfahimazizi/flink/git/commits{/sha}","comments_url":"https://api.github.com/repos/mfahimazizi/flink/comments{/number}","issue_comment_url":"https://api.github.com/repos/mfahimazizi/flink/issues/comments{/number}","contents_url":"https://api.github.com/repos/mfahimazizi/flink/contents/{+path}","compare_url":"https://api.github.com/repos/mfahimazizi/flink/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mfahimazizi/flink/merges","archive_url":"https://api.github.com/repos/mfahimazizi/flink/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mfahimazizi/flink/downloads","issues_url":"https://api.github.com/repos/mfahimazizi/flink/issues{/number}","pulls_url":"https://api.github.com/repos/mfahimazizi/flink/pulls{/number}","milestones_url":"https://api.github.com/repos/mfahimazizi/flink/milestones{/number}","notifications_url":"https://api.github.com/repos/mfahimazizi/flink/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mfahimazizi/flink/labels{/name}","releases_url":"https://api.github.com/repos/mfahimazizi/flink/releases{/id}","created_at":"2015-05-13T12:06:06Z","updated_at":"2015-05-13T12:06:16Z","pushed_at":"2015-06-03T06:37:49Z","git_url":"git://github.com/mfahimazizi/flink.git","ssh_url":"git@github.com:mfahimazizi/flink.git","clone_url":"https://github.com/mfahimazizi/flink.git","svn_url":"https://github.com/mfahimazizi/flink","homepage":null,"size":49448,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"90c0142ef21ae329acc843558e7ba6bc160df8d8","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":20587599,"name":"flink","full_name":"apache/flink","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/flink","description":"Mirror of Apache Flink","fork":false,"url":"https://api.github.com/repos/apache/flink","forks_url":"https://api.github.com/repos/apache/flink/forks","keys_url":"https://api.github.com/repos/apache/flink/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/flink/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/flink/teams","hooks_url":"https://api.github.com/repos/apache/flink/hooks","issue_events_url":"https://api.github.com/repos/apache/flink/issues/events{/number}","events_url":"https://api.github.com/repos/apache/flink/events","assignees_url":"https://api.github.com/repos/apache/flink/assignees{/user}","branches_url":"https://api.github.com/repos/apache/flink/branches{/branch}","tags_url":"https://api.github.com/repos/apache/flink/tags","blobs_url":"https://api.github.com/repos/apache/flink/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/flink/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/flink/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/flink/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/flink/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/flink/languages","stargazers_url":"https://api.github.com/repos/apache/flink/stargazers","contributors_url":"https://api.github.com/repos/apache/flink/contributors","subscribers_url":"https://api.github.com/repos/apache/flink/subscribers","subscription_url":"https://api.github.com/repos/apache/flink/subscription","commits_url":"https://api.github.com/repos/apache/flink/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/flink/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/flink/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/flink/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/flink/contents/{+path}","compare_url":"https://api.github.com/repos/apache/flink/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/flink/merges","archive_url":"https://api.github.com/repos/apache/flink/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/flink/downloads","issues_url":"https://api.github.com/repos/apache/flink/issues{/number}","pulls_url":"https://api.github.com/repos/apache/flink/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/flink/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/flink/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/flink/labels{/name}","releases_url":"https://api.github.com/repos/apache/flink/releases{/id}","created_at":"2014-06-07T07:00:10Z","updated_at":"2015-06-03T20:43:21Z","pushed_at":"2015-06-03T22:39:45Z","git_url":"git://github.com/apache/flink.git","ssh_url":"git@github.com:apache/flink.git","clone_url":"https://github.com/apache/flink.git","svn_url":"https://github.com/apache/flink","homepage":null,"size":3383599,"stargazers_count":433,"watchers_count":433,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":276,"mirror_url":"git://git.apache.org/incubator-flink.git","open_issues_count":54,"forks":276,"open_issues":54,"watchers":433,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/flink/pulls/765"},"html":{"href":"https://github.com/apache/flink/pull/765"},"issue":{"href":"https://api.github.com/repos/apache/flink/issues/765"},"comments":{"href":"https://api.github.com/repos/apache/flink/issues/765/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/flink/pulls/765/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/flink/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/flink/pulls/765/commits"},"statuses":{"href":"https://api.github.com/repos/apache/flink/statuses/e090067aacd34e5bad9be23bf4e8c034baf9d6f9"}}}}