[arangodb-google] How do I return a sub-graph in one query

2016-10-05 Thread Allen Zhao
Hi There,

Want to figure a way to query a sub graph. E.g. I want to query from a 
startVertex with depth 2 and list all nodes and edges in a sub-graph json.

I can use two queries to return nodes and edges and merge them into one. Is 
there a way to do that in one query?

{
  nodes: [
{
  "_key": A,
  "x": 100,
  "y": 100
},
{
  "_key": B,
  "x": 200,
  "y": 200
},
  ],
  edges: [
{
  "_from": "A",
  "_to": "B"
}
  ]
}





-- 
You received this message because you are subscribed to the Google Groups 
"ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to arangodb+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[arangodb-google] Re: How do I return a sub-graph in one query

2016-10-05 Thread Allen Zhao
It works!!!

Great community support.
 
Thank you!

On Wednesday, October 5, 2016 at 1:09:43 PM UTC-4, Allen Zhao wrote:
>
> Hi There,
>
> Want to figure a way to query a sub graph. E.g. I want to query from a 
> startVertex with depth 2 and list all nodes and edges in a sub-graph json.
>
> I can use two queries to return nodes and edges and merge them into one. 
> Is there a way to do that in one query?
>
> {
>   nodes: [
> {
>   "_key": A,
>   "x": 100,
>   "y": 100
> },
> {
>   "_key": B,
>   "x": 200,
>   "y": 200
> },
>   ],
>   edges: [
> {
>   "_from": "A",
>   "_to": "B"
> }
>   ]
> }
>
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to arangodb+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[arangodb-google] find neighbor with backward and forward connections

2016-10-07 Thread Allen Zhao
Hi there,

Is there a way to find bi-connected neighbors of a vertex.

E.g.:

In a social network, I want to find a person A's friend:

A is fan of person B
and
B is fan of person A

I tried some AQL queries, but always get syntax error.

Thanks a lot,

Allen

-- 
You received this message because you are subscribed to the Google Groups 
"ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to arangodb+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[arangodb-google] Re: find neighbor with backward and forward connections

2016-10-07 Thread Allen Zhao
I answered myself:

LET a = (FOR v IN 1..1 INBOUND 'user/user.1' GRAPH 'fan' 
OPTIONS {bfs: true, uniqueVertices: 'global', uniqueEdges: 'global'}
RETURN v)
LET b = (FOR v IN 1..1 OUTBOUND 'user/user.1' GRAPH 'fan' 
OPTIONS {bfs: true, uniqueVertices: 'global', uniqueEdges: 'global'}
RETURN v)
RETURN LENGTH(INTERSECTION(a, b))



On Friday, October 7, 2016 at 2:09:26 PM UTC-4, Allen Zhao wrote:
>
> Hi there,
>
> Is there a way to find bi-connected neighbors of a vertex.
>
> E.g.:
>
> In a social network, I want to find a person A's friend:
>
> A is fan of person B
> and
> B is fan of person A
>
> I tried some AQL queries, but always get syntax error.
>
> Thanks a lot,
>
> Allen
>

-- 
You received this message because you are subscribed to the Google Groups 
"ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to arangodb+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[arangodb-google] Re: find neighbor with backward and forward connections

2016-10-15 Thread Allen Zhao
The old solution has pool performance. Now I have a better one:

for v, e in 2..2 outbound 'user/user.1' graph 'fan'
filter e._to == 'user/user.1'
return e._from


On Friday, October 7, 2016 at 3:29:43 PM UTC-4, Allen Zhao wrote:
>
> I answered myself:
>
> LET a = (FOR v IN 1..1 INBOUND 'user/user.1' GRAPH 'fan' 
> OPTIONS {bfs: true, uniqueVertices: 'global', uniqueEdges: 'global'}
> RETURN v)
> LET b = (FOR v IN 1..1 OUTBOUND 'user/user.1' GRAPH 'fan' 
> OPTIONS {bfs: true, uniqueVertices: 'global', uniqueEdges: 'global'}
> RETURN v)
> RETURN LENGTH(INTERSECTION(a, b))
>
>
>
> On Friday, October 7, 2016 at 2:09:26 PM UTC-4, Allen Zhao wrote:
>>
>> Hi there,
>>
>> Is there a way to find bi-connected neighbors of a vertex.
>>
>> E.g.:
>>
>> In a social network, I want to find a person A's friend:
>>
>> A is fan of person B
>> and
>> B is fan of person A
>>
>> I tried some AQL queries, but always get syntax error.
>>
>> Thanks a lot,
>>
>> Allen
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to arangodb+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.