| 1 | initial version |
Here is some pattern to find what you are looking for in Sage.
First, create the graph you are working on (let me take a classical example):
sage: G = graphs.PetersenGraph()
Now that you have it, you can look for all available methods by using the TAB-completion ([TAB] is the keyboard key with 2 arrows):
sage: G.[TAB]
You will see:
sage: G.matching
To be sure that it is what you are looking for, you can have a look to its documentation with a question mark ?:
sage: G.matching?
Then, you can call the method on the graph G:
sage: G.matching()
If you want the number of edges, you can do:
sage: len(G.matching())
5
or, as you could see in the previous doc:
sage: G.matching(value_only=True)
5
| 2 | No.2 Revision |
Here is some pattern a suggestion using mixed integer linear programming, see this tutorial for explicit Sage implementation :
First, create
sage: G = graphs.PetersenGraph()
Now that you have it, you can look for all available methods by using the TAB-completion ([TAB] is the keyboard key with 2 arrows):
sage: G.[TAB]
You will see:
sage: G.matching
To be sure that it is what you are looking for, you can have a look to its documentation with a question mark ?:
sage: G.matching?
Then, you can call the method on the graph G:
sage: G.matching()
If you want the number of edges, you can do:have any problem in writing this down into Sage code, do not hesitate to ask for details.
sage: len(G.matching())
5
or, as you could see in the previous doc:
sage: G.matching(value_only=True)
5
| 3 | No.3 Revision |
Here is a suggestion using mixed integer linear programming, see this tutorial for explicit Sage implementation :implementation:
If you have any problem in writing this down into Sage code, do not hesitate to ask for details.
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.