# Finding all connected nodes in a cyclic graph

**URL:** <https://community.neo4j.com/t/finding-all-connected-nodes-in-a-cyclic-graph/14784>\
**Category:** Cypher\
**Created:** [February 17, 2020, 7:02am UTC](https://community.neo4j.com/t/finding-all-connected-nodes-in-a-cyclic-graph/14784 "2020-02-17T07:02:26Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Joel](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/joel/32/17191_2.png) [@Joel](https://community.neo4j.com/u/Joel)\
**Post date:** [February 17, 2020, 7:30pm UTC](https://community.neo4j.com/t/finding-all-connected-nodes-in-a-cyclic-graph/14784/2 "2020-02-17T19:30:49Z")

</div>

In answer to your first question, you might want to come at it from another angle (if you are able to add properties onto the nodes). I believe what you are describing is counting the nodes in a subgraph that is disconnected from the rest of the nodes in a Neo4j db? There is at least one algorithm in apoc that can be used to label all nodes in every disconnected graph with a unique group number, once that is complete then a cypher to count the nodes in a group (all with the same group number) is quick and easy.

More information on a related thread

> [@Subgraph identification](https://community.neo4j.com/t/subgraph-identification/7068):
>
> I have a problem: nodes and nodes are connected to each other into dozens of small networks through various relationships. How can I mark each subgraph? In other words, how do I know how many subgraphs, and what are each subgraphs? Thank you very much for your help!

Doing this can be very useful to get a perspective on what is in a graph, the characteristics and number of disconnected subgraphs can provide insights.

---

_[View the full topic](https://community.neo4j.com/t/finding-all-connected-nodes-in-a-cyclic-graph/14784)._
