I’m looking for the kind of a certain datatypes.
The main idea of this datatype is to describe a productionline containing several steps. Each step should be represented as a “vertex” containing an object of any type. Then for every “vertex” there are possible “subproductionlines” joining the line.
So it could look something like:
O -> O -> | # subproductionline
| # joiningpoint
O -> O -> O -> O -> O -> O -> O # main productionline
| # joiningpoint
O -> O -> O -> | # subproductionline
| # joiningpoint
O -> | #subsubproductionline
Does anyone of you know such a datatype?
If I were to code such a datatype… I see there two options of doing this:
- A datatype as an Array (main productionline) containing Arrays (containing as first element the containing data of each vertex) and the rest of elements containing subproductionlines as recursive this datatype
or
- A datatype as an Array containing the data stored in the vertex. Last element is either the element, where this subproductionline is joining, or a specific element representing the end of a main productionline, if it is one.
What do yout think is the better solution?
The programming language I think of using for is c / c++.
3
I would characterise this as a directed graph. Each vertex (or node) is a stage in processing, and each edge links two stages in a production process.
What you have drawn is a Directed Graph. It is most likely a Directed Tree, but it could be a Directed Acyclic Graph. The diagram provided and my understanding of the process would not be compatible with cycles, but I’m not clear whether there is only fan-in or there is also fan-out.
Graphs of this kind are a well known and thoroughly analysed data structures. There are numerous algorithms for doing interesting things like finding paths, pruning, reordering, weighting and so on.
In C++ you could implement this as a Node with a collection of pointers to other Nodes. If it is a tree, and if you need to navigate in only one direction, you need only one ‘down’ pointer per node.
There are functions provided in the standard libraries to make implementing structures like these very straightforward. You could say C++ was designed to solve this problem (and those like it).
Well, after long searching and going through my own studydocuments I ended up with LTS (labelled transition system) with two different transitions for example m(for main) and s(for sub)
so you have a set of nodes. and a set of transitions, which contain the information, if it is in the main production line or if it comes from a sub production line.