Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
trac #34211: Merged with 9.7.beta8
Browse files Browse the repository at this point in the history
  • Loading branch information
dcoudert committed Aug 8, 2022
2 parents 12be2d9 + 0a33cf3 commit 310cc04
Showing 1 changed file with 15 additions and 53 deletions.
68 changes: 15 additions & 53 deletions src/sage/graphs/isgci.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,30 +55,13 @@
-------------------------
id : gc_32
name : chordal
type : base
<BLANKLINE>
...
Problems :
-----------
3-Colourability : Linear
Clique : Polynomial
Clique cover : Polynomial
Cliquewidth : Unbounded
Cliquewidth expression : NP-complete
Colourability : Linear
Cutwidth : NP-complete
Domination : NP-complete
Feedback vertex set : Polynomial
Hamiltonian cycle : NP-complete
Hamiltonian path : NP-complete
Independent set : Linear
Maximum bisection : Unknown
Maximum cut : NP-complete
Minimum bisection : Unknown
Recognition : Linear
Treewidth : Polynomial
Weighted clique : Polynomial
Weighted feedback vertex set : Unknown
Weighted independent set : Linear
...
It is possible to obtain the complete list of the classes stored in ISGCI by
calling the :meth:`~GraphClasses.show_all` method (beware -- long output)::
Expand Down Expand Up @@ -637,30 +620,15 @@ def description(self):
-------------------------
id : gc_32
name : chordal
type : base
<BLANKLINE>
...
Problems :
-----------
3-Colourability : Linear
Clique : Polynomial
Clique cover : Polynomial
Cliquewidth : Unbounded
Cliquewidth expression : NP-complete
Colourability : Linear
Cutwidth : NP-complete
Domination : NP-complete
Feedback vertex set : Polynomial
Hamiltonian cycle : NP-complete
Hamiltonian path : NP-complete
Independent set : Linear
Maximum bisection : Unknown
Maximum cut : NP-complete
Minimum bisection : Unknown
...
Recognition : Linear
Treewidth : Polynomial
Weighted clique : Polynomial
Weighted feedback vertex set : Unknown
Weighted independent set : Linear
...
"""
classes = GraphClasses().classes()
cls = classes[self._gc_id]
Expand Down Expand Up @@ -737,7 +705,7 @@ def classes(self):
sage: type(t)
<... 'dict'>
sage: sorted(t["gc_151"].keys())
['id', 'name', 'problem', 'type']
['id', 'name',... 'problem',... 'type']
sage: t["gc_151"]['name']
'cograph'
sage: t["gc_151"]['problem']['Clique']
Expand Down Expand Up @@ -780,16 +748,14 @@ def smallgraphs(self):
EXAMPLES::
sage: t = graph_classes.smallgraphs()
sage: t
{'2C_4': Graph on 8 vertices,
'2K_2': Graph on 4 vertices,
'2K_3': Graph on 6 vertices,
'2K_3 + e': Graph on 6 vertices,
'2K_4': Graph on 8 vertices,
'2P_3': Graph on 6 vertices,
...
sage: t['2C_4']
Graph on 8 vertices
sage: t['2K_3 + e']
Graph on 6 vertices
sage: t['fish']
Graph on 6 vertices
sage: t['bull']
Graph on 5 vertices
"""
self._get_ISGCI()
return self.smallgraphs()
Expand Down Expand Up @@ -827,11 +793,11 @@ def _download_db(self):
EXAMPLES::
sage: graph_classes._download_db() # Not tested -- requires internet
sage: graph_classes._download_db() # Not tested -- requires internet
"""
import tempfile
u = urlopen('https://www.graphclasses.org/data.zip',
context=SSLContext())
context=default_context())
with tempfile.NamedTemporaryFile(suffix=".zip") as f:
f.write(u.read())
z = zipfile.ZipFile(f.name)
Expand All @@ -858,7 +824,6 @@ def _parse_db(self, directory):
sage: graph_classes._parse_db(GRAPHS_DATA_DIR)
"""
import xml.etree.cElementTree as ET
import os.path
from sage.graphs.graph import Graph

xml_file = os.path.join(GRAPHS_DATA_DIR, _XML_FILE)
Expand Down Expand Up @@ -903,7 +868,7 @@ def update_db(self):
EXAMPLES::
sage: graph_classes.update_db() # Not tested -- requires internet
sage: graph_classes.update_db() # Not tested -- requires internet
"""
self._download_db()

Expand Down Expand Up @@ -935,8 +900,6 @@ def _get_ISGCI(self):
sage: graph_classes._get_ISGCI() # long time (4s on sage.math, 2012)
"""

import os.path
from sage.misc.misc import SAGE_DB

try:
Expand Down Expand Up @@ -1044,7 +1007,6 @@ def _XML_to_dict(root):
-------------------------
id : gc_56
name : perfect
type : base
...
"""
ans = root.attrib.copy()
Expand Down

0 comments on commit 310cc04

Please sign in to comment.