# \`node graph generate\` with multiple root nodes?

**URL:** <https://aiida.discourse.group/t/node-graph-generate-with-multiple-root-nodes/353>\
**Category:** General Usage\
**Tags:** question\
**Created:** [March 28, 2024, 2:15pm UTC](https://aiida.discourse.group/t/node-graph-generate-with-multiple-root-nodes/353 "2024-03-28T14:15:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bilke](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/bilke/32/109_2.png) [@bilke](https://aiida.discourse.group/u/bilke)\
**Post date:** [March 28, 2024, 2:15pm UTC](https://aiida.discourse.group/t/node-graph-generate-with-multiple-root-nodes/353/1 "2024-03-28T14:15:31Z")

</div>

Is it somehow possible to generate node graphs with multiple root nodes? I know the command signature allows only one `ROOT_NODE`.

---

<div class="post-metadata">

**Author:** ![sphuber](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/sphuber/32/6_2.png) [@sphuber](https://aiida.discourse.group/u/sphuber)\
**Post date:** [March 28, 2024, 4:25pm UTC](https://aiida.discourse.group/t/node-graph-generate-with-multiple-root-nodes/353/2 "2024-03-28T16:25:05Z")

</div>

The CLI currently doesn’t allow this indeed, but in principle I see no reason why not to allow specifying multiple. I opened a feature request for it: [Allow multiple root nodes for node graph generation · Issue #6335 · aiidateam/aiida-core · GitHub](https://github.com/aiidateam/aiida-core/issues/6335)  
It should be relatively easy to implement.

In the meantime, if you already want to use it, you can look at the implementation and adapt it yourself:

> <https://github.com/aiidateam/aiida-core/blob/6898ff4d8c263cf08707c61411a005f6a7f731dd/src/aiida/cmdline/commands/cmd_node.py#L477>

Essentially you would just call `Graph.recurse_ancestors` and `Graph.recurse_descendants` for each root node.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/aiida/original/1X/c417197d3750949351575d03ed03f5e2ad32e649.png) [@system](https://aiida.discourse.group/u/system)\
**Post date:** [March 28, 2026, 4:25pm UTC](https://aiida.discourse.group/t/node-graph-generate-with-multiple-root-nodes/353/3 "2026-03-28T16:25:09Z")

</div>

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