From dev-return-1352-apmail-madlib-dev-archive=madlib.apache.org@madlib.incubator.apache.org Fri Apr 14 18:19:46 2017 Return-Path: X-Original-To: apmail-madlib-dev-archive@minotaur.apache.org Delivered-To: apmail-madlib-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 70EAB1A94F for ; Fri, 14 Apr 2017 18:19:45 +0000 (UTC) Received: (qmail 61480 invoked by uid 500); 14 Apr 2017 18:19:40 -0000 Delivered-To: apmail-madlib-dev-archive@madlib.apache.org Received: (qmail 61358 invoked by uid 500); 14 Apr 2017 18:19:40 -0000 Mailing-List: contact dev-help@madlib.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@madlib.incubator.apache.org Delivered-To: mailing list dev@madlib.incubator.apache.org Received: (qmail 61272 invoked by uid 99); 14 Apr 2017 18:19:38 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Apr 2017 18:19:38 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 8705AC047D for ; Fri, 14 Apr 2017 18:19:38 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.221 X-Spam-Level: X-Spam-Status: No, score=-3.221 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id wmx343lNC5LJ for ; Fri, 14 Apr 2017 18:19:37 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 5CBB85FAD8 for ; Fri, 14 Apr 2017 18:19:36 +0000 (UTC) Received: (qmail 61219 invoked by uid 99); 14 Apr 2017 18:19:35 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Apr 2017 18:19:35 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 515F3DFF0F; Fri, 14 Apr 2017 18:19:35 +0000 (UTC) From: njayaram2 To: dev@madlib.incubator.apache.org Reply-To: dev@madlib.incubator.apache.org References: In-Reply-To: Subject: [GitHub] incubator-madlib pull request #113: Graph: Add grouping support to SSSP Content-Type: text/plain Message-Id: <20170414181935.515F3DFF0F@git1-us-west.apache.org> Date: Fri, 14 Apr 2017 18:19:35 +0000 (UTC) Github user njayaram2 commented on a diff in the pull request: https://github.com/apache/incubator-madlib/pull/113#discussion_r111605151 --- Diff: src/ports/postgres/modules/graph/sssp.py_in --- @@ -378,15 +685,73 @@ weight : The total weight of the shortest path from the source vertex parent : The parent of this vertex in the shortest path from source. Will use "parent" for column naming. -The graph_sssp_get_path function will return an INT array that contains the -shortest path from the initial source vertex to the desired destination vertex. +# The graph_sssp_get_path function will return an INT array that contains the +# shortest path from the initial source vertex to the desired destination vertex. +# """ + elif message.lower() in ("example", "examples"): + help_string = """ +---------------------------------------------------------------------------- + EXAMPLES +---------------------------------------------------------------------------- +-- Create a graph, represented as vertex and edge tables. +DROP TABLE IF EXISTS vertex,edge,out,out_summary,out_path; +CREATE TABLE vertex( + id INTEGER + ); +CREATE TABLE edge( + src INTEGER, + dest INTEGER, + weight DOUBLE PRECISION +); + +INSERT INTO vertex VALUES +(0), +(1), +(2), +(3), +(4), +(5), +(6), +(7) +; +INSERT INTO edge VALUES +(0, 1, 1), +(0, 2, 1), +(0, 4, 10), +(1, 2, 2), +(1, 3, 10), +(2, 3, 1), +(2, 5, 1), +(2, 6, 3), +(3, 0, 1), +(4, 0, -2), +(5, 6, 1), +(6, 7, 1) +; + +-- Compute the SSSP: +DROP TABLE IF EXISTS pagerank_out; +SELECT madlib.graph_sssp( + 'vertex', -- Vertex table + 'id', -- Vertix id column + 'edge', -- Edge table + 'src=src, dest=dest, weight=weight', -- Comma delimted string of edge arguments + 0, -- The source vertex + 'out' -- Output table of SSSP +); +-- View the SSSP costs for every vertex: +SELECT * FROM out ORDER BY id; + +-- View the actual shortest path for a vertex: +SELECT graph_sssp_get_path('out',5,'out_path'); +SELECT * FROM out_path; """ - else: - help_string = "No such option. Use {schema_madlib}.graph_sssp()" + else: + help_string = "No such option. Use {schema_madlib}.graph_sssp()" - return help_string.format(schema_madlib=schema_madlib, - graph_usage=get_graph_usage(schema_madlib, 'graph_sssp', + return help_string.format(schema_madlib=schema_madlib, + graph_usage=get_graph_usage(schema_madlib, 'graph_sssp', """source_vertex INT, -- The source vertex id for the algorithm to start. - out_table TEXT -- Name of the table to store the result of SSSP.""")) + out_table TEXT -- Name of the table to store the result of SSSP. + grouping_cols TEXT -- The list of grouping columns.""")) --- End diff -- `out_table TEXT` -> `out_table TEXT,` --- 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 infrastructure@apache.org or file a JIRA ticket with INFRA. ---