# get a list of all possible combinations

This is kind of tricky to explain but I’ll do my best to simplify it.

Basically I have created a flowchart creator, the flowchart is made up of nodes, each node contains a list of sprites, node paths are determined from any complete path beginning at the start node and finishing at the end node. That’s all good, that’s all working.

EDIT: image code isn’t working for some reason but here is a link to the image for a better understanding

!(http://)

So I have a list of node paths, that all works but let’s just imagine there is only one node path to make it simpler (The path on the left that has the male node for example). How would I iterate through the nodes and the sprites they contain to get a list of all possible combinations of all the sprites?

A node path is just made up of a list of nodes and the nodes are just a class that contains a list of sprites.

Any help would be massively appreciated, this is the final problem that needs to be solved in order to complete my advanced NFT generator.

EDIT:

Never mind I eventually figured it out.

Well, this is for future reference.
There are multiple approaches depending on the exact format of the tree.

In general, you might explore the tree depth first, and mark a decision that ended up with a leaf node, so that you can decide differently on your subsequent paths. Obviously the algorithms can turn quite complex depending on what kind of result you need, but that’s a short explanation. For this to work, the graph must be a ‘directed acyclic graph’. This topic belongs to a domain of topological sorting.