Directed Graph
- class pyagrum.DiGraph(*args)
DiGraph represents a Directed Graph.
- DiGraph() -> DiGraph
default constructor
- DiGraph(src) -> DiGraph
- Parameters:
src (
pyagrum.DiGraph) – the digraph to copy
Methods
Add an arc from tail to head. |
|
Add a node by choosing a new NodeId. |
|
Add a set of n nodes. |
|
adjacency matrix from a graph/graphical models |
|
give the set of nodeid of ancestors of a node |
|
Returns the set of arcs in the graph. |
|
Remove all the nodes and arcs from the graph. |
|
Create a complete directed graph with n nodes. |
|
Returns the weakly connected components of the graph. |
|
number of connected components |
|
connected components as a dict of sets |
|
give the set of nodeid of descendants of a node |
|
Return a shortest directed path from node1 to node2, or None if no such path exists. |
|
Return a shortest path from node1 to node2 ignoring arc orientation, or None if no path exists. |
|
Check if the graph is empty. |
|
Check if the graph doesn’t contains arcs. |
|
Erase the arc between n1 and n2. |
|
Erase the arcs heading through the node’s children. |
|
Erase the node and all the related arcs. |
|
Erase the arcs coming to the node. |
|
Check if an arc exists between n1 and n2. |
|
Check if a node with a certain id exists in the graph. |
|
Return the family of a node: the node itself plus all its parents. |
|
Check if a directedpath exists between from and to. |
|
Check whether a node has an explicitly assigned name. |
|
Return the id of the node with the given name, or None if no such name exists. |
|
The ids of nodes given by their names, in a container of the same type. |
|
Return the name of a node, or its id as a string if no name was set. |
|
The names of nodes given by their ids, in a container of the same type. |
|
Save the graph as a .jgum (text) or .bgum (binary) file (its class, its nodes with their names, its arcs, edges and marks). |
|
Save the graph as a jgum string (see |
|
Assign a name to a node. |
|