Undirected Graphs
- class pyagrum.UndiGraph(*args)
UndiGraph represents an Undirected Graph.
- UndiGraph() -> UndiGraph
default constructor
- UndiGraph(src) -> UndiGraph
- Parameters!
src (UndiGraph) – the
pyagrum.UndiGraphto copy
Methods
Insert a new edge into the graph. |
|
Add a node by choosing a new NodeId. |
|
Add n nodes. |
|
adjacency matrix from a graph/graphical models |
|
Return the chain components (connected components) of the graph. |
|
Remove all the nodes and edges from the graph. |
|
Create a complete undirected graph with n nodes. |
|
Returns the connected components of the graph. |
|
number of connected components |
|
connected components as a dict of sets |
|
Check if the graph is empty. |
|
Check if the graph doesn’t contains edges. |
|
Erase the edge between n1 and n2. |
|
Erase all the edges adjacent to a given node. |
|
Erase the node and all the adjacent edges. |
|
Check if an edge exists between n1 and n2. |
|
Check if a node with a certain id exists in the graph. |
|
Check whether a node has an explicitly assigned name. |
|
Checks whether the graph contains cycles. |
|
Check whether two nodes are connected by an undirected path. |
|
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. |
|
Return a shortest undirected path between two nodes, or None if no path exists. |
- class pyagrum.CliqueGraph(*args)
CliqueGraph represents a Clique Graph.
- CliqueGraph() -> CliqueGraph
default constructor
- CliqueGraph(src) -> CliqueGraph
- Parameter
src (
pyagrum.CliqueGraph) – the CliqueGraph to copy
Scientific notes
A clique graph is an undirected graph whose nodes are sets of variables (the cliques); the separator of an edge is the
intersection of its two cliques. It is a join tree (or junction tree) when it has no cycle and has the running
intersection property: for each variable, the cliques that contain it form a connected subgraph. The junction trees
of the local computations of [1] and of the exact inferences of pyAgrum are such graphs (see
pyagrum.JunctionTreeGenerator and pyagrum.LazyPropagation).
Convention of pyAgrum: hasRunningIntersection checks the property on the whole graph, so that a variable contained
in cliques of two different connected components breaks it; a junction forest is valid only if its trees share no
variable.
Methods
Insert a new edge into the graph. |
|
Change the set of nodes included into a given clique and returns the new set |
|
Remove all the nodes and edges from the graph. |
|
Remove all edges and their separators |
|
Erase the edge between n1 and n2. |
|
Remove a node from a clique |
|
Erase the node and all the adjacent edges. |
|
changes the set of nodes included into a given clique |
|
Methods inherited from UndiGraph
Add a node by choosing a new NodeId. |
|
Add n nodes. |
|
adjacency matrix from a graph/graphical models |
|
Return the chain components (connected components) of the graph. |
|
Create a complete undirected graph with n nodes. |
|
Returns the connected components of the graph. |
|
number of connected components |
|
connected components as a dict of sets |
|
Check if the graph is empty. |
|
Check if the graph doesn’t contains edges. |
|
Erase all the edges adjacent to a given node. |
|
Check if an edge exists between n1 and n2. |
|
Check if a node with a certain id exists in the graph. |
|
Check whether a node has an explicitly assigned name. |
|
Checks whether the graph contains cycles. |
|
Check whether two nodes are connected by an undirected path. |
|
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. |
|
Assign a name to a node. |
|
Return a shortest undirected path between two nodes, or None if no path exists. |