[ 
https://issues.apache.org/jira/browse/MADLIB-1102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16011260#comment-16011260
 ] 

Rashmi Raghu commented on MADLIB-1102:
--------------------------------------

Interface suggestion for BFS:
{code:sql}
SELECT madlib.graph_bfs(
  vertex_table, – Vertex table
  vertex_id, – Vertex id column (NULL means use default naming)
  edge_table, – Edge table
  edge_args, – Edge arguments (NULL means use default naming)
  out_table, – Output table of breadth first search result
  origin_id, -- Optional: vertex_id corresponding to the vertex that should be 
the starting point of BFS in the graph. If not provided then the vertex with 
the lowest vertex_id will be used
  is_directed); -- Optional: Boolean, if TRUE then graph is treated as directed 
else it is undirected. Default value is FALSE
{code}

out_table: TEXT. Name of the table to store the result of Breadth First Search
It will contain a row for every vertex from 'vertex_table' that is visited 
during BFS starting at vertex corresponding to origin_id:
- vertex_id : id of the vertex
- dist: distance in number of edges from origin_id

Other potential columns that could be included in the output table are:
- parent: id of node visited prior to the current vertex (in vertex_id column)
- sequence: integer representing order in which vertices were visited during BFS
- cumulative_weight: cumulative weight along the path from origin_id to the 
current vertex (in vertex_id column)

Please comment on the above suggestions. For instance, should all the potential 
columns listed above be included in the output?

> Graph - Breadth First Search / Traversal
> ----------------------------------------
>
>                 Key: MADLIB-1102
>                 URL: https://issues.apache.org/jira/browse/MADLIB-1102
>             Project: Apache MADlib
>          Issue Type: New Feature
>          Components: Module: Graph
>            Reporter: Rashmi Raghu
>            Assignee: Rashmi Raghu
>             Fix For: v1.12
>
>
> Story
> As a MADlib user and developer, I want to implement Breadth First Search / 
> Traversal for a graph. BFS is also a core part of the connected components 
> graph algorithm.
> Accpetance:
> 1) Interface defined
> 2) Design doc updated
> 3) Documentation and on-line help
> 4) IC and functional tests
> 5) Scale tests
> References:
> [0] [https://en.wikipedia.org/wiki/Breadth-first_search] 
> "Breadth-first search (BFS) is an algorithm for traversing or searching tree 
> or graph data structures. It starts at the tree root (or some arbitrary node 
> of a graph, sometimes referred to as a 'search key'[1]) and explores the 
> neighbor nodes first, before moving to the next level neighbors."
> [1] [http://www.geeksforgeeks.org/breadth-first-traversal-for-a-graph/]



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to