Ask Your Question

Sultan's profile - activity

2024-07-01 01:32:18 +0200 received badge  Popular Question (source)
2019-11-05 15:04:44 +0200 received badge  Student (source)
2019-10-30 14:45:02 +0200 answered a question 1.5 as a fraction

You can write any finite decimal as tenths, hundredths, thousands, ect, depending on the number of decimal places. So 1.5 = 15/10 = 3/2.

2019-10-30 03:00:19 +0200 asked a question How to use an image as a vertex label in a graph?

Exactly what the title says. I have a graph, but I'd like to change the labels of the vertices so that I can display my own images at each vertex.

I figured something like the code below would work, but instead of showing the images at the vertices, I see a string of where the image is located in memory.

from PIL import Image

H = Graph({img0:[1], 1:[2], 2:[3]})

img0 = Image.open('image0.png')
img1 = Image.open('image1.png')
img2 = Image.open('image2.png')
img3 = Image.open('image3.png')

img_list = [img0 ,img1, img2, img3]

def my_label_function (vertex_number):
    return img_list[vertex_number]

H.relabel(my_label_function)

H.plot()