August 26, 2024

P89 - Bipartite graphs.

Write a function that determines whether a given graph is bipartite.

> Digraph.fromString("[a>b, c>a, d>b]").isBipartite
  res0: Boolean = true
  
  > Graph.fromString("[a-b, b-c, c-a]").isBipartite
  res1: Boolean = false
  
  > Graph.fromString("[a-b, b-c, d]").isBipartite
  res2: Boolean = true
  
  > Graph.fromString("[a-b, b-c, d, e-f, f-g, g-e, h]").isBipartite
  res3: Boolean = false

The complete source file for this section is graph.erl.

Be first to comment
Leave a reply