On Saturday, April 16, 2011 1:52:50 PM UTC-7, nkulmati wrote: > > Hello All, > > I have a simple script: > > > G = graphs.RandomNGP(20, 0.05) > > centralities = G.centrality_closeness() > > I can not figure out how to plot the graph G so that no only the > labels (1,2,3) are shown but also the corresponding centralities from > the dictionary "centralities"! > > Does anyone have any idea?? > > Also, is it possible to plot the vertices in different, pre-specified > colors?? (Sounds like a common task for bipartite graph visualization) > > Thanks !!! > > A variation on OMF's answer:
G = graphs.RandomGNP(20, 0.05) centralities = G.centrality_closeness() d={} for k in centralities: d[k]=(k,RR(centralities[k]).n(digits=2)) # this is the main difference G.relabel(d) G.plot(layout="spring",vertex_size=2000).show(figsize=[50,30]) -- John -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org