# BipartiteGraph¶

class BipartiteGraph(*args)

Bipartite red/black graph.

Available constructors:
BipartiteGraph(sequence)
Parameters: sequence : sequence 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 red nodes to be numbered in consecutive order from 0 to 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() Draw the graph. getBlackNodes() Accessor to the graph black nodes. getClassName() Accessor to the object’s name. getId() Accessor to the object’s id. getName() Accessor to the object’s name. getRedNodes() Accessor to the graph red nodes. getShadowedId() Accessor to the object’s shadowed id. getVisibility() Accessor to the object’s visibility state. hasName() Test if the object is named. hasVisibleName() Test if the object has a distinguishable name. setName(name) Accessor to the object’s name. setShadowedId(id) Accessor to the object’s shadowed id. setVisibility(visible) Accessor to the object’s visibility state.
 getSize
__init__(*args)

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

draw()

Draw the graph.

Returns: graph : View of the bipartite graph as a set of red nodes linked to black nodes.
getBlackNodes()

Accessor to the graph black nodes.

Returns: black : sequence of int, Indices
getClassName()

Accessor to the object’s name.

Returns: class_name : str The object class name (object.__class__.__name__).
getId()

Accessor to the object’s id.

Returns: id : int Internal unique identifier.
getName()

Accessor to the object’s name.

Returns: name : str The name of the object.
getRedNodes()

Accessor to the graph red nodes.

Returns: red : sequence of int, Indices
getShadowedId()

Accessor to the object’s shadowed id.

Returns: id : int Internal unique identifier.
getVisibility()

Accessor to the object’s visibility state.

Returns: visible : bool Visibility flag.
hasName()

Test if the object is named.

Returns: hasName : bool True if the name is not empty.
hasVisibleName()

Test if the object has a distinguishable name.

Returns: hasVisibleName : bool True if the name is not empty and not the default one.
setName(name)

Accessor to the object’s name.

Parameters: name : str The name of the object.
setShadowedId(id)

Accessor to the object’s shadowed id.

Parameters: id : int Internal unique identifier.
setVisibility(visible)

Accessor to the object’s visibility state.

Parameters: visible : bool Visibility flag.