Closed Kemsekov closed 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.
Done
Any graph can be represented as following structure
Add converters for this things