-
-
Save PaulCapestany/643c509526211d3e099486852a841668 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import graphviz as gv | |
import sys | |
import json | |
graph = gv.Graph(format='svg') | |
lngraph = json.load(sys.stdin) | |
for node in lngraph['nodes']: | |
nodename = node['pub_key'][-6:] | |
graph.node(nodename) | |
print "Added {0}".format(nodename) | |
for edge in lngraph['edges']: | |
node1 = edge['node1_pub'][-6:] | |
node2 = edge['node2_pub'][-6:] | |
graph.edge(node1, node2, label="ch:"+str(edge['channel_id'])[-4:]) | |
print "Added edge {0} <-> {1}".format(node1,node2) | |
filename = graph.render(filename='lngraph') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment