Graph visualizers, such as Graphviz, can take a formal representation of the nodes and edges of a graph and produce an image from them. What's a program or programming library that can do the reverse; that is, recognize an image of a graph and produce a formal representation? I would be interested in software for recognizing a bitmap as well as the easier case of recognizing a graph from an SVG that follows a standard structure. Either way, restrictions on the graph's appearance are okay. Also, I require only the extraction of node-and-edge relationships, not other things like text labels of nodes.
Mathematica has a built-in function called MorphologicalGraph.
The open source image analysis software Fiji can do this too. The rough steps are:
- Smoothen the image if needed
- Threshold the image to make it binary
- Process -> Binary -> Skeletonize
- Analyze -> Skeleton -> Analyze Skeleton, tick Show Detailed Info. When a table comes up, save it as CSV.