BipartiteGraph

(Source code, png)

../../_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()

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)
draw()

Draw the graph.

Returns:
grapha Graph

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

getBlackNodes()

Accessor to the graph black nodes.

Returns:
blacksequence of int, Indices
getClassName()

Accessor to the object’s name.

Returns:
class_namestr

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

getId()

Accessor to the object’s id.

Returns:
idint

Internal unique identifier.

getName()

Accessor to the object’s name.

Returns:
namestr

The name of the object.

getRedNodes()

Accessor to the graph red nodes.

Returns:
redsequence of int, Indices
getShadowedId()

Accessor to the object’s shadowed id.

Returns:
idint

Internal unique identifier.

getVisibility()

Accessor to the object’s visibility state.

Returns:
visiblebool

Visibility flag.

hasName()

Test if the object is named.

Returns:
hasNamebool

True if the name is not empty.

hasVisibleName()

Test if the object has a distinguishable name.

Returns:
hasVisibleNamebool

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

setName(name)

Accessor to the object’s name.

Parameters:
namestr

The name of the object.

setShadowedId(id)

Accessor to the object’s shadowed id.

Parameters:
idint

Internal unique identifier.

setVisibility(visible)

Accessor to the object’s visibility state.

Parameters:
visiblebool

Visibility flag.