BipartiteGraph

(Source code, png, hires.png, pdf)

../../_images/BipartiteGraph.png
class BipartiteGraph(*args)

Bipartite red/black graph.

Available constructors:

BipartiteGraph(sequence)

Parameters
sequencesequence of Indices

Cliques of the red nodes.

Notes

A bipartite graph is an undirected graph in which the nodes can be colored in two colors such that no edge has its two ends with the same colors. Here we force the n red nodes to be numbered in consecutive order from 0 to n-1 and for each red node we give the list of black nodes that are the other end of the edges starting from this red node.

Examples

>>> import openturns as ot

Create a bipartite graph:

>>> graph = ot.BipartiteGraph([[1, 3], [2, 0], [5, 4]])
>>> graph
[[1,3],[2,0],[5,4]]

Use some functionalities:

>>> graph[1] = [3, 4]
>>> graph
[[1,3],[3,4],[5,4]]

Methods

draw(self)

Draw the graph.

getBlackNodes(self)

Accessor to the graph black nodes.

getClassName(self)

Accessor to the object’s name.

getId(self)

Accessor to the object’s id.

getName(self)

Accessor to the object’s name.

getRedNodes(self)

Accessor to the graph red nodes.

getShadowedId(self)

Accessor to the object’s shadowed id.

getVisibility(self)

Accessor to the object’s visibility state.

hasName(self)

Test if the object is named.

hasVisibleName(self)

Test if the object has a distinguishable name.

setName(self, name)

Accessor to the object’s name.

setShadowedId(self, id)

Accessor to the object’s shadowed id.

setVisibility(self, visible)

Accessor to the object’s visibility state.

getSize

__init__(self, \*args)

Initialize self. See help(type(self)) for accurate signature.

draw(self)

Draw the graph.

Returns
grapha Graph

View of the bipartite graph as a set of red nodes linked to black nodes.

getBlackNodes(self)

Accessor to the graph black nodes.

Returns
blacksequence of int, Indices
getClassName(self)

Accessor to the object’s name.

Returns
class_namestr

The object class name (object.__class__.__name__).

getId(self)

Accessor to the object’s id.

Returns
idint

Internal unique identifier.

getName(self)

Accessor to the object’s name.

Returns
namestr

The name of the object.

getRedNodes(self)

Accessor to the graph red nodes.

Returns
redsequence of int, Indices
getShadowedId(self)

Accessor to the object’s shadowed id.

Returns
idint

Internal unique identifier.

getVisibility(self)

Accessor to the object’s visibility state.

Returns
visiblebool

Visibility flag.

hasName(self)

Test if the object is named.

Returns
hasNamebool

True if the name is not empty.

hasVisibleName(self)

Test if the object has a distinguishable name.

Returns
hasVisibleNamebool

True if the name is not empty and not the default one.

setName(self, name)

Accessor to the object’s name.

Parameters
namestr

The name of the object.

setShadowedId(self, id)

Accessor to the object’s shadowed id.

Parameters
idint

Internal unique identifier.

setVisibility(self, visible)

Accessor to the object’s visibility state.

Parameters
visiblebool

Visibility flag.