Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Changing vertex labels on a randomly generated graph

I know that if I want to create a graph on 4 vertices with vertex labels 1,2,3,4 then I can define my graph like this: G = Graph({0: [1, 3], 1: [2, 3,4], 2: [1,4], 3: [], 4: []})

and then when I print in LaTeX using sagetex the labels show up as 1,2,3,4 but when I try to create a graph randomly graphs.RandomGNM(4,5)).show(figsize=[4,4], graph_border=True) the vertex labels are 0,1,2,3. How do I change the default vertex labels of a randomly created graph?

click to hide/show revision 2
retagged

Changing vertex labels on a randomly generated graph

I know that if I want to create a graph on 4 vertices with vertex labels 1,2,3,4 then I can define my graph like this: G = Graph({0: [1, 3], 1: [2, 3,4], 2: [1,4], 3: [], 4: []})

and then when I print in LaTeX using sagetex the labels show up as 1,2,3,4 but when I try to create a graph randomly graphs.RandomGNM(4,5)).show(figsize=[4,4], graph_border=True) the vertex labels are 0,1,2,3. How do I change the default vertex labels of a randomly created graph?