📑  SageMath Online Mini Campus. Code Set 19

🌀   Homepage     🌀   GitHub Pages     🌀   Previous     🌀   Next     🌀   Instagram Posts     🌀   Pinterest Posts

The set of interactive pages with the following structure:

Example of Computations $\mathbb{\implies}$ Your Experiments $\mathbb{\implies}$ Python Modules $\mathbb{\implies}$ Other Languages

Example of Computations

Click the $\mathbb{activate}$ button below to display an interactive example.


@interact
def _(nodes=[2,3,4,5],blocks=[15,10,5]):
    s1='<left style=%s>Random Graph: '%'font-size:120;'
    s2='%d Blockswith %d Nodes in a Block'
    pretty_print(html(s1+s2%(blocks,nodes)))
    g=graphs.RandomBlockGraph(blocks,nodes)
    n=blocks*(nodes-1)+1; ec={}
    [g.set_edge_label(u,v,u) for (u,v,l) in g.edges()]
    c=[colormaps.jet(int(255/n)*i)[:3] 
       for i in range(n)]
    for i in range(n): ec[c[i]]=[] 
    for (u,v,l) in g.edges():
        [ec[c[i]].append((u,v,l)) 
         for i in range(n) if (u!=v and l==i)] 
    vc=dict(zip(c,[[i] for i in range(n)]))
    g=g.graphplot(vertex_size=300,vertex_colors=vc,
                  edge_colors=ec,layout='circular')
    g.show(figsize=7)


Your Experiments

Type your own SageMath code lines below and click the $\mathbb{evaluate}$ button.


This code cell was evaluated automatically.


Python Modules

Other Languages (R, HTML, ...)