Tree-like lines

I am implementing an interpreter-like project for which I need a weird little planning queue. Since I would like to try to avoid rethinking the wheels, I was hoping that someone could give me links to a similar structure or existing work. I know that I can just create several queues while I go, I'm just looking for some perspective from other people who may have better ideas than mine;)

I suppose it might work something like this: a structure is a tree with one root. You get a kind of "insert_iterator" to the root, and then click elements on it (for example, a and b in the example below). However, at any time, you can also split the iterator into several iterators, effectively creating branches. Branches cannot merge into the same queue again, but you can start appearing elements from the front of the queue (again, using the kind of "visitor_iterator") until empty branches cannot be discarded (at your discretion).

            x -> y -> z
a -> b -> { g -> h -> i -> j }
            f -> b

Any ideas? It seems like a relatively simple structure to realize myself using the queue pool, but I follow the β€œthink first, code later” strategy :)

thank

EDIT: , . , , . , ... COMMIT, ROLLBACK. x β†’ ..., g β†’ ... f β†’ ... COMMIT,

a -> b

, , COMMIT. .

x -> y -> z -> COMMIT

a β†’ b , . ROLLBACK, , a β†’ b.

! , .

+3
5

K, , , Quicksilver. ( : http://en.wikipedia.org/wiki/Disjoint-set_data_structure : http://www.boost.org/doc/libs/1_42_0/libs/disjoint_sets/disjoint_sets.html).

, , , , , , , . , , push_front pop_back, , .. , , " ", , .

-, , , "" . , , , "", . , , . , , . , , , , , , .

, . , , , . , node. . ( , "", , "pushing";))

, , - , .

0

Boost Graph Library , , , ( ).

- . - .

+2

, a Tree, , , , , . a.addSibling(b).

, , . , . , pop x, g f.

JGraphT.

0

(, ), . a node .

, " " Priority Queue.

0

,

x β†’ y β†’ z β†’ COMMIT

, N , / (), (-).

x[N]("data check") -> x[N-1]("data check") -> x[N-2]("data

check ") β†’ check β†’ y- > check β†’ y- > state β†’ z β†’ check β†’ z- > state β†’ z- > commit.

, , , x z, , ?

For me (my similar question, What models / types of task queues? Can a multi-level task queue exist in the form of an N-tree? ) Is an N-level structure that goes through child nodes with three kinds of automata available at each level:., $ To me -> tryCommit (tryAdvanceChildsBelow (tryAdvanceToNextSiblingStep (getNextSibling ())) and a dirty implementation must be rewritten to>

0
source

Source: https://habr.com/ru/post/1736606/


All Articles