Skip to content

Commit 03c6f91

Browse files
authored
Merge branch 'master' into dev3
2 parents cfbca11 + fede869 commit 03c6f91

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
config.py
22
*.in
33
*.out
4+
*.exe
45

56
# Created by .ignore support plugin (hsz.mobi)
67
### Python template
@@ -131,4 +132,7 @@ docs/_build/
131132
target/
132133

133134
# Pycharm
134-
venv
135+
venv
136+
137+
# VS Code
138+
.vscode

cyaron/compare.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import absolute_import, print_function
2-
from cyaron import IO, log
2+
from .io import IO
3+
from . import log
34
from cyaron.utils import *
45
from cyaron.consts import *
56
from cyaron.graders import CYaRonGraders

cyaron/graph.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def graph(point_count, edge_count, **kwargs):
304304
@staticmethod
305305
def DAG(point_count, edge_count, **kwargs):
306306
"""DAG(point_count, edge_count, **kwargs) -> Graph
307-
Factory method. Return a graph with point_count vertexes and edge_count edges.
307+
Factory method. Return a directed connected graph with point_count vertexes and edge_count edges.
308308
int point_count -> the count of vertexes
309309
int edge_count -> the count of edges
310310
**kwargs(Keyword args):
@@ -371,7 +371,7 @@ def DAG(point_count, edge_count, **kwargs):
371371
@staticmethod
372372
def UDAG(point_count, edge_count, **kwargs):
373373
"""UDAG(point_count, edge_count, **kwargs) -> Graph
374-
Factory method. Return a graph with point_count vertexes and edge_count edges.
374+
Factory method. Return a undirected connected graph with point_count vertexes and edge_count edges.
375375
int point_count -> the count of vertexes
376376
int edge_count -> the count of edges
377377
**kwargs(Keyword args):
@@ -426,6 +426,18 @@ def UDAG(point_count, edge_count, **kwargs):
426426
i += 1
427427

428428
return graph
429+
430+
@staticmethod
431+
def connected(point_count, edge_count, directed=False, **kwargs):
432+
"""connected(point_count, edge_count, **kwargs) -> Graph
433+
Factory method. Return a connected graph with point_count vertexes
434+
int point_count -> the count of vertexes
435+
bool directed -> whether the graph is directed
436+
"""
437+
if directed:
438+
return Graph.DAG(point_count, edge_count, **kwargs)
439+
else:
440+
return Graph.UDAG(point_count, edge_count, **kwargs)
429441

430442
@staticmethod
431443
def hack_spfa(point_count, **kwargs):

0 commit comments

Comments
 (0)