Kemsekov / GraphSharp

GraphSharp is a tool to study and use knowledge of graph theory in C#!
MIT License
37 stars 5 forks source link

Add key:value representation of graph and converters for it #30

Closed Kemsekov closed 2 years ago

Kemsekov commented 2 years ago

Any graph can be represented as following structure

[node1,node2,weight1],
[node3,node5,weight2],
...

Add converters for this things

Kemsekov commented 2 years ago

Well, not any graph can be represented in such a way. You forgetting the fact that node itself can store weight too, but it makes sense to create converters for something like this:

[weight0, weight1,weight2,weight3...],
[nodeId,nodeId,weight],
[nodeId,nodeId,weight],
...

Where first array is weights for each node with increasing index. weight0 is for node0, weight1 for node1 and so on.

And next values is nodes Id of edges where first node is parent, second is child, and third is a weight of edge. This representation will cover most of use cases.

Kemsekov commented 2 years ago

Done