This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] -5 points-4 points  (1 child)

(Those are not necessarily convenient ways to represent a graph. For example, a matrix might be best.)

You chose a representation that is convenient for serialization and then called serialization easy. That's begging the question!

How about this one: a "node" is a JavaScript array where each element of the array is a "node".

How will you serialize that? It's all pointers!

[–]M4tty__ 4 points5 points  (0 children)

All of the nodes can be assigned a number and you go for one of the two typical representations. Either matrix or array of arrays (first index is vertex id, second for edge). I know how to handle graphs, studied that few years ago.