diff options
author | lassulus <git@lassul.us> | 2023-09-04 13:51:04 +0200 |
---|---|---|
committer | lassulus <git@lassul.us> | 2023-09-04 13:51:04 +0200 |
commit | d1d41f9d1fb6d95ed38873bfb61c15de954dd499 (patch) | |
tree | 38f5b60318bc814f15d3a585511ca5c59c4e00f4 /lass | |
parent | 820e17ca1b7ab863ae69d18f56c042112385ca08 (diff) |
l: init graphml2json
Diffstat (limited to 'lass')
-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)) +'' |