| 1836 | sage: graphs.CompleteGraph(1).is_overfull() |
| 1837 | False |
| 1838 | |
| 1839 | The claw graph is not overfull:: |
| 1840 | |
| 1841 | sage: from sage.graphs.graph_coloring import edge_coloring |
| 1842 | sage: g = graphs.ClawGraph() |
| 1843 | sage: g |
| 1844 | Claw graph: Graph on 4 vertices |
| 1845 | sage: edge_coloring(g, value_only=True) # optional - requires GLPK, CBC, or CPLEX |
| 1846 | 3 |
| 1847 | sage: g.is_overfull() |
| 1848 | False |
| 1849 | |
| 1850 | Checking that all complete graphs `K_n` for even `0 \leq n \leq 100` |
| 1851 | are not overfull:: |
| 1852 | |
| 1853 | sage: def check_overfull_Kn_even(n): |
| 1854 | ... i = 0 |
| 1855 | ... while i <= n: |
| 1856 | ... if graphs.CompleteGraph(i).is_overfull(): |
| 1857 | ... print "A complete graph of even order cannot be overfull." |
| 1858 | ... return |
| 1859 | ... i += 2 |
| 1860 | ... print "Complete graphs of even order up to %s are not overfull." % n |
| 1861 | ... |
| 1862 | sage: check_overfull_Kn_even(100) # long time |
| 1863 | Complete graphs of even order up to 100 are not overfull. |
| 1864 | |
| 1865 | The null graph, i.e. the graph with no vertices, is not overfull:: |
| 1866 | |
| 1867 | sage: Graph().is_overfull() |
| 1868 | False |
| 1869 | sage: graphs.CompleteGraph(0).is_overfull() |
| 1870 | False |
| 1871 | |
| 1872 | Checking that all complete graphs `K_n` for odd `1 < n \leq 100` |
| 1873 | are overfull:: |
| 1874 | |
| 1875 | sage: def check_overfull_Kn_odd(n): |
| 1876 | ... i = 3 |
| 1877 | ... while i <= n: |
| 1878 | ... if not graphs.CompleteGraph(i).is_overfull(): |
| 1879 | ... print "A complete graph of odd order > 1 must be overfull." |
| 1880 | ... return |
| 1881 | ... i += 2 |
| 1882 | ... print "Complete graphs of odd order > 1 up to %s are overfull." % n |
| 1883 | ... |
| 1884 | sage: check_overfull_Kn_odd(100) # long time |
| 1885 | Complete graphs of odd order > 1 up to 100 are overfull. |
1847 | | |
1848 | | return (self.order() % 2 == 1) and \ |
1849 | | (2*self.size() > max(self.degree())*(self.order()-1)) |
| 1897 | # # A possible optimized version. But the gain in speed is very little. |
| 1898 | # return bool(self._backend.num_verts() & 1) and ( # odd order n |
| 1899 | # 2 * self._backend.num_edges(self._directed) > #2m > \Delta(G)*(n-1) |
| 1900 | # max(self.degree()) * (self._backend.num_verts() - 1)) |
| 1901 | # unoptimized version |
| 1902 | return (self.order() % 2 == 1) and ( |
| 1903 | 2 * self.size() > max(self.degree()) * (self.order() - 1)) |