In [1]:
import cytoscape.main as cy
In [2]:
cy.init_ipynb()
In [3]:
cy.plot()
In [8]:
nodes = [
{ 'data': { 'id': 'a' } },
{ 'data': { 'id': 'b' } },
{ 'data': { 'id': 'c' } },
{ 'data': { 'id': 'd' } },
{ 'data': { 'id': 'e' } },
{ 'data': { 'id' : 'f'} }
]
edges = [
{ 'data': { 'id': 'a', 'weight': 1, 'source': 'a', 'target': 'e' } },
{ 'data': { 'id': 'ab', 'weight': 3, 'source': 'a', 'target': 'b' } },
{ 'data': { 'id': 'be', 'weight': 4, 'source': 'b', 'target': 'e' } },
{ 'data': { 'id': 'bc', 'weight': 5, 'source': 'b', 'target': 'c' } },
{ 'data': { 'id': 'ce', 'weight': 6, 'source': 'c', 'target': 'e' } },
{ 'data': { 'id': 'cd', 'weight': 2, 'source': 'c', 'target': 'd' } },
{ 'data': { 'id': 'de', 'weight': 7, 'source': 'd', 'target': 'e' } },
{ 'data': { 'id': 'df', 'weight': 7, 'source': 'd', 'target': 'f' } },
{ 'data': { 'id': 'fc', 'weight': 3, 'source': 'f', 'target': 'c' } },
{ 'data': { 'id': 'fe', 'weight': 5, 'source': 'f', 'target': 'e' } }
]
cy.plot(nodes=nodes, edges=edges)