graphreveal 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- graphreveal-0.1.0/.gitattributes +1 -0
- graphreveal-0.1.0/.github/workflows/test.yml +33 -0
- graphreveal-0.1.0/.gitignore +10 -0
- graphreveal-0.1.0/LICENSE +21 -0
- graphreveal-0.1.0/PKG-INFO +82 -0
- graphreveal-0.1.0/README.md +54 -0
- graphreveal-0.1.0/pyproject.toml +49 -0
- graphreveal-0.1.0/src/graphreveal/__init__.py +25 -0
- graphreveal-0.1.0/src/graphreveal/cli.py +82 -0
- graphreveal-0.1.0/src/graphreveal/db_creator/__init__.py +1 -0
- graphreveal-0.1.0/src/graphreveal/db_creator/create.py +68 -0
- graphreveal-0.1.0/src/graphreveal/db_creator/data/graph1.g6 +1 -0
- graphreveal-0.1.0/src/graphreveal/db_creator/data/graph2.g6 +2 -0
- graphreveal-0.1.0/src/graphreveal/db_creator/data/graph3.g6 +4 -0
- graphreveal-0.1.0/src/graphreveal/db_creator/data/graph4.g6 +11 -0
- graphreveal-0.1.0/src/graphreveal/db_creator/data/graph5.g6 +34 -0
- graphreveal-0.1.0/src/graphreveal/db_creator/data/graph6.g6 +156 -0
- graphreveal-0.1.0/src/graphreveal/db_creator/data/graph7.g6 +1044 -0
- graphreveal-0.1.0/src/graphreveal/db_creator/data/graph8.g6 +12346 -0
- graphreveal-0.1.0/src/graphreveal/db_creator/data/graph9.g6 +274668 -0
- graphreveal-0.1.0/src/graphreveal/db_creator/util.py +54 -0
- graphreveal-0.1.0/src/graphreveal/translator/QueryLexer.g4 +34 -0
- graphreveal-0.1.0/src/graphreveal/translator/QueryParser.g4 +43 -0
- graphreveal-0.1.0/src/graphreveal/translator/QueryTranslator.py +44 -0
- graphreveal-0.1.0/src/graphreveal/translator/__init__.py +5 -0
- graphreveal-0.1.0/src/graphreveal/translator/generated/QueryLexer.py +176 -0
- graphreveal-0.1.0/src/graphreveal/translator/generated/QueryParser.py +430 -0
- graphreveal-0.1.0/src/graphreveal/translator/generated/QueryParserVisitor.py +43 -0
- graphreveal-0.1.0/src/graphreveal/translator/translate.py +47 -0
- graphreveal-0.1.0/tests/test_cli.py +24 -0
- graphreveal-0.1.0/tests/test_parser.py +56 -0
- graphreveal-0.1.0/tests/test_query_results.py +37 -0
- graphreveal-0.1.0/uv.lock +197 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
src/graphreveal/translator/generated/* linguist-generated=true
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.12", "3.13"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- name: Install uv
|
|
19
|
+
uses: astral-sh/setup-uv@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: ${{ matrix.python-version }}
|
|
22
|
+
- name: Install the package
|
|
23
|
+
run: |
|
|
24
|
+
uv pip install .
|
|
25
|
+
- name: Run Ruff
|
|
26
|
+
run: uvx ruff check --output-format=github
|
|
27
|
+
- name: Run Ruff formatter
|
|
28
|
+
run: uvx ruff format --check
|
|
29
|
+
- name: Create the database
|
|
30
|
+
run: |
|
|
31
|
+
graphreveal create-database
|
|
32
|
+
- name: Run tests
|
|
33
|
+
run: uv run pytest
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Michał Dobranowski
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: graphreveal
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Small graphs database and search system
|
|
5
|
+
Project-URL: Changelog, https://github.com/mdbrnowski/GraphReveal/releases
|
|
6
|
+
Project-URL: Homepage, https://github.com/mdbrnowski/GraphReveal
|
|
7
|
+
Project-URL: Source, https://github.com/mdbrnowski/GraphReveal
|
|
8
|
+
Author-email: Michał Dobranowski <mdbrnowski@gmail.com>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: database,graph-theory,graphs
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: MacOS
|
|
16
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
17
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
18
|
+
Classifier: Programming Language :: Python
|
|
19
|
+
Classifier: Topic :: Database
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
21
|
+
Requires-Python: >=3.12
|
|
22
|
+
Requires-Dist: antlr4-python3-runtime>=4.13.2
|
|
23
|
+
Requires-Dist: networkx>=3.4.2
|
|
24
|
+
Requires-Dist: platformdirs>=4.3.6
|
|
25
|
+
Requires-Dist: rich>=13.9.4
|
|
26
|
+
Requires-Dist: typer>=0.15.1
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# GraphReveal
|
|
30
|
+
|
|
31
|
+
[](https://pypi.org/project/graphreveal/)
|
|
32
|
+
[](https://github.com/mdbrnowski/GraphReveal/actions/workflows/test.yml)
|
|
33
|
+
|
|
34
|
+
Have you ever needed an example of a graph that, e.g., is Hamiltonian, has exactly 8 vertices, and can be drawn on a plane without intersecting edges? Or wondered how many graphs of size 10 are bipartite, have no isolated vertices, and have exactly two components?
|
|
35
|
+
|
|
36
|
+
This package aims to answer some of your questions. You can search through all graphs with some reasonable order (currently 9 is the maximum) using a very simple DSL (*domain-specific language*).
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
Make sure that you have Python in a sufficiently recent version. To install the package using `pip`, you can use the following command:
|
|
41
|
+
|
|
42
|
+
```shell
|
|
43
|
+
pip install graphreveal
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Basic usage
|
|
47
|
+
|
|
48
|
+
Firstly, you should create the database:
|
|
49
|
+
|
|
50
|
+
```shell
|
|
51
|
+
graphreveal create-database
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
This process should take less than two seconds and will create a database of graphs with an order no larger than 7. To use a larger database, add `--n 8` or `--n 9` flag to this command.
|
|
55
|
+
|
|
56
|
+
### Some examples
|
|
57
|
+
|
|
58
|
+
```shell
|
|
59
|
+
graphreveal search "10 edges, bipartite, no isolated vertices, 2 components"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```shell
|
|
63
|
+
graphreveal search --count "6 vertices, connected"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### List of available properties
|
|
67
|
+
|
|
68
|
+
* [int] `vertices` (alternatives: `verts`,`V`, `nodes`)
|
|
69
|
+
* [int] `edges` (alternative: `E`)
|
|
70
|
+
* [int] `blocks` (alternative: `biconnected components`)
|
|
71
|
+
* [int] `components` (alternative: `C`)
|
|
72
|
+
* `acyclic` (alternative: `forest`)
|
|
73
|
+
* `bipartite`
|
|
74
|
+
* `complete`
|
|
75
|
+
* `connected`
|
|
76
|
+
* `eulerian` (alternative: `euler`)
|
|
77
|
+
* `hamiltonian` (alternative: `hamilton`)
|
|
78
|
+
* `no isolated vertices` (alternatives: `no isolated v`, `niv`)
|
|
79
|
+
* `planar`
|
|
80
|
+
* `tree`
|
|
81
|
+
|
|
82
|
+
You can also negate these properties using `!` or `not`.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# GraphReveal
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/graphreveal/)
|
|
4
|
+
[](https://github.com/mdbrnowski/GraphReveal/actions/workflows/test.yml)
|
|
5
|
+
|
|
6
|
+
Have you ever needed an example of a graph that, e.g., is Hamiltonian, has exactly 8 vertices, and can be drawn on a plane without intersecting edges? Or wondered how many graphs of size 10 are bipartite, have no isolated vertices, and have exactly two components?
|
|
7
|
+
|
|
8
|
+
This package aims to answer some of your questions. You can search through all graphs with some reasonable order (currently 9 is the maximum) using a very simple DSL (*domain-specific language*).
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
Make sure that you have Python in a sufficiently recent version. To install the package using `pip`, you can use the following command:
|
|
13
|
+
|
|
14
|
+
```shell
|
|
15
|
+
pip install graphreveal
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Basic usage
|
|
19
|
+
|
|
20
|
+
Firstly, you should create the database:
|
|
21
|
+
|
|
22
|
+
```shell
|
|
23
|
+
graphreveal create-database
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
This process should take less than two seconds and will create a database of graphs with an order no larger than 7. To use a larger database, add `--n 8` or `--n 9` flag to this command.
|
|
27
|
+
|
|
28
|
+
### Some examples
|
|
29
|
+
|
|
30
|
+
```shell
|
|
31
|
+
graphreveal search "10 edges, bipartite, no isolated vertices, 2 components"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```shell
|
|
35
|
+
graphreveal search --count "6 vertices, connected"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### List of available properties
|
|
39
|
+
|
|
40
|
+
* [int] `vertices` (alternatives: `verts`,`V`, `nodes`)
|
|
41
|
+
* [int] `edges` (alternative: `E`)
|
|
42
|
+
* [int] `blocks` (alternative: `biconnected components`)
|
|
43
|
+
* [int] `components` (alternative: `C`)
|
|
44
|
+
* `acyclic` (alternative: `forest`)
|
|
45
|
+
* `bipartite`
|
|
46
|
+
* `complete`
|
|
47
|
+
* `connected`
|
|
48
|
+
* `eulerian` (alternative: `euler`)
|
|
49
|
+
* `hamiltonian` (alternative: `hamilton`)
|
|
50
|
+
* `no isolated vertices` (alternatives: `no isolated v`, `niv`)
|
|
51
|
+
* `planar`
|
|
52
|
+
* `tree`
|
|
53
|
+
|
|
54
|
+
You can also negate these properties using `!` or `not`.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "graphreveal"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Small graphs database and search system"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [
|
|
7
|
+
{ name = "Michał Dobranowski", email = "mdbrnowski@gmail.com" }
|
|
8
|
+
]
|
|
9
|
+
license = "MIT"
|
|
10
|
+
requires-python = ">=3.12"
|
|
11
|
+
dependencies = [
|
|
12
|
+
"antlr4-python3-runtime>=4.13.2",
|
|
13
|
+
"networkx>=3.4.2",
|
|
14
|
+
"platformdirs>=4.3.6",
|
|
15
|
+
"rich>=13.9.4",
|
|
16
|
+
"typer>=0.15.1",
|
|
17
|
+
]
|
|
18
|
+
keywords = ["graphs", "graph-theory", "database"]
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Development Status :: 4 - Beta",
|
|
21
|
+
"Environment :: Console",
|
|
22
|
+
"License :: OSI Approved :: MIT License",
|
|
23
|
+
"Operating System :: MacOS",
|
|
24
|
+
"Operating System :: Microsoft :: Windows",
|
|
25
|
+
"Operating System :: POSIX :: Linux",
|
|
26
|
+
"Programming Language :: Python",
|
|
27
|
+
"Topic :: Database",
|
|
28
|
+
"Topic :: Scientific/Engineering :: Mathematics"
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Changelog = "https://github.com/mdbrnowski/GraphReveal/releases"
|
|
33
|
+
Homepage = "https://github.com/mdbrnowski/GraphReveal"
|
|
34
|
+
Source = "https://github.com/mdbrnowski/GraphReveal"
|
|
35
|
+
|
|
36
|
+
[project.scripts]
|
|
37
|
+
graphreveal = "graphreveal.cli:app"
|
|
38
|
+
|
|
39
|
+
[build-system]
|
|
40
|
+
requires = ["hatchling"]
|
|
41
|
+
build-backend = "hatchling.build"
|
|
42
|
+
|
|
43
|
+
[dependency-groups]
|
|
44
|
+
dev = [
|
|
45
|
+
"pytest>=8.3.4",
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
[tool.ruff]
|
|
49
|
+
exclude = ["generated"]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sqlite3
|
|
3
|
+
|
|
4
|
+
from platformdirs import user_data_dir
|
|
5
|
+
|
|
6
|
+
DATABASE_PATH = os.path.join(
|
|
7
|
+
user_data_dir(appname="graphreveal", appauthor="graphreveal"), "graphs.db"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ParsingError(Exception):
|
|
12
|
+
def __init__(self, message: str, errors_coordinates: list[tuple[int, int, int]]):
|
|
13
|
+
# todo: show all errors, not just the first one
|
|
14
|
+
error_coordinates = errors_coordinates[0]
|
|
15
|
+
self.message = message
|
|
16
|
+
self.error_line, self.error_column, self.error_length = error_coordinates
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def get_ids(sql_query: str) -> list[str]:
|
|
20
|
+
sql_query = sql_query.replace("*", "id", 1)
|
|
21
|
+
con = sqlite3.connect(DATABASE_PATH)
|
|
22
|
+
cur = con.cursor()
|
|
23
|
+
|
|
24
|
+
result = cur.execute(sql_query).fetchall()
|
|
25
|
+
return [graph_id for (graph_id,) in result]
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from sqlite3 import OperationalError
|
|
3
|
+
|
|
4
|
+
import rich
|
|
5
|
+
import typer
|
|
6
|
+
from rich.prompt import Confirm
|
|
7
|
+
|
|
8
|
+
from graphreveal import get_ids, ParsingError, DATABASE_PATH
|
|
9
|
+
from graphreveal.db_creator import create_db
|
|
10
|
+
from graphreveal.translator import translate
|
|
11
|
+
|
|
12
|
+
app = typer.Typer(no_args_is_help=True)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _print_parsing_error(query: str, e: ParsingError):
|
|
16
|
+
rich.print("[bold red]Query error:\n")
|
|
17
|
+
for i, query_line in enumerate(query.split("\n"), start=1):
|
|
18
|
+
query_line += " "
|
|
19
|
+
if i == e.error_line:
|
|
20
|
+
rich.print(
|
|
21
|
+
f" [not bold cyan]{query_line[: e.error_column]}"
|
|
22
|
+
f"[bold red]{query_line[e.error_column : e.error_column + e.error_length]}"
|
|
23
|
+
f"[not bold cyan]{query_line[e.error_column + e.error_length :]}"
|
|
24
|
+
)
|
|
25
|
+
rich.print(f" {' ' * e.error_column}[red]{'^' * e.error_length}")
|
|
26
|
+
else:
|
|
27
|
+
rich.print(f" [not bold cyan]{query_line}\n")
|
|
28
|
+
rich.print()
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@app.command()
|
|
32
|
+
def search(query: str, count: bool = False):
|
|
33
|
+
"""
|
|
34
|
+
Get all graphs with given properties.
|
|
35
|
+
"""
|
|
36
|
+
try:
|
|
37
|
+
sql_query = translate(query)
|
|
38
|
+
if count:
|
|
39
|
+
print(len(get_ids(sql_query)))
|
|
40
|
+
else:
|
|
41
|
+
print("\n".join(get_ids(sql_query)))
|
|
42
|
+
except ParsingError as e:
|
|
43
|
+
_print_parsing_error(query, e)
|
|
44
|
+
except OperationalError as e:
|
|
45
|
+
rich.print("[bold red]Error:", str(e) + ".")
|
|
46
|
+
rich.print(
|
|
47
|
+
"Try to create the database first. Run `[cyan]graphreveal create-database[/cyan]`."
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@app.command()
|
|
52
|
+
def create_database(n: int = 7):
|
|
53
|
+
"""
|
|
54
|
+
Create the database.
|
|
55
|
+
"""
|
|
56
|
+
if n > 9 or n < 1:
|
|
57
|
+
rich.print("[bold red]Error: Choose n between 1 and 9.")
|
|
58
|
+
return
|
|
59
|
+
|
|
60
|
+
try:
|
|
61
|
+
if not os.path.exists(DATABASE_PATH) or Confirm.ask(
|
|
62
|
+
"Are you sure you want to overwrite the database?"
|
|
63
|
+
):
|
|
64
|
+
create_db(n)
|
|
65
|
+
except OperationalError as e:
|
|
66
|
+
rich.print("[bold red]Error:", str(e) + ".")
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@app.command()
|
|
70
|
+
def to_sql(query: str):
|
|
71
|
+
"""
|
|
72
|
+
Translate your query to SQL.
|
|
73
|
+
"""
|
|
74
|
+
try:
|
|
75
|
+
sql_query = translate(query)
|
|
76
|
+
print(sql_query)
|
|
77
|
+
except ParsingError as e:
|
|
78
|
+
_print_parsing_error(query, e)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
if __name__ == "__main__":
|
|
82
|
+
app()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .create import create_db as create_db
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import importlib.resources
|
|
2
|
+
import os
|
|
3
|
+
import sqlite3
|
|
4
|
+
|
|
5
|
+
import networkx as nx
|
|
6
|
+
from rich.progress import track
|
|
7
|
+
|
|
8
|
+
from graphreveal import DATABASE_PATH
|
|
9
|
+
from . import util
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def create_db(max_n):
|
|
13
|
+
os.makedirs(os.path.dirname(DATABASE_PATH), exist_ok=True)
|
|
14
|
+
con = sqlite3.connect(DATABASE_PATH)
|
|
15
|
+
cur = con.cursor()
|
|
16
|
+
|
|
17
|
+
cur.execute("DROP TABLE IF EXISTS graphs")
|
|
18
|
+
|
|
19
|
+
cur.execute(
|
|
20
|
+
""" CREATE TABLE graphs (
|
|
21
|
+
id VARCHAR(20) PRIMARY KEY,
|
|
22
|
+
vertices INT NOT NULL,
|
|
23
|
+
edges INT NOT NULL,
|
|
24
|
+
acyclic BOOLEAN NOT NULL,
|
|
25
|
+
bipartite BOOLEAN NOT NULL,
|
|
26
|
+
eulerian BOOLEAN NOT NULL,
|
|
27
|
+
hamiltonian BOOLEAN NOT NULL,
|
|
28
|
+
planar BOOLEAN NOT NULL,
|
|
29
|
+
blocks INT NOT NULL,
|
|
30
|
+
components INT NOT NULL,
|
|
31
|
+
degree_max INT NOT NULL,
|
|
32
|
+
degree_min INT NOT NULL
|
|
33
|
+
)"""
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
all_graphs = []
|
|
37
|
+
|
|
38
|
+
for n in range(1, max_n + 1):
|
|
39
|
+
with (
|
|
40
|
+
importlib.resources.files("graphreveal")
|
|
41
|
+
/ "db_creator"
|
|
42
|
+
/ "data"
|
|
43
|
+
/ f"graph{n}.g6"
|
|
44
|
+
).open(encoding="utf-8") as f:
|
|
45
|
+
all_graphs += f.read().strip().split("\n")
|
|
46
|
+
|
|
47
|
+
for graph_g6 in track(all_graphs, description="Creating the database"):
|
|
48
|
+
graph = nx.from_graph6_bytes(str.encode(graph_g6))
|
|
49
|
+
cur.execute(
|
|
50
|
+
"INSERT INTO graphs VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
|
51
|
+
[
|
|
52
|
+
graph_g6,
|
|
53
|
+
graph.number_of_nodes(),
|
|
54
|
+
graph.number_of_edges(),
|
|
55
|
+
nx.is_forest(graph),
|
|
56
|
+
nx.is_bipartite(graph),
|
|
57
|
+
nx.is_eulerian(graph),
|
|
58
|
+
util.is_hamiltonian(graph),
|
|
59
|
+
nx.is_planar(graph),
|
|
60
|
+
len(list(nx.biconnected_components(graph))),
|
|
61
|
+
nx.number_connected_components(graph),
|
|
62
|
+
util.max_degree(graph),
|
|
63
|
+
util.min_degree(graph),
|
|
64
|
+
],
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
con.commit()
|
|
68
|
+
con.close()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
D??
|
|
2
|
+
D?_
|
|
3
|
+
D?o
|
|
4
|
+
D?w
|
|
5
|
+
D?{
|
|
6
|
+
DCO
|
|
7
|
+
DCW
|
|
8
|
+
DCc
|
|
9
|
+
DCo
|
|
10
|
+
DCs
|
|
11
|
+
DCw
|
|
12
|
+
DC{
|
|
13
|
+
DEk
|
|
14
|
+
DEo
|
|
15
|
+
DEs
|
|
16
|
+
DEw
|
|
17
|
+
DE{
|
|
18
|
+
DFw
|
|
19
|
+
DF{
|
|
20
|
+
DQg
|
|
21
|
+
DQo
|
|
22
|
+
DQw
|
|
23
|
+
DQ{
|
|
24
|
+
DTk
|
|
25
|
+
DTw
|
|
26
|
+
DT{
|
|
27
|
+
DUW
|
|
28
|
+
DUw
|
|
29
|
+
DU{
|
|
30
|
+
DV{
|
|
31
|
+
D]w
|
|
32
|
+
D]{
|
|
33
|
+
D^{
|
|
34
|
+
D~{
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
E???
|
|
2
|
+
E?A?
|
|
3
|
+
E?B?
|
|
4
|
+
E?B_
|
|
5
|
+
E?Bo
|
|
6
|
+
E?Bw
|
|
7
|
+
E?`?
|
|
8
|
+
E?`_
|
|
9
|
+
E?`o
|
|
10
|
+
E?aG
|
|
11
|
+
E?b?
|
|
12
|
+
E?bG
|
|
13
|
+
E?b_
|
|
14
|
+
E?bg
|
|
15
|
+
E?bo
|
|
16
|
+
E?bw
|
|
17
|
+
E?oo
|
|
18
|
+
E?ow
|
|
19
|
+
E?qg
|
|
20
|
+
E?qo
|
|
21
|
+
E?qw
|
|
22
|
+
E?r?
|
|
23
|
+
E?rG
|
|
24
|
+
E?r_
|
|
25
|
+
E?rg
|
|
26
|
+
E?ro
|
|
27
|
+
E?rw
|
|
28
|
+
E?zO
|
|
29
|
+
E?zW
|
|
30
|
+
E?z_
|
|
31
|
+
E?zg
|
|
32
|
+
E?zo
|
|
33
|
+
E?zw
|
|
34
|
+
E?~o
|
|
35
|
+
E?~w
|
|
36
|
+
ECO_
|
|
37
|
+
ECQO
|
|
38
|
+
ECQ_
|
|
39
|
+
ECQo
|
|
40
|
+
ECR?
|
|
41
|
+
ECRO
|
|
42
|
+
ECRW
|
|
43
|
+
ECR_
|
|
44
|
+
ECRo
|
|
45
|
+
ECRw
|
|
46
|
+
ECX_
|
|
47
|
+
ECXg
|
|
48
|
+
ECYO
|
|
49
|
+
ECYW
|
|
50
|
+
ECZ?
|
|
51
|
+
ECZG
|
|
52
|
+
ECZO
|
|
53
|
+
ECZW
|
|
54
|
+
ECZ_
|
|
55
|
+
ECZg
|
|
56
|
+
ECZo
|
|
57
|
+
ECZw
|
|
58
|
+
ECeW
|
|
59
|
+
ECfW
|
|
60
|
+
ECfo
|
|
61
|
+
ECfw
|
|
62
|
+
ECpO
|
|
63
|
+
ECpo
|
|
64
|
+
ECqg
|
|
65
|
+
ECrG
|
|
66
|
+
ECrO
|
|
67
|
+
ECrW
|
|
68
|
+
ECr_
|
|
69
|
+
ECrg
|
|
70
|
+
ECro
|
|
71
|
+
ECrw
|
|
72
|
+
ECuw
|
|
73
|
+
ECvW
|
|
74
|
+
ECvo
|
|
75
|
+
ECvw
|
|
76
|
+
ECxo
|
|
77
|
+
ECxw
|
|
78
|
+
ECzW
|
|
79
|
+
ECzg
|
|
80
|
+
ECzo
|
|
81
|
+
ECzw
|
|
82
|
+
EC~o
|
|
83
|
+
EC~w
|
|
84
|
+
EEhW
|
|
85
|
+
EEh_
|
|
86
|
+
EEho
|
|
87
|
+
EEhw
|
|
88
|
+
EEiW
|
|
89
|
+
EEio
|
|
90
|
+
EEjW
|
|
91
|
+
EEj_
|
|
92
|
+
EEjo
|
|
93
|
+
EEjw
|
|
94
|
+
EElw
|
|
95
|
+
EEno
|
|
96
|
+
EEnw
|
|
97
|
+
EErO
|
|
98
|
+
EErW
|
|
99
|
+
EEr_
|
|
100
|
+
EEro
|
|
101
|
+
EErw
|
|
102
|
+
EEuw
|
|
103
|
+
EEvW
|
|
104
|
+
EEvo
|
|
105
|
+
EEvw
|
|
106
|
+
EEzO
|
|
107
|
+
EEz_
|
|
108
|
+
EEzg
|
|
109
|
+
EEzo
|
|
110
|
+
EEzw
|
|
111
|
+
EE~w
|
|
112
|
+
EFzW
|
|
113
|
+
EFz_
|
|
114
|
+
EFzo
|
|
115
|
+
EFzw
|
|
116
|
+
EF~w
|
|
117
|
+
EQhO
|
|
118
|
+
EQig
|
|
119
|
+
EQjO
|
|
120
|
+
EQj_
|
|
121
|
+
EQjg
|
|
122
|
+
EQjo
|
|
123
|
+
EQjw
|
|
124
|
+
EQyw
|
|
125
|
+
EQzO
|
|
126
|
+
EQzW
|
|
127
|
+
EQzg
|
|
128
|
+
EQzo
|
|
129
|
+
EQzw
|
|
130
|
+
EQ~o
|
|
131
|
+
EQ~w
|
|
132
|
+
ETmw
|
|
133
|
+
ETno
|
|
134
|
+
ETnw
|
|
135
|
+
ETzg
|
|
136
|
+
ETzo
|
|
137
|
+
ETzw
|
|
138
|
+
ET~w
|
|
139
|
+
EUZO
|
|
140
|
+
EUZ_
|
|
141
|
+
EUZo
|
|
142
|
+
EUZw
|
|
143
|
+
EUxo
|
|
144
|
+
EUzW
|
|
145
|
+
EUzo
|
|
146
|
+
EUzw
|
|
147
|
+
EU~w
|
|
148
|
+
EV~w
|
|
149
|
+
E]yw
|
|
150
|
+
E]zg
|
|
151
|
+
E]zo
|
|
152
|
+
E]zw
|
|
153
|
+
E]~o
|
|
154
|
+
E]~w
|
|
155
|
+
E^~w
|
|
156
|
+
E~~w
|