# How to get group of connected nodes?

**URL:** https://community.neo4j.com/t/how-to-get-group-of-connected-nodes/41855
**Category:** Cypher
**Tags:** apoc, cypher, relationship, knowledge-base
**Created:** [July 23, 2021, 7:57am UTC](https://community.neo4j.com/t/how-to-get-group-of-connected-nodes/41855 "2021-07-23T07:57:38Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![Cobra](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/cobra/32/35243_2.png) [@Cobra](https://community.neo4j.com/u/Cobra)
#### Post date: [July 23, 2021, 9:50pm UTC](https://community.neo4j.com/t/how-to-get-group-of-connected-nodes/41855/4 "2021-07-23T21:50:53Z")

</div>

You were pretty close 🙂

```auto
CALL gds.wcc.stream({
    nodeProjection: "*",
    relationshipProjection: "*"
})
YIELD nodeId, componentId
WITH componentId, gds.util.asNode(nodeId) AS n
WHERE n:Label
RETURN componentId, collect(n.name) AS nodes

```

---

_[View the full topic](https://community.neo4j.com/t/how-to-get-group-of-connected-nodes/41855)._
