bitwalker / libgraph

A graph data structure library for Elixir projects
MIT License
524 stars 75 forks source link

Edgelist serialization capability #13

Closed yonkeltron closed 6 years ago

yonkeltron commented 6 years ago

Adding the ability to serialize a graph into the edgelist format used by the venerable igraph library and others. Hopefully this will ease the burden of moving graphs from Elixir into other systems for manipulation, analysis, and study.

I moved some of the logic I needed from the DOT Serializer module into the base Serializer behavior module. Hopefully this wasn't too bad of a move. Happy to clean it up if it doesn't pass muster.

Thanks, +Jonathan

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.09%) to 95.062% when pulling fbe488192fcfe3834c9c5a1329e2e2a6001eddf4 on yonkeltron:master into b772bd5c0281956e3abf395a8bb0721abf0e1312 on bitwalker:master.

bitwalker commented 6 years ago

This is great! I think it probably makes sense to add a public API function called serialize/2 which takes a graph and a serializer module, that way we don't need to keep increasing the surface of the public API, and third-party extensions can point people to Graph.serialize/2 rather than Graph.Serializer.<whatever>.serialize/1. That doesn't need to be part of this PR though, so I'll merge as is. Thanks!