otx.api.entities.graph
This module implements the TrainParameters entity.
Classes
Graph ([directed])
|
The concrete implementation of IGraph. |
MultiDiGraph ()
|
Multi Dimensional implementation of a Graph. |
-
class otx.api.entities.graph.Graph(directed: bool = False)[source]
Bases: IGraph
The concrete implementation of IGraph. This implementation is using networkx library.
- Parameters:
directed (bool) – set to True if the graph is a directed graph.
-
add_edge(node1, node2, edge_value=None)[source]
Adds edge between node1 and node2.
-
add_node(node)[source]
Adds node to the graph.
-
descendants(parent)[source]
Returns descendants.
(children and children of children, etc.) of parent.
-
find_cliques()[source]
Returns cliques in the graph.
-
find_in_edges(node)[source]
Returns the edges that have node as a source.
-
find_out_edges(node)[source]
Returns the edges that have node as a destination.
-
get_graph() → Graph | MultiDiGraph[source]
Get the underlying NetworkX graph.
-
has_edge_between(node1, node2)[source]
Returns True if there is an edge between node1 and node2.
-
neighbors(node)[source]
Returns neighbors of label.
Note: when node does not exist in the graph an empty list is returned
-
num_nodes() → int[source]
Returns the number of nodes in the graph.
-
remove_edges(node1, node2)[source]
Removes edges between both the nodes.
-
remove_node(node)[source]
Remove node from graph.
- Parameters:
node – node to remove
-
set_graph(graph: Graph | MultiDiGraph)[source]
Set the underlying NetworkX graph.
-
property edges
Returns all the edges in the graph.
-
property nodes
Returns the nodes in the graph.
-
property num_labels
Returns the number of labels in the graph.
-
class otx.api.entities.graph.MultiDiGraph[source]
Bases: Graph
Multi Dimensional implementation of a Graph.
-
topological_sort()[source]
Returns a generator of nodes in topologically sorted order.