l: init graphml2json
This commit is contained in:
parent
820e17ca1b
commit
d1d41f9d1f
12
lass/5pkgs/graphml2json/default.nix
Normal file
12
lass/5pkgs/graphml2json/default.nix
Normal file
@ -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))
|
||||||
|
''
|
Loading…
Reference in New Issue
Block a user