blob: 6f06ded3d6441d2d0c6aa7778a5018171364edce (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
{ pkgs, ... }:
pkgs.writers.writePython3Bin "graphml2json" { libraries = [ pkgs.python3Packages.networkx ]; } ''
import networkx as nx
import json
import sys
G = nx.read_graphml(sys.argv[1])
data = nx.readwrite.json_graph.node_link_data(G)
print(json.dumps(data, indent=2))
''
|