Any examples of a 3 hop gsql query? <EOM>

22 views
Skip to first unread message

Carl Boudreau

unread,
Feb 27, 2020, 12:18:48 AM2/27/20
to gsql-...@opengsql.org

Jonathan Herke

unread,
Feb 27, 2020, 11:50:34 AM2/27/20
to Carl Boudreau, Boudreau, Carl, gsql-users
@Boudreau, Carl Is this along the lines of what you are looking for? ->  https://docs.tigergraph.com/intro/gsql-102/multiple-hop-pattern


Jon Herke
Developer/Technical Evangelist, TigerGraph



On Wed, Feb 26, 2020 at 11:18 PM Carl Boudreau <carlbou...@gmail.com> wrote:

--
Welcome to GSQL-user group.
- our mission is bringing the power of graph databases to everyone www.opengsql.org
- technical resource can be found here https://docs.tigergraph.com/
---
You received this message because you are subscribed to the Google Groups "gsql-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gsql-users+...@opengsql.org.
To view this discussion on the web visit https://groups.google.com/a/opengsql.org/d/msgid/gsql-users/CA%2B5%2BrzRG7n4M5co8r9wO7h%2BgePOPt2n1D44zsQLUSzFe905PHw%40mail.gmail.com.

Jonathan Herke

unread,
Feb 28, 2020, 12:43:29 PM2/28/20
to Carl Boudreau, Boudreau, Carl, gsql-users

CREATE QUERY khop(VERTEX<MyNode> start_node, INT depth) for graph GraphName {

    OrAccum          @visited = false;
    SumAccum<int>    @@loop=0;

    Start = {start_node};
    Start = SELECT v
            FROM Start:v
            ACCUM v.@visited = true;

    WHILE (@@loop < depth) DO
        Start = SELECT v
                FROM Start:u - (MyEdge:e)->:v
                WHERE v.@visited == false
                ACCUM v.@visited = true;

        @@loop += 1;
   END;

   PRINT Start.size();
}


Jon Herke
Developer/Technical Evangelist, TigerGraph


Reply all
Reply to author
Forward
0 new messages