AMIOL7 / ELME

Apache License 2.0
0 stars 1 forks source link

Serialization of graphs #19

Open vismate opened 1 year ago

vismate commented 1 year ago

We should figure out a way to serialize graphs in a human readable form.

AMIOL7 commented 1 year ago

Here is my idea on how to serialize graphs in JSON format: Serialization_Sample.txt

If you have any ideas or comments, you can write them here and we can also discuss it on closest meeting

AMIOL7 commented 1 year ago

Here is another option: Serialization_Sample_2.txt

pszi commented 1 year ago

The former one I like more, however all nodes have a predefined number of ports, so those don't need to be stored in my opinion. I would suggest separate entry point entities for saved graphs, as well as special always on/always off/switch node-like objects for trying them out (that are of course not saved).

vismate commented 1 year ago

The benefit of the second example is that we already have the nodes in memory (deserialized) by the time we try to make connections. That way we can actually add the connections inputs/outputs as we go.

AMIOL7 commented 1 year ago

Guys, I need some ideas. I am half-way dome with serializing graph to JSON, but I am at a loss on how to serialize links between nodes, as ports currently have no idea to which node they are connected. My current idea is to add id attribute to the nodes and pass it to ports when they are created for a node together with its index in corresponding port array. @vismate @pszi @bgdxqi

AMIOL7 commented 1 year ago

Note to self. Close creating JSON object at the end of serialization

AMIOL7 commented 1 year ago

@vismate @pszi @bgdxqi I just an idea I want to run past you all. What if when storing the graph we don't store it's nodes and links between them, but rather the resulting truth table of the graph (maybe even in a form of formula)?

vismate commented 1 year ago

@vismate @pszi @bgdxqi I just an idea I want to run past you all. What if when storing the graph we don't store it's nodes and links between them, but rather the resulting truth table of the graph (maybe even in a form of formula)?

In the serialized file?

AMIOL7 commented 1 year ago

@vismate @pszi @bgdxqi I just an idea I want to run past you all. What if when storing the graph we don't store it's nodes and links between them, but rather the resulting truth table of the graph (maybe even in a form of formula)?

In the serialized file?

Yes

vismate commented 1 year ago

Could work. We had a discussion with @pszi where we thought it'd be a good idea to make saved circuits read only. With that in mind your idea could work really well.

Maybe we'd need to store the free input and output ports and their labels, but besides that a truth table should work.

I have sample code written in rust how to construct such truth tables efficiently. (Without trying and saving all possible combinations)

AMIOL7 commented 1 year ago

Could work. We had a discussion with @pszi where we thought it'd be a good idea to make saved circuits read only. With that in mind your idea could work really well.

Maybe we'd need to store the free input and output ports and their labels, but besides that a truth table should work.

I have sample code written in rust how to construct such truth tables efficiently. (Without trying and saving all possible combinations)

Can you please share that code so that I can take a look and don't waste time "reinventing the wheel"

vismate commented 1 year ago

Could work. We had a discussion with @pszi where we thought it'd be a good idea to make saved circuits read only. With that in mind your idea could work really well.

Maybe we'd need to store the free input and output ports and their labels, but besides that a truth table should work.

I have sample code written in rust how to construct such truth tables efficiently. (Without trying and saving all possible combinations)

Can you please share that code so that I can take a look and don't waste time "reinventing the wheel"

Sure. We could also pop into a call, because I admit the code can be confusing. Also, for our purpose it could be simplified.

AMIOL7 commented 1 year ago

Could work. We had a discussion with @pszi where we thought it'd be a good idea to make saved circuits read only. With that in mind your idea could work really well.

Maybe we'd need to store the free input and output ports and their labels, but besides that a truth table should work.

I have sample code written in rust how to construct such truth tables efficiently. (Without trying and saving all possible combinations)

Can you please share that code so that I can take a look and don't waste time "reinventing the wheel"

Sure. We could also pop into a call, because I admit the code can be confusing. Also, for our purpose it could be simplified.

How about a call tomorrow at 6 or 7? I am busy today

vismate commented 1 year ago

Could work. We had a discussion with @pszi where we thought it'd be a good idea to make saved circuits read only. With that in mind your idea could work really well.

Maybe we'd need to store the free input and output ports and their labels, but besides that a truth table should work.

I have sample code written in rust how to construct such truth tables efficiently. (Without trying and saving all possible combinations)

Can you please share that code so that I can take a look and don't waste time "reinventing the wheel"

Sure. We could also pop into a call, because I admit the code can be confusing. Also, for our purpose it could be simplified.

How about a call tomorrow at 6 or 7? I am busy today

Could work. I'll share the code here for future reference as well.

pszi commented 1 year ago

@vismate @pszi @bgdxqi I just an idea I want to run past you all. What if when storing the graph we don't store it's nodes and links between them, but rather the resulting truth table of the graph (maybe even in a form of formula)?

Initially I thought this is how you were going to do it, yes, it would be far simpler on my end as well, it would deny a vision I had where a miniaturized graph would be drawn inside, however that would be complicated and we don't have time for that anyway so it's all good.

vismate commented 1 year ago

Could work. We had a discussion with @pszi where we thought it'd be a good idea to make saved circuits read only. With that in mind your idea could work really well. Maybe we'd need to store the free input and output ports and their labels, but besides that a truth table should work. I have sample code written in rust how to construct such truth tables efficiently. (Without trying and saving all possible combinations)

Can you please share that code so that I can take a look and don't waste time "reinventing the wheel"

Sure. We could also pop into a call, because I admit the code can be confusing. Also, for our purpose it could be simplified.

How about a call tomorrow at 6 or 7? I am busy today

Could work. I'll share the code here for future reference as well.

Rust code for future reference: https://github.com/vismate/akigol

vismate commented 1 year ago

In today's meeting we decided the following:

pszi commented 1 year ago

When saving we require all free ports to have unique names

Will the names be generated using uniquely identifying data it already has, or do you want that to be manual?

AMIOL7 commented 1 year ago

When saving we require all free ports to have unique names

Will the names be generated using uniquely identifying data it already has, or do you want that to be manual?

I think, to keep it simple, generating them is a better option

AMIOL7 commented 1 year ago

@pszi @bgdxqi @vismate I have a couple of questions.

AMIOL7 commented 1 year ago

Also can one of you please take over this issue? At least temporarily. I am still feeling weak, but I do not want to keep this issue stagnated any longer, with deadline next week

vismate commented 1 year ago

@pszi @bgdxqi @vismate I have a couple of questions.

  • Does the graph have Evaluate method? If yes, wouldn't it be better to use it it evaluate the value of graph's output for every possible input?
  • We need to name the graphs when saving them. Do we make it automatic, or do we ask the user for it?

The graph does have an evaluate method, although it does a bit more than just simply returning the outputs (it updates every node within). Also, it still needs to undergo a rework because of recent changes in the model. On a high level it would work well.

Naming the graph shoud be delegated to the user imo.

vismate commented 1 year ago

Also can one of you please take over this issue? At least temporarily. I am still feeling weak, but I do not want to keep this issue stagnated any longer, with deadline next week

Get well soon! I'm sure we can take this issue over. I'll open an issue soon, because we need a bit of re-organising in my oppinion.

pszi commented 1 year ago

@AMIOL7 Wish you a quick recovery! Sadly it's going to fall upon @vismate and @bgdxqi because my weekend is crazy busy, and next week I'm only going to be able to contribute after work, and I'd like to dedicate that to UI features, such as displaying saved nodes as buttons, and editable textboxes (for naming graphs as an example). Good luck boys!

AMIOL7 commented 1 year ago

@vismate @pszi @bgdxqi Since this issue and branch fell far behind, do you mind if I just close this issue and delete the branch?

vismate commented 1 year ago

@vismate @pszi @bgdxqi Since this issue and branch fell far behind, do you mind if I just close this issue and delete the branch?

I don't think it really needs to be deleted. It could still be useful someday.

AMIOL7 commented 1 year ago

@vismate @pszi @bgdxqi Since this issue and branch fell far behind, do you mind if I just close this issue and delete the branch?

I don't think it really needs to be deleted. It could still be useful someday.

The issue, yes, it can be useful. We had a lot of decisions here, but the branch has only 1 commit, and we not even going to use it

vismate commented 1 year ago

@vismate @pszi @bgdxqi Since this issue and branch fell far behind, do you mind if I just close this issue and delete the branch?

I don't think it really needs to be deleted. It could still be useful someday.

The issue, yes, it can be useful. We had a lot of decisions here, but the branch has only 1 commit, and we not even going to use it

The branch can be deleted then.

bgdxqi commented 1 year ago

Perhaps tag the issue with something like 'wontfix' so it is clear that there is no work being done on this issue right now