-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtournament.py
30 lines (22 loc) · 928 Bytes
/
tournament.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from graphblas_algorithms import algorithms
from graphblas_algorithms.classes.digraph import to_directed_graph
from graphblas_algorithms.utils import not_implemented_for
from .simple_paths import is_simple_path as is_path # noqa: F401
__all__ = ["is_tournament", "score_sequence", "tournament_matrix"]
@not_implemented_for("undirected")
@not_implemented_for("multigraph")
def is_tournament(G):
G = to_directed_graph(G)
return algorithms.is_tournament(G)
@not_implemented_for("undirected")
@not_implemented_for("multigraph")
def score_sequence(G):
G = to_directed_graph(G)
# TODO: can we return a different, more native object?
return algorithms.score_sequence(G).tolist()
@not_implemented_for("undirected")
@not_implemented_for("multigraph")
def tournament_matrix(G):
G = to_directed_graph(G)
# TODO: can we return a different, more native object?
return algorithms.tournament_matrix(G)