Ask Your Question
0

Changing display labels of nodes on a graph

asked 2020-04-15 02:33:36 -0500

oldani gravatar image

updated 2020-06-09 04:28:40 -0500

FrédéricC gravatar image

Hi, I have created a graph which is in fact a tree. Each node has a label that I gave at creation time. Now, when I plot the graph for each node this "internal" label is displayed. Is it possible to have different display labels than this "internal" label?

Thanks

edit retag flag offensive close merge delete

Comments

Can you provide a small example to illustrate what you have and what you want in a simple case?

slelievre gravatar imageslelievre ( 2020-04-15 17:09:09 -0500 )edit

The idea is the following. Let's imagine I have defined the graph : G2 = Graph([('a', 'b', 'edge label')]). Like that it is displayed with node labels 'a' et 'b'.

But I want to display G2 (as it is defined) but as G3 = Graph([('Good', 'Morning')]) will be displayed

oldani gravatar imageoldani ( 2020-04-16 08:24:20 -0500 )edit

The structure and meaning of your last sentence escape me.

slelievre gravatar imageslelievre ( 2020-04-16 10:50:05 -0500 )edit

Mmmh sorry for my bad english. I found finally another way to solve my problem, I think there was no solution to what I wanted to do. Thanks a lot for your time.

oldani gravatar imageoldani ( 2020-04-16 16:54:13 -0500 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2020-04-16 02:40:16 -0500

Sébastien gravatar image

One possibility is that you are specifying the edge labels, not the vertex labels:

sage: G = Graph([('a', 'b', 'edge label')])
sage: G.plot(edge_labels=True)

image description

Since edge labels are not shown by default, what you see in G.plot() are the vertex labels only (that you call "internal").

edit flag offensive delete link more

Comments

Oh! yes good idea, if I remove the node labels and keep only edge labels can be a way to go. Thanks

oldani gravatar imageoldani ( 2020-04-16 08:10:43 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-04-15 02:33:36 -0500

Seen: 51 times

Last updated: Apr 16