Generating Images of Graphs in Golang

One project I have been considering doing the last few days was generating an image of all my blog posts and how they relate to one another. In a sense, it would be a giant neural network, because every time I link two of my blog posts I link them in my brain as well. Although this is still a work in progress, I have run into an interesting problem.

Usually, I can simply generate graphs via Google Drives Spreadsheets or Excel. However, in this case neither really had what I desired, I need a web crawler, imaging library, and graph generator. Being a programmer I knew I could “just build it myself,” usually those are famous last words, but it turns out it is not that bad. I really enjoy Go and the hardest part of the whole project thus far has been generating circles…

blogmap

The Go code below is a bit messy and needs some refactoring, but it uses some interesting features to form the circles/lines. The circles are developed using a masking method [1], essentially I just make two images, overlay them and only display the circles I wish (almost like a print). The lines are then drawn between the points on the circles. Clearly, there is more work to do and I intend to greatly improve this code over the next week or so and I should have a program that can display the connections between my posts soon enough!

If you would rather view my code via github you can.

Leave a Reply

Your email address will not be published.

 characters available

Time limit is exhausted. Please reload the CAPTCHA.