Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168738
Image: ubuntu2004

2D and 3D graph visualization

ideas for better layout engines?

g1 = graphs.HeawoodGraph() g1.add_edges([(0,2),(13,1),(0,4),(0,10)]) g1.degree_histogram()
[0, 0, 0, 8, 5, 0, 1]
g1.plot(layout='circular')
g1.plot(layout='spring').show()
g1.get_pos() #positions of each vertex
{0: [6.123233995736766e-17, 1.0], 1: [-0.43388373911755806, 0.90096886790241915], 2: [-0.7818314824680298, 0.62348980185873359], 3: [-0.97492791218182362, 0.2225209339563145], 4: [-0.97492791218182362, -0.22252093395631428], 5: [-0.78183148246802991, -0.62348980185873337], 6: [-0.43388373911755829, -0.90096886790241903], 7: [-1.8369701987210297e-16, -1.0], 8: [0.43388373911755795, -0.90096886790241926], 9: [0.78183148246802969, -0.62348980185873371], 10: [0.97492791218182351, -0.22252093395631464], 11: [0.97492791218182362, 0.22252093395631417], 12: [0.78183148246803003, 0.62348980185873337], 13: [0.4338837391175584, 0.90096886790241903]}
Pg1 = g1.plot3d(engine='jmol').show()
Pg1 = g1.plot3d(engine='tachyon').show()
g1.plot?