Ask Your Question
1

How to compute the number of nodes in each orbit of a graph?

asked 2019-01-17 03:24:15 +0100

ASH gravatar image

updated 2019-01-21 10:15:08 +0100

slelievre gravatar image

I use the below code to calculate the orbits of a graph. Please help me with a piece of code that can compute the number of nods in each orbit of the graph?

G=Graph(49);G.add_edges([(3,10),(1,0),(2,1),(3,1),(13,8),(13,9),(13,10),(14,5),(14,11),(14,13),(15,12),(15,14),(16,6),(16,7),(18,17),(19,6),(20,18),(21,15),(22,21),(23,22),(24,22),(25,22),(27,4),(27,19),(27,26),(28,26),(29,2),(29,17),(30,19),(31,4),(31,27),(32,5),(32,31),(33,6),(33,31),(34,27),(35,14),(35,34),(36,2),(36,7),(36,17),(36,31),(37,21),(37,22),(37,36),(39,38),(40,13),(41,32),(41,40),(42,40),(43,41),(44,20),(44,21),(45,44),(46,45),(47,45),(48,22),(48,38),(48,44),(48,45)]);group = G.automorphism_group();group.orbits()

I desire to have a vector in output where its elements are the number of nodes in each orbit.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-01-17 13:10:57 +0100

tmonteil gravatar image

If you define o as the orbits:

sage: o = group.orbits()

you can get the list of number of vertices in each orbit as follows:

sage: [len(i) for i in o]

If you prefer a vector:

sage: vector([len(i) for i in o])
edit flag offensive delete link more

Comments

Thanks alot.

ASH gravatar imageASH ( 2019-01-18 01:08:49 +0100 )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: 2019-01-17 03:24:15 +0100

Seen: 513 times

Last updated: Jan 21 '19