ActionDigraph¶
This page contains the documentation for the class ActionDigraph
.
|
Overloaded function. |
|
Add an edge from |
|
Adds |
|
Adds |
|
Members: |
|
Returns an iterator to the edges of a node in the digraph. |
|
Get the range of the edge with source node |
|
Get the next neighbor of a node that doesn't equal |
Returns an iterator to the nodes of the digraph. |
|
|
Overloaded function. |
Returns the number of nodes of this. |
|
|
Overloaded function. |
Overloaded function. |
|
Returns the number of strongly connected components. |
|
|
Returns the maximum out-degree of any node. |
|
Overloaded function. |
|
Overloaded function. |
|
Overloaded function. |
|
Overloaded function. |
|
Overloaded function. |
|
Overloaded function. |
|
Ensures that this has capacity for m nodes each with n out-edges, but does not modify |
Returns a reversed iterator to the nodes of the digraph. |
|
Returns a |
|
|
Returns the root of a strongly connected components containing a given node. |
|
Returns the id-number of the strongly connected component of a node. |
|
Returns an iterator pointing to the first node in the scc with the specified id-number. |
Returns an iterator pointing to the root of the first scc. |
|
Returns an iterator for the nodes in the scc. |
|
Returns a |
|
|
Get the range of the edge with source node |
|
Get the next neighbor of a node that doesn't equal |
|
Check every node has exactly |
- class ActionDigraph(*args, **kwargs)¶
Overloaded function.
__init__(self: _libsemigroups_pybind11.ActionDigraph) -> None
__init__(self: _libsemigroups_pybind11.ActionDigraph, arg0: int) -> None
__init__(self: _libsemigroups_pybind11.ActionDigraph, m: int, n: int) -> None
Construct from number of nodes and out degree.
- Parameters
m (int) the number of nodes in the digraph (default:
0
).n (int) the out-degree of every node (default:
0
).
__init__(self: _libsemigroups_pybind11.ActionDigraph, arg0: _libsemigroups_pybind11.ActionDigraph) -> None
Construct a copy.
- add_edge(self: _libsemigroups_pybind11.ActionDigraph, i: int, j: int, lbl: int) None ¶
Add an edge from
i
toj
labelledlbl
.
- add_nodes(self: _libsemigroups_pybind11.ActionDigraph, nr: int) None ¶
Adds
nr
nodes to this.- Parameters
nr (int) -- the number of nodes to add.
- Returns
(None)
- add_to_out_degree(self: _libsemigroups_pybind11.ActionDigraph, nr: int) None ¶
Adds
nr
to the out-degree of this.- Parameters
nr (int) -- the number of new out-edges for every node.
- Returns
(None)
- class algorithm(self: _libsemigroups_pybind11.ActionDigraph.algorithm, value: int)¶
Members:
dfs : Use a depth-first-search.
matrix : Use the adjacency matrix and matrix multiplication.
- acyclic :
Use a dynamic programming approach for acyclic digraphs.
trivial : Try to utilise some corner cases.
- automatic :
The function
number_of_paths()
tries to decide which algorithm is best.
- property name¶
- edges_iterator(self: _libsemigroups_pybind11.ActionDigraph, i: int) Iterator ¶
Returns an iterator to the edges of a node in the digraph.
- Parameters
i (int) -- the node.
- Returns
An iterator.
- neighbor(self: _libsemigroups_pybind11.ActionDigraph, v: int, lbl: int) int ¶
Get the range of the edge with source node
v
and edge-labellbl
.
- next_neighbor(self: _libsemigroups_pybind11.ActionDigraph, v: int, i: int) Tuple[int, int] ¶
Get the next neighbor of a node that doesn't equal
UNDEFINED
.Specifically, a tuple
x
is returned wherex[0]
is adjacent tov
via an edge labelledx[1]
;x[1]
is the minimum value in the range \([i, N)\) whereN
isdegree()
such thatneighbor(v, x[1])
is not equal toUNDEFINED
.
If
neighbor(v, i)
is undefined for every value ofi
, thenx[0]
andx[1]
equalUNDEFINED
.
- nodes_iterator(self: _libsemigroups_pybind11.ActionDigraph) Iterator ¶
Returns an iterator to the nodes of the digraph.
- number_of_edges(*args, **kwargs)¶
Overloaded function.
number_of_edges(self: _libsemigroups_pybind11.ActionDigraph) -> int
Returns the total number of edges.
- Parameters
None
- Returns
An
int
.
number_of_edges(self: _libsemigroups_pybind11.ActionDigraph, n: int) -> int
Returns the number of edges incident to a node.
- Parameters
n the node.
- Returns
An
int
.
- number_of_nodes(self: _libsemigroups_pybind11.ActionDigraph) int ¶
Returns the number of nodes of this.
- Parameters
None
- Returns
An
int
.
- number_of_paths(*args, **kwargs)¶
Overloaded function.
number_of_paths(self: _libsemigroups_pybind11.ActionDigraph, source: int) -> int
Returns the number of paths originating at the given source node.
- Parameters
source (int) the source node.
- return
An
int
.
number_of_paths(self: _libsemigroups_pybind11.ActionDigraph, source: int, min: int, max: int, lgrthm: _libsemigroups_pybind11.ActionDigraph.algorithm) -> int
Returns the number of paths starting at a given node with length in a given range.
- Parameters
source (int) the source node
min (int) the minimum length of paths to count
max (int) the maximum length of paths to count
lgrthm (
ActionDigraph.algorithm
) the algorithm to use (defaults to:ActionDigraph.algorithm.automatic
).
- Returns
An
int
.
number_of_paths(self: _libsemigroups_pybind11.ActionDigraph, source: int, target: int, min: int, max: int, lgrthm: _libsemigroups_pybind11.ActionDigraph.algorithm) -> int
Returns the number of paths between a pair of nodes with length in a given range.
- Parameters
source (int) the source node
target (int) the target node
min (int) the minimum length of paths to count
max (int) the maximum length of paths to count
lgrthm (ActionDigraph.algorithm) the algorithm to use (defaults to:
ActionDigraph.algorithm.automatic
)
- Returns
An
int
.
number_of_paths(self: _libsemigroups_pybind11.ActionDigraph, source: int, target: int, min: int, max: int) -> int
Returns the number of paths between a pair of nodes with length in a given range.
- Parameters
source (int) the source node
target (int) the target node
min (int) the minimum length of paths to count
max (int) the maximum length of paths to count
- Returns
An
int
.
number_of_paths(self: _libsemigroups_pybind11.ActionDigraph, source: int, min: int, max: int) -> int
Returns the number of paths starting at a node with length in a given range.
- Parameters
source (int) the source node
min (int) the minimum length of paths to count
max (int) the maximum length of paths to count
- Returns
An
int
.
number_of_paths(self: _libsemigroups_pybind11.ActionDigraph, arg0: int, arg1: int, arg2: _libsemigroups_pybind11.PositiveInfinity) -> int
- number_of_paths_algorithm(*args, **kwargs)¶
Overloaded function.
number_of_paths_algorithm(self: _libsemigroups_pybind11.ActionDigraph, source: int) -> _libsemigroups_pybind11.ActionDigraph.algorithm
Returns the algorithm used by
number_of_paths()
to compute the number of paths originating at the given source node.- Parameters
source (int) the source node.
- Returns
A value of type
ActionDigraph.algorithm
.
number_of_paths_algorithm(self: _libsemigroups_pybind11.ActionDigraph, source: int, min: int, max: int) -> _libsemigroups_pybind11.ActionDigraph.algorithm
Returns the algorithm used by number_of_paths to compute the number of paths originating at the given source node with length in the range $[min, max)$.
- Parameters
source (int) the source node
min (int) the minimum length of paths to count
max (int) the maximum length of paths to count
- Returns
A value of type
ActionDigraph.algorithm
.
number_of_paths_algorithm(self: _libsemigroups_pybind11.ActionDigraph, arg0: int, arg1: int, arg2: _libsemigroups_pybind11.PositiveInfinity) -> _libsemigroups_pybind11.ActionDigraph.algorithm
number_of_paths_algorithm(self: _libsemigroups_pybind11.ActionDigraph, source: int, target: int, min: int, max: int) -> _libsemigroups_pybind11.ActionDigraph.algorithm
Returns the algorithm used by number_of_paths to compute the number of paths originating at the given source node and ending at the given target node with length in the range \([min, max)\).
- Parameters
source (int) the source node
target (int) the target node
min (int) the minimum length of paths to count
max (int) the maximum length of paths to count
- Returns
A value of type
ActionDigraph.algorithm
.
- number_of_scc(self: _libsemigroups_pybind11.ActionDigraph) int ¶
Returns the number of strongly connected components.
- Parameters
None
- Returns
An
int
.
- out_degree(self: _libsemigroups_pybind11.ActionDigraph) int ¶
Returns the maximum out-degree of any node.
- Parameters
None
- Returns
An
int
.
- panilo_iterator(*args, **kwargs)¶
Overloaded function.
panilo_iterator(self: _libsemigroups_pybind11.ActionDigraph, source: int, min: int, max: int) -> Iterator
Returns an iterator to a pair consisting of the edge labels of the first path (in lexicographical order) starting at
source
with length in the range \([min, max)\) and the last node of that path.- Parameters
source (int) the first node.
min (int) the minimum length of a path to enumerate (defaults to
0
)max (Union[int, PositiveInfinity]) the maximum length of a path to enumerate (defaults to
POSITIVE_INFINITY
).
- Returns
An iterator.
panilo_iterator(self: _libsemigroups_pybind11.ActionDigraph, arg0: int, arg1: int, arg2: _libsemigroups_pybind11.PositiveInfinity) -> Iterator
- panislo_iterator(*args, **kwargs)¶
Overloaded function.
panislo_iterator(self: _libsemigroups_pybind11.ActionDigraph, source: int, min: int, max: int) -> Iterator
Returns an iterator to a pair consisting of the edge labels of the first path (in short-lex order) starting at source with length in the range \([min, max)\) and the last node of that path.
- Parameters
source (int) the first node.
min (int) the minimum length of a path to enumerate (defaults to
0
)max (Union[int, PositiveInfinity]) the maximum length of a path to enumerate (defaults to
POSITIVE_INFINITY
).
- Returns
An iterator.
panislo_iterator(self: _libsemigroups_pybind11.ActionDigraph, arg0: int, arg1: int, arg2: _libsemigroups_pybind11.PositiveInfinity) -> Iterator
- pilo_iterator(*args, **kwargs)¶
Overloaded function.
pilo_iterator(self: _libsemigroups_pybind11.ActionDigraph, source: int, min: int, max: int) -> Iterator
Returns an iterator to the edge labels of the first path (in lexicographical order) starting at source with length in the range \([min, max)\).
- Parameters
source (int) the first node.
min (int) the minimum length of a path to enumerate (defaults to
0
)max (Union[int, PositiveInfinity]) the maximum length of a path to enumerate (defaults to
POSITIVE_INFINITY
).
- Returns
An iterator.
pilo_iterator(self: _libsemigroups_pybind11.ActionDigraph, arg0: int, arg1: int, arg2: _libsemigroups_pybind11.PositiveInfinity) -> Iterator
- pislo_iterator(*args, **kwargs)¶
Overloaded function.
pislo_iterator(self: _libsemigroups_pybind11.ActionDigraph, source: int, min: int, max: int) -> Iterator
Returns an iterator pointing to the edge labels of the first path (in short-lex order) starting at source with length in the range \([min, max)\).
- Parameters
source (int) the first node.
min (int) the minimum length of a path to enumerate (defaults to
0
)max (Union[int, PositiveInfinity]) the maximum length of a path to enumerate (defaults to
POSITIVE_INFINITY
).
- Returns
An iterator.
pislo_iterator(self: _libsemigroups_pybind11.ActionDigraph, arg0: int, arg1: int, arg2: _libsemigroups_pybind11.PositiveInfinity) -> Iterator
- pstilo_iterator(*args, **kwargs)¶
Overloaded function.
pstilo_iterator(self: _libsemigroups_pybind11.ActionDigraph, source: int, target: int, min: int, max: int) -> Iterator
Returns an iterator to the edge labels of the first path (in lex order) starting at the node
source
and ending at the nodetarget
with length in the range \([min, max)\).- Parameters
source (int) the first node.
target (int) the last node.
min (int) the minimum length of a path to enumerate (defaults to
0
)max (Union[int, PositiveInfinity]) the maximum length of a path to enumerate (defaults to
POSITIVE_INFINITY
).
- Returns
An iterator.
pstilo_iterator(self: _libsemigroups_pybind11.ActionDigraph, arg0: int, arg1: int, arg2: int, arg3: _libsemigroups_pybind11.PositiveInfinity) -> Iterator
- pstislo_iterator(*args, **kwargs)¶
Overloaded function.
pstislo_iterator(self: _libsemigroups_pybind11.ActionDigraph, source: int, target: int, min: int, max: int) -> Iterator
Returns an iterator to the edge labels of the first path (in short-lex order) starting at the node
source
and ending at the nodetarget
with length in the range \([min, max)\).- Parameters
source (int) the first node.
min (int) the minimum length of a path to enumerate (defaults to
0
)max (Union[int, PositiveInfinity]) the maximum length of a path to enumerate (defaults to
POSITIVE_INFINITY
).
- Returns
An iterator.
pstislo_iterator(self: _libsemigroups_pybind11.ActionDigraph, arg0: int, arg1: int, arg2: int, arg3: _libsemigroups_pybind11.PositiveInfinity) -> Iterator
- static random(nr_nodes: int, out_degree: int) _libsemigroups_pybind11.ActionDigraph ¶
Constructs a random
ActionDigraph
with the specified number of nodes and out-degree.
- static random_acyclic(nr_nodes: int, out_degree: int, nr_edges: int) _libsemigroups_pybind11.ActionDigraph ¶
Constructs a random acyclic
ActionDigraph
with the specified number of nodes and edges, and out-degree.
- reserve(self: _libsemigroups_pybind11.ActionDigraph, m: int, n: int) None ¶
Ensures that this has capacity for m nodes each with n out-edges, but does not modify
number_of_nodes()
orout_degree()
.
- reverse_nodes_iterator(self: _libsemigroups_pybind11.ActionDigraph) Iterator ¶
Returns a reversed iterator to the nodes of the digraph.
- reverse_spanning_forest(self: _libsemigroups_pybind11.ActionDigraph) libsemigroups::Forest ¶
Returns a
Forest
comprised of spanning trees for each scc of this, rooted at the minimum node of that component, with edges oriented towards the root.- Returns
A
Forest
.
- root_of_scc(self: _libsemigroups_pybind11.ActionDigraph, nd: int) int ¶
Returns the root of a strongly connected components containing a given node.
- Parameters
nd (int) -- a node.
- Returns
An
int
.
- scc_id(self: _libsemigroups_pybind11.ActionDigraph, nd: int) int ¶
Returns the id-number of the strongly connected component of a node.
- Parameters
nd (int) -- the node.
- Parameters
None
- Returns
An
int
.
- scc_iterator(self: _libsemigroups_pybind11.ActionDigraph, arg0: int) Iterator ¶
Returns an iterator pointing to the first node in the scc with the specified id-number.
- scc_roots_iterator(self: _libsemigroups_pybind11.ActionDigraph) Iterator ¶
Returns an iterator pointing to the root of the first scc.
- sccs_iterator(self: _libsemigroups_pybind11.ActionDigraph) Iterator ¶
Returns an iterator for the nodes in the scc.
- spanning_forest(self: _libsemigroups_pybind11.ActionDigraph) libsemigroups::Forest ¶
Returns a
Forest
comprised of spanning trees for each scc of this, rooted at the minimum node of that component, with edges oriented away from the root.- Returns
A
Forest
.
- unsafe_neighbor(self: _libsemigroups_pybind11.ActionDigraph, v: int, lbl: int) int ¶
Get the range of the edge with source node
v
and edge-labellbl
.
- unsafe_next_neighbor(self: _libsemigroups_pybind11.ActionDigraph, v: int, i: int) Tuple[int, int] ¶
Get the next neighbor of a node that doesn't equal
UNDEFINED
.Specifically, a tuple
x
is returned wherex[0]
is adjacent tov
via an edge labelledx[1]
;x[1]
is the minimum value in the range \([i, N)\) whereN
isdegree()
such thatneighbor(v, x[1])
is not equal toUNDEFINED
.
If
neighbor(v, i)
is undefined for every value ofi
, thenx[0]
andx[1]
equalUNDEFINED
.
- validate(self: _libsemigroups_pybind11.ActionDigraph) bool ¶
Check every node has exactly
out_degree()
out-edges.- Parameters
None
- Returns
A
bool
.