BUG: DQL doesn't connect nodes

The trick is to understand if you create nodes and connect them in the same query or if you connect existing nodes.
in the mutation

{
  "set":[
     {
      "name": "Alice",
      "friend": {
        "name": "Betty"
      }
    }
  ]
}

from the doc, Dgraph will create 2 entities (node) and entity with name Alice will have a predicate “friend” to an entity with name Betty (second entity). the “friend” predicate is your ‘connection’.

You can also tell dgraph that an existing node has relations with other existing nodes using the sample provided by @MichelDiz with “uid”. and you can put has many relations as you want in the same mutation.