Undirected Graphs

an undirected graph
class pyagrum.UndiGraph(*args)

UndiGraph represents an Undirected Graph.

UndiGraph() -> UndiGraph

default constructor

UndiGraph(src) -> UndiGraph
Parameters!

Methods

addEdge()

Insert a new edge into the graph.

addNode()

addNodeWithId()

Add a node by choosing a new NodeId.

addNodes()

Add n nodes.

adjacencyMatrix()

adjacency matrix from a graph/graphical models

chainComponents()

Return the chain components (connected components) of the graph.

clear()

Remove all the nodes and edges from the graph.

completeGraph()

Create a complete undirected graph with n nodes.

connectedComponents()

Returns the connected components of the graph.

connectedComponentsCount()

number of connected components

connectedComponentsList()

connected components as a dict of sets

edges()

empty()

Check if the graph is empty.

emptyEdges()

Check if the graph doesn’t contains edges.

eraseEdge()

Erase the edge between n1 and n2.

eraseNeighbours()

Erase all the edges adjacent to a given node.

eraseNode()

Erase the node and all the adjacent edges.

existsEdge()

Check if an edge exists between n1 and n2.

existsNode()

Check if a node with a certain id exists in the graph.

hasName()

Check whether a node has an explicitly assigned name.

hasUndirectedCycle()

Checks whether the graph contains cycles.

hasUndirectedPath()

Check whether two nodes are connected by an undirected path.

idFromName()

Return the id of the node with the given name, or None if no such name exists.

idsFromNames()

The ids of nodes given by their names, in a container of the same type.

nameFromId()

Return the name of a node, or its id as a string if no name was set.

namesFromIds()

The names of nodes given by their ids, in a container of the same type.

neighbours()

nodes()

partialUndiGraph()

saveGUM()

Save the graph as a .jgum (text) or .bgum (binary) file (its class, its nodes with their names, its arcs, edges and marks).

saveGUMstring()

Save the graph as a jgum string (see pyagrum.graphFromGUMString to read it back).

setName()

Assign a name to a node.

size()

sizeEdges()

toDot()

undirectedPath()

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

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

addEdge()

Insert a new edge into the graph.

addNode()

addToClique()

Change the set of nodes included into a given clique and returns the new set

clear()

Remove all the nodes and edges from the graph.

clearEdges()

Remove all edges and their separators

clique()

container()

containerPath()

eraseEdge()

Erase the edge between n1 and n2.

eraseFromClique()

Remove a node from a clique

eraseNode()

Erase the node and all the adjacent edges.

hasRunningIntersection()

isJoinTree()

separator()

setClique()

changes the set of nodes included into a given clique

toDot()

toDotWithNames()

Methods inherited from UndiGraph

addNodeWithId()

Add a node by choosing a new NodeId.

addNodes()

Add n nodes.

adjacencyMatrix()

adjacency matrix from a graph/graphical models

chainComponents()

Return the chain components (connected components) of the graph.

completeGraph()

Create a complete undirected graph with n nodes.

connectedComponents()

Returns the connected components of the graph.

connectedComponentsCount()

number of connected components

connectedComponentsList()

connected components as a dict of sets

edges()

empty()

Check if the graph is empty.

emptyEdges()

Check if the graph doesn’t contains edges.

eraseNeighbours()

Erase all the edges adjacent to a given node.

existsEdge()

Check if an edge exists between n1 and n2.

existsNode()

Check if a node with a certain id exists in the graph.

hasName()

Check whether a node has an explicitly assigned name.

hasUndirectedCycle()

Checks whether the graph contains cycles.

hasUndirectedPath()

Check whether two nodes are connected by an undirected path.

idFromName()

Return the id of the node with the given name, or None if no such name exists.

idsFromNames()

The ids of nodes given by their names, in a container of the same type.

nameFromId()

Return the name of a node, or its id as a string if no name was set.

namesFromIds()

The names of nodes given by their ids, in a container of the same type.

neighbours()

nodes()

partialUndiGraph()

setName()

Assign a name to a node.

size()

sizeEdges()

undirectedPath()

Return a shortest undirected path between two nodes, or None if no path exists.