0

I am developing a Python Flask REST API service which should return NetworkX.MultiDiGraph to REST API caller. I tried converting the Graph to JSON using networkx.node_link_data(). However I get error "TypeError: Object of type LineString is not JSON serializable". Because the graph has "geometry" with Shapely.LineString objects which were not converted to JSON and remained in the JSON like:

'geometry': <LINESTRING (77.618 12.937, 77.618 12.937, 77.618 12.937, 77.618 12.937, 77....>

Could not find any way to write in GraphML format to HTTP Response stream directly without first writing to local file.

Is there a way I can send NetworkX.MultiDiGraph data to another microservice over HTTP?

0 Answers0