︠f6b83f7a-887f-49a2-bfc9-0727881e7b52︠ g = DiGraph({42 : [4,15], 4 : [3,5],3:[10,11], 15 : [7], 5:[12,13],10:[],11:[14]}) show(g) ︡139f6c60-120d-43a2-8024-e89be21085b4︡{"d3":{"viewer":"graph","data":{"link_distance":50,"link_strength":1,"links":[{"strength":0,"target":4,"color":"#aaa","curve":0,"source":0,"name":""},{"strength":0,"target":5,"color":"#aaa","curve":0,"source":0,"name":""},{"strength":0,"target":0,"color":"#aaa","curve":0,"source":1,"name":""},{"strength":0,"target":2,"color":"#aaa","curve":0,"source":1,"name":""},{"strength":0,"target":6,"color":"#aaa","curve":0,"source":2,"name":""},{"strength":0,"target":7,"color":"#aaa","curve":0,"source":2,"name":""},{"strength":0,"target":8,"color":"#aaa","curve":0,"source":5,"name":""},{"strength":0,"target":3,"color":"#aaa","curve":0,"source":9,"name":""},{"strength":0,"target":1,"color":"#aaa","curve":0,"source":10,"name":""},{"strength":0,"target":9,"color":"#aaa","curve":0,"source":10,"name":""}],"pos":[],"height":null,"edge_thickness":2,"loops":[],"edge_labels":false,"vertex_size":7,"vertex_labels":true,"directed":true,"gravity":0.04,"width":null,"charge":-120,"nodes":[{"group":"0","name":"3"},{"group":"0","name":"4"},{"group":"0","name":"5"},{"group":"0","name":"7"},{"group":"0","name":"10"},{"group":"0","name":"11"},{"group":"0","name":"12"},{"group":"0","name":"13"},{"group":"0","name":"14"},{"group":"0","name":"15"},{"group":"0","name":"42"}]}}}︡{"html":"
"}︡ ︠65798482-cea6-4344-a009-9afb2afa649a︠ import graphics; graphics.graph_to_d3_jsonable? ︡064ebc8a-0430-4031-b56c-ff30ea3c2855︡{"code":{"source":"File: /projects/4a5f0542-5873-4eed-a85c-a18c706e8bcd/.sagemathcloud/graphics.py\nSignature : graphics.graph_to_d3_jsonable(G, vertex_labels=True, edge_labels=False, vertex_partition=[], edge_partition=[], force_spring_layout=False, charge=-120, link_distance=50, link_strength=1, gravity=0.04, vertex_size=7, edge_thickness=2, width=None, height=None, **kwds)\nDocstring :\nDisplay a graph in SageMathCloud using the D3 visualization\nlibrary.\n\nINPUT:\n\n* \"G\" -- the graph\n\n* \"vertex_labels\" (boolean) -- Whether to display vertex labels\n (set to \"True\" by default).\n\n* \"edge_labels\" (boolean) -- Whether to display edge labels (set\n to \"False\" by default).\n\n* \"vertex_partition\" -- a list of lists representing a partition\n of the vertex set. Vertices are then colored in the graph\n according to the partition. Set to \"[]\" by default.\n\n* \"edge_partition\" -- same as \"vertex_partition\", with edges\n instead. Set to \"[]\" by default.\n\n* \"force_spring_layout\" -- whether to take sage's position into\n account if there is one (see \"()\" and \"()\"), or to compute a\n spring layout. Set to \"False\" by default.\n\n* \"vertex_size\" -- The size of a vertex' circle. Set to 7 by\n default.\n\n* \"edge_thickness\" -- Thickness of an edge. Set to \"2\" by\n default.\n\n* \"charge\" -- the vertices' charge. Defines how they repulse each\n other. See https://github.com/mbostock/d3/wiki/Force-Layout for\n more information. Set to \"-120\" by default.\n\n* \"link_distance\" -- See\n https://github.com/mbostock/d3/wiki/Force- Layout for more\n information. Set to \"30\" by default.\n\n* \"link_strength\" -- See\n https://github.com/mbostock/d3/wiki/Force- Layout for more\n information. Set to \"1.5\" by default.\n\n* \"gravity\" -- See https://github.com/mbostock/d3/wiki/Force-\n Layout for more information. Set to \"0.04\" by default.\n\nEXAMPLES:\n\n show(graphs.RandomTree(50), d3=True)\n\n show(graphs.PetersenGraph(), d3=True, vertex_partition=g.coloring())\n\n show(graphs.DodecahedralGraph(), d3=True, force_spring_layout=True)\n\n show(graphs.DodecahedralGraph(), d3=True)\n\n g = digraphs.DeBruijn(2,2)\n g.allow_multiple_edges(True)\n g.add_edge(\"10\",\"10\",\"a\")\n g.add_edge(\"10\",\"10\",\"b\")\n g.add_edge(\"10\",\"10\",\"c\")\n g.add_edge(\"10\",\"10\",\"d\")\n g.add_edge(\"01\",\"11\",\"1\")\n show(g, d3=True, vertex_labels=True,edge_labels=True,\n link_distance=200,gravity=.05,charge=-500,\n edge_partition=[[(\"11\",\"12\",\"2\"),(\"21\",\"21\",\"a\")]],\n edge_thickness=4)","mode":"text/x-rst","lineno":-1,"filename":null}}︡ ︠d0913c43-45de-4eb8-97e2-49b7c55fb5fa︠ show(g, d3=False) ︡e3261dd3-6477-4fac-85e6-0f6df757dea5︡{"once":false,"file":{"show":true,"uuid":"fe01fa4f-f63f-48b9-b830-f95d794f4f53","filename":"/projects/4a5f0542-5873-4eed-a85c-a18c706e8bcd/.sage/temp/compute18dc0/16139/tmp_eq_blQ.svg"}}︡{"html":"
"}︡{"html":"
"}︡ ︠07fa0899-cf15-4afe-9ee7-db1ff1e9d047︠