Re: [sage-support] Labeled Graphs
On Wed, Nov 24, 2010 at 2:20 PM, Minh Nguyen nguyenmi...@gmail.com wrote: But I can't figure out how to get G.show() to display the edge weights. You can just call G.show(edge_labels=True), which displays the vertex names (by default) and the edge labels. Of course, the layout is whatever the spring embedder gives you (which doesn't take into account sizes of labels) so things might be hard to read. As a just-figuring-out-what's-going-on tool, it's great, but for inclusion in a paper, you probably want to manually set the vertex positions, or directly create the graph drawing with matplotlib/graphviz/etc. Best wishes, Stephen -- 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
Re: [sage-support] Labeled Graphs
no, that's just a part of what I'm looking for. I need to have a graph with weighted edges _and_ vertices. To stay at your example, the edges are weighted by the distance between the different cities, and each vertex is 'weighted' (or better labeled) by the population of the city. Excactly the vertex should have to labels, the name and the population. In the end I dont need to do any calculations with this graph. I want to autocreate latexcode wichc I could use later and i dont want to write my owen function to do this, or all the latexcode by hand. greatz Johannes -- 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
Re: [sage-support] Labeled Graphs
Am Mittwoch, den 24.11.2010, 15:51 +0100 schrieb Johannes: Hi list, how do i create a graph where i have a label for each vertex and each edge? Precisely I need to labels for each vertex (like a name and a value). If your main goal is to include a nice graphic of your graph into a LaTeX-document have a look at the PGF-package http://sourceforge.net/projects/pgf/ You can download it from any CTAN-mirror. Eckhard greatz thnx Johanes -- Service für Mathematik und Simulation Dr. Eckhard Kosin, selbständiger Diplom-Mathematiker Am Nymphenbad 14 D-81245 München, Germany Tel.: (+49)(+89) 88 88 479 Tel.,Fax: (+49)(+89) 835 844 mailto:e...@mathematik-service-kosin.de http://www.mathematik-service-kosin.de -- 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
Re: [sage-support] Labeled Graphs
Hi Johannes, On Thu, Nov 25, 2010 at 1:51 AM, Johannes dajo.m...@web.de wrote: Hi list, how do i create a graph where i have a label for each vertex and each edge? Precisely I need to labels for each vertex (like a name and a value). I'm guessing you want a weighted graph such as the following: sage: version() 'Sage Version 4.6, Release Date: 2010-10-30' sage: edge_dict = { : New York: {London: 5586, Paris: 5851, Berlin: 6402}, : London: {Paris: 341, Madrid: 1264}, : Sydney: {Beijing: 8923, Bangkok: 7524} : } sage: G = Graph(edge_dict, weighted=True) sage: G.vertices() ['Bangkok', 'Beijing', 'Berlin', 'London', 'Madrid', 'New York', 'Paris', 'Sydney'] sage: G.edges() [('Bangkok', 'Sydney', 7524), ('Beijing', 'Sydney', 8923), ('Berlin', 'New York', 6402), ('London', 'Madrid', 1264), ('London', 'New York', 5586), ('London', 'Paris', 341), ('New York', 'Paris', 5851)] But I can't figure out how to get G.show() to display the edge weights. -- Regards Minh Van Nguyen -- 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