documentationfor yFiles for HTML 2.6

Bipartition

Calculates a bipartition of the given graph, if one exists.

Inheritance Hierarchy
Bipartition

Remarks

A graph is bipartite if its nodes can be divided into two partitions where no edges are between nodes of the same partition. Instead, every edge connects a node from the first with a node from the second partition.

Other Graph Connectivity Algorithms

yFiles for HTML supports a number of other analysis algorithms that partition the graph into components, based on various criteria.

  • ConnectedComponents – Determines components defined by the existence of an undirected path between nodes
  • StronglyConnectedComponents – Determines components defined by the existence of a directed path between nodes
  • BiconnectedComponents – Determines components defined by the existence of at least two separate undirected paths between all nodes
  • IndependentSets – Divides a graph into partitions where no nodes are connected within a partition
  • KCoreComponents – Calculates the k-cores of an undirected input graph. The k-core of an undirected input graph consists of the subgraph components where each node has at least degree k.

Examples

Calculating the two partitions of a bipartite graph
// prepare the bipartition algorithm
const algorithm = new Bipartition()
// run the algorithm
const result = algorithm.run(graph)

// highlight the nodes of the partitions with different styles
if (result.isBipartite) {
  for (const node of result.firstPartition.nodes) {
    graph.setStyle(node, firstPartitionStyle)
  }
  for (const node of result.secondPartition.nodes) {
    graph.setStyle(node, secondPartitionStyle)
  }
}

Type Details

yfiles module
view-layout-bridge
yfiles-umd modules
view-layout-bridge
Legacy UMD name
yfiles.analysis.Bipartition

See Also

Constructors

Properties

Methods