Convert networkx graph to qgsvectorlayer in pyqgis

I'm converting to a QGIS processing plugin a python script that loads two spatial layers (nodes and edges), converts them to a graph using networkx and after doing some transformation converts back...

Geographic Information Systems Stack Exchange