# Create a lists of clustered nodes in a network

**URL:** <https://forum.knime.com/t/create-a-lists-of-clustered-nodes-in-a-network/36558>\
**Category:** KNIME Analytics Platform\
**Created:** [October 6, 2021, 7:34am UTC](https://forum.knime.com/t/create-a-lists-of-clustered-nodes-in-a-network/36558 "2021-10-06T07:34:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![TigerCole](https://forum-cdn.knime.com/user_avatar/forum.knime.com/tigercole/32/17065_2.png) [@TigerCole](https://forum.knime.com/u/TigerCole)\
**Post date:** [October 6, 2021, 7:34am UTC](https://forum.knime.com/t/create-a-lists-of-clustered-nodes-in-a-network/36558/1 "2021-10-06T07:34:16Z")

</div>

Hi…

I have a CSV file that lists the relationships between nodes in a whole network that contains sub-networks. An example of what may look like is the image below.

 ![KnimeEgPub](https://forum-cdn.knime.com/uploads/default/original/3X/6/8/68be2e9b7422bca985ac81caa9f0107389b3edf5.png)

The network CSV looks like this:

| Src | Dst | Label |
| --- | --- | --- |
| A | B | has |
| A | E | has |
| B | C | has |
| B | H | has |
| H | I | has |
| C | G | has |
| C | D | has |
| L | S | has |
| O | M | has |
| J | K | has |
| K | N | has |
| N | J | has |
| P | R | has |
| R | P | has |
| P | Q | has |
| Q | R | has |
| C | H | has |

What I need to do is extract clustered nodes into a list so that the final output table of the network looks something like this:

| Network | Nodes |
| --- | --- |
| Net1 | S,L |
| Net2 | A,E,B,C,D,G,H,I |
| Net3 | M,O |
| Net4 | J,K,N |
| Net5 | P,Q,R |

I there a way to create the network in KNIME and then create this table of clustered nodes?

Thanks

tC/.

---

<div class="post-metadata">

**Author:** ![aworker](https://forum-cdn.knime.com/user_avatar/forum.knime.com/aworker/32/36421_2.png) [@aworker](https://forum.knime.com/u/aworker)\
**Post date:** [October 6, 2021, 10:01am UTC](https://forum.knime.com/t/create-a-lists-of-clustered-nodes-in-a-network/36558/2 "2021-10-06T10:01:42Z")

</div>

Hi @TigerCole

The best way of dealing with this question is to use the Network plugin available in KNIME:

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/1/6/163f8e5d7e3db4ea12b6d58b1d6cf4d2f43a1909.png)  
 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/2/7/271937ed927b4efbbd914ebfa4602abdf7dc994c.png)

Please find a possible solution here below:

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/9/9/9921a29ec516d2cc8d1c2523eadd5900c1b35533.png)

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/1/8/18dc248e7244619935847d10e467a095c54f4804.png)

![image](https://forum-cdn.knime.com/uploads/default/original/3X/2/2/22c9e1f9379728934f210ce4cfba70f98fe24c57.png)

[20211006 Pikairos Create a lists of clustered nodes in a network.knwf](https://forum.knime.com/uploads/short-url/1J6ZL7Dp2rDt8lgaavvyNnp4oe3.knwf) (339.5 KB)

Hope this helps.

Best

Ael

PS: Complementary workflows and information about network graphs can be found in the KNIME hub:

[KNIME Hub Graph Network examples](https://hub.knime.com/search?q=network)

---

<div class="post-metadata">

**Author:** ![TigerCole](https://forum-cdn.knime.com/user_avatar/forum.knime.com/tigercole/32/17065_2.png) [@TigerCole](https://forum.knime.com/u/TigerCole)\
**Post date:** [October 6, 2021, 11:59am UTC](https://forum.knime.com/t/create-a-lists-of-clustered-nodes-in-a-network/36558/3 "2021-10-06T11:59:03Z")

</div>

Hi @aworker …

This is exactly what I have been trying to do. Thank you for the example workflow. it has saved me days of work.

tC/.

---

<div class="post-metadata">

**Author:** ![aworker](https://forum-cdn.knime.com/user_avatar/forum.knime.com/aworker/32/36421_2.png) [@aworker](https://forum.knime.com/u/aworker)\
**Post date:** [October 6, 2021, 12:07pm UTC](https://forum.knime.com/t/create-a-lists-of-clustered-nodes-in-a-network/36558/4 "2021-10-06T12:07:46Z")

</div>

HI @TigerCole

I’m glad it worked. Your kind feedback is my best reward and thanks for validating the solution 😃 👍 !

Just a comment about this solution. As you will notice, the loop iterates as many times as nodes in the graph. This is fine with graphs with a reasonable number of nodes. However, if your network is made of millions of nodes but much less sub-graphs, an optimized alternative solution could be implemented with a recursive loop. I just wanted to let you know in case you have a huge network. Please get back in touch if this is the case for you. I’ll be happy to help further.

Best wishes,

Ael

---

<div class="post-metadata">

**Author:** ![TigerCole](https://forum-cdn.knime.com/user_avatar/forum.knime.com/tigercole/32/17065_2.png) [@TigerCole](https://forum.knime.com/u/TigerCole)\
**Post date:** [October 6, 2021, 2:19pm UTC](https://forum.knime.com/t/create-a-lists-of-clustered-nodes-in-a-network/36558/5 "2021-10-06T14:19:41Z")

</div>

Hi @aworker …

I did notice the looping but the flow finished in a few seconds… I am sure I will be posting on the forum again about networks. It is something that I am encountering more and more and it may make some of the things I need to do a lot more efficient, especially where data elements are closely related.

Thanks again for your help.

tC/.

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [October 13, 2021, 2:20pm UTC](https://forum.knime.com/t/create-a-lists-of-clustered-nodes-in-a-network/36558/6 "2021-10-13T14:20:20Z")

</div>

Closed on October 13, 2021, 2:20pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
