I have some images of very simple directed graphs with just a few nodes and edges. I know there is lots of tools, which print out graphs with a adjacency matrix is an input, but I need to do it the other way around.

For example Das and Chanda's paper covers this technique, but on a more advanced level. Their approach covers quite complex graphs, possibly even hand-written.

However the graphs I am targeting are much simpler and all machine generated. For example if I get this image as an input:

Input graph

I would expect the following adjacency matrix as an output:

|   | A | B |
| A | 0 | 1 |
| B |-1 | 0 |

Does someone know a tool that is capable doing this or can provide me some resources on how I can develop such a tool myself?

I was thinking about a convolutional neural network for simple object recognition, which in this case would be the nodes and edges. Do you think this approach might work or would it be overkill?


closed as off-topic by Sycorax, Michael Chernick, mdewey, Peter Flom Jun 18 '18 at 11:03

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – Sycorax, Michael Chernick, mdewey, Peter Flom
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Ok after further research about the problem I found out that scikit-image might be able to help solve this problem. I am particularily looking at hough transformations. But still I couldn't find any ready-to-use implementations, even though this problem appears rather basic to me. Does anyone have an idea on how to implement a directed graph to adjacency matrix conversion algorithm with scikit-image? $\endgroup$ – Julian Pr Jan 11 '17 at 16:05
  • $\begingroup$ Go for openCV and focus on computer-images (not hand drawn) and undirected graphs. If you are able to solve this much more simple problem, then you might continue. Further, define expectations regarding circle size and line thickness. Finally you will still need to extract the letter inside the circle. $\endgroup$ – Nikolas Rieble Jan 30 '17 at 9:57