0
votes

How to draw a Graph in Sage-Math :

Suppose I have a Graph G with 4 vertices v1,v2,v3,v4 such that v1 is adjacent to v2 and v3 is adjacent to v4.

I wrote the following code in SageMath which did not work:

G=Graph({1:[2],3:[4]})

But the code is showing Traceback Error.

Can someone kindly comment on how to fix it?

1

1 Answers

0
votes

Without a lot more detail about your error, this would be very hard to answer. In any case, this syntax should work - see this example.

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

enter image description here