# Check Edges

**URL:** <https://discuss.dgraph.io/t/check-edges/10660>\
**Category:** Dgraph\
**Tags:** kind:question, cascade, dql\
**Created:** [September 29, 2020, 6:10am UTC](https://discuss.dgraph.io/t/check-edges/10660 "2020-09-29T06:10:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luke](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/luke/32/10557_2.png) [@luke](https://discuss.dgraph.io/u/luke)\
**Post date:** [September 29, 2020, 6:10am UTC](https://discuss.dgraph.io/t/check-edges/10660/1 "2020-09-29T06:10:28Z")

</div>

```auto
# Define Types

type Person {
    name
    age
    friend
    owns_pet
}

type Animal {
    name
}

# Define Directives and index

name: string @index(term) @lang .
age: int @index(int) .
friend: [uid] @count .
owns_pet: [uid] .

```

I want to check whether there is a edge ‘friend’ between A and c

 ![WechatIMG126](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/d/d716c50b63fdfbb8d383abb8eba5ee777a92c510.png)

---

<div class="post-metadata">

**Author:** ![anand](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/anand/32/5674_2.png) [@anand](https://discuss.dgraph.io/u/anand)\
**Post date:** [September 29, 2020, 6:48am UTC](https://discuss.dgraph.io/t/check-edges/10660/2 "2020-09-29T06:48:24Z")

</div>

Assuming this mutation:

```auto
{
  set{
    _:a <name> "A" .
    _:b <name> "B" .
    _:c <name> "C" .

    _:a <friend> _:b .
  }
}

```

If you get empty response in `qry_ac`, it can be concluded that there is no edge between a and c.

```auto
{
  a as var(func: eq(name, "A"))
  c as var(func: eq(name, "C"))
  b as var(func: eq(name, "B"))
	#get a to b linl  
  qry_ab(func: uid(a)) @cascade{
    uid
    friend @filter(uid(b)){
      uid
    }
  }
  #get a to c link
  qry_ac(func: uid(a)) @cascade{
    uid
    friend @filter(uid(c)){
      uid
    }      
  }
}

```

The response is as below.

```auto
{
  "data": {
    "qry_ab": [
      {
        "uid": "0x1",
        "friend": [
          {
            "uid": "0x2"
          }
        ]
      }
    ],
    "qry_ac": []
  }
}

```

---

<div class="post-metadata">

**Author:** ![luke](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/luke/32/10557_2.png) [@luke](https://discuss.dgraph.io/u/luke)\
**Post date:** [September 29, 2020, 7:44am UTC](https://discuss.dgraph.io/t/check-edges/10660/4 "2020-09-29T07:44:15Z")

</div>

Thanks it work out!
