Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
config.py
*.in
*.out
*.exe

# Created by .ignore support plugin (hsz.mobi)
### Python template
Expand Down Expand Up @@ -131,4 +132,7 @@ docs/_build/
target/

# Pycharm
venv
venv

# VS Code
.vscode
16 changes: 14 additions & 2 deletions cyaron/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def graph(point_count, edge_count, **kwargs):
@staticmethod
def DAG(point_count, edge_count, **kwargs):
"""DAG(point_count, edge_count, **kwargs) -> Graph
Factory method. Return a graph with point_count vertexes and edge_count edges.
Factory method. Return a directed connected graph with point_count vertexes and edge_count edges.
int point_count -> the count of vertexes
int edge_count -> the count of edges
**kwargs(Keyword args):
Expand Down Expand Up @@ -352,7 +352,7 @@ def DAG(point_count, edge_count, **kwargs):
@staticmethod
def UDAG(point_count, edge_count, **kwargs):
"""UDAG(point_count, edge_count, **kwargs) -> Graph
Factory method. Return a graph with point_count vertexes and edge_count edges.
Factory method. Return a undirected connected graph with point_count vertexes and edge_count edges.
int point_count -> the count of vertexes
int edge_count -> the count of edges
**kwargs(Keyword args):
Expand Down Expand Up @@ -402,6 +402,18 @@ def UDAG(point_count, edge_count, **kwargs):
i += 1

return graph

@staticmethod
def connected(point_count, edge_count, directed=False, **kwargs):
"""connected(point_count, edge_count, **kwargs) -> Graph
Factory method. Return a connected graph with point_count vertexes
int point_count -> the count of vertexes
bool directed -> whether the graph is directed
"""
if directed:
return Graph.DAG(point_count, edge_count, **kwargs)
else:
return Graph.UDAG(point_count, edge_count, **kwargs)

@staticmethod
def hack_spfa(point_count, **kwargs):
Expand Down