In [ ]:
from francy_widget import FrancyWidget
In [ ]:
import networkx
G1 = networkx.Graph([(1, 2), (2, 3), (3, 4)])  # graph from list of edges
In [ ]:
w1 = FrancyWidget(G1, counter=0, title="Undirected Graph Example")
#w1.adapter.to_dict(G1, title="Undirected graph")
#w1.adapter.to_json(G1, title="Undirected Graph")
In [ ]:
w1
In [ ]:
G2 = networkx.DiGraph([(1, 2)])
w2 = FrancyWidget(G2, counter=50, title="Directed Graph Example")
w2
In [ ]:
G3 = networkx.balanced_tree(2,1)
w3 = FrancyWidget(G3, counter=100, title="Tree Graph as Directed", height=200)
#w3.adapter.to_json(G3, title="Tree Graph", height=200, graphType="directed", collapsed=False)
In [ ]:
w3
In [ ]:
G33 = networkx.DiGraph([('1', 'G'), ('G', 'SG1'), ('G', 'SG2')])
w33 = FrancyWidget(G33, counter=150, title="Example Tree Graph", graphType="tree", collapsed=False) #, nodeTypes=['square', 'circle', 'circle', 'circle'])
#w33.adapter.to_json(G33, title="Example Tree Graph", graphType="tree", collapsed=False) #, nodeTypes=['square', 'circle', 'circle', 'circle'])
In [ ]:
#w33.adapter.__dict__
#w33.adapter.canvas.__dict__
#w33.adapter.canvas.graph.__dict__
#w33.adapter.to_json(G33)
w33
In [ ]:
from francy_widget.francy_adapter import *
m = FrancyMessage(text="There are 8 levels in this Group.")
m.to_json()
In [ ]:
# Exporting generated JSON
import json
myjson = json.loads(w33.json_data)
dump = json.dumps(myjson, indent=4, sort_keys=False)
print(dump)
#open("test/myjson33.json", 'w').write(dump)