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

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 close merge delete

Sort by ยป oldest newest most voted

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])

more

Thanks alot.

( 2019-01-18 01:08:49 +0200 )edit