Hello everyone!

I have a graph of about two thousand vertices (of course I want to test more nodes, but the query speed is too slow).

I want to insert an edge between any neighbors of each vertex, but my current query always times out (even though I set the timeout threshold to 60 seconds), so I wanted to find a faster way to insert.

To speed things up, I tried to reduce the number of queries and use of the for loop, but it was still slow.

Here are two of the query methods I came up with, but it still says timeout, where `insert_edge`

is the subquery I wrote.

```
ListAccum<INT> @Adj;
S1 = SELECT t FROM Bus:s -(BRANCH>|BRANCH_REVERSE>)- Bus:t WHERE s.Bus_Type<0 AND t.Bus_Type<0 AND t.id>s.id
ACCUM s.@Adj += t.id ;
S2 = SELECT s FROM Bus:s WHERE s.Bus_Type<0 ACCUM
FOREACH one IN s.@Adj DO
FOREACH two IN s.@Adj DO
IF one > two THEN # This ensures that there is only one insertion between the two nodes,
IF s.Bus_Type == -1 THEN insert_edge(one, two, "BRANCH", -1) END,
IF s.Bus_Type == -2 THEN insert_edge(one, two, "BRANCH", -2) END
END
END
END;
```

```
S1 = SELECT two FROM Bus:one -(BRANCH>|BRANCH_REVERSE>)- Bus:mid- (BRANCH>|BRANCH_REVERSE>)- Bus:two
WHERE one.Bus_Type<0 AND mid.Bus_Type<0 AND two.Bus_Type<0 AND one.id>mid.id AND two.id>mid.id AND two.id>one.id
AND not two.neighbors().contains(one)
ACCUM IF mid.Bus_Type == -1 THEN insert_edge(one.id, two.id, "BRANCH", -1) END,
IF mid.Bus_Type == -2 THEN insert_edge(one.id, two.id, "BRANCH", -2) END;
```

I would be very grateful if anyone could help me !