diff options
Diffstat (limited to 'lass/5pkgs')
-rw-r--r-- | lass/5pkgs/graphml2json/default.nix | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lass/5pkgs/graphml2json/default.nix b/lass/5pkgs/graphml2json/default.nix new file mode 100644 index 000000000..6f06ded3d --- /dev/null +++ b/lass/5pkgs/graphml2json/default.nix @@ -0,0 +1,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)) +'' |