madlib-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From njayaram2 <...@git.apache.org>
Subject [GitHub] incubator-madlib pull request #113: Graph: Add grouping support to SSSP
Date Fri, 14 Apr 2017 18:19:35 GMT
Github user njayaram2 commented on a diff in the pull request:

    https://github.com/apache/incubator-madlib/pull/113#discussion_r111605403
  
    --- 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;
    --- End diff --
    
    We should have an example with grouping in the online docs too.


---
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.
---

Mime
View raw message