I have written a simple program on sage, in which I will define a graph G at the beginning , and the program will return a matrix. now I want the program to return all such matrices corresponds to all trees of order 5. So basically I want to iterate the program over the list of all trees of order 5. But when I doing so, I need to change the indentation of each and every line of the program as I am putting all of them inside a loop. is there any way of getting rid of this problem, my program has more than 50 lines so it looks difficult to change the indentation . one thing I thought was using goto command, but I dont know how to use it.
Any suggestion would be appreciated.
Thanks a lot.
This is a hard question to answer in its current state, as you are sparse on details. Perhaps you should make your Sage program a Python function so it's easy to reuse?
My suggestion would be that if your current code is
then you could make that a function.
and then in your new thing you can do
That doesn't get around the indentation problem, but is better programming technique.
As to the indentation problem per se, this is just an editor issue. Python of any kind will have this. In the Sage notebook (and probably in the SageMath Cloud) there is a shortcut to indent everything one more indentation level, by highlighting and then using Tab; Shift+Tab should "dedent". If you are using an editor like Emacs in the command line, doubtless there is a way to do this as well. Good luck!