Did I find the right examples for you? yes no      Crawl my project      Python Jobs

# Bipartite.isBipartite

All Samples(4)  |  Call(2)  |  Derive(0)  |  Import(2)
```Return True if G is bipartite, False otherwise.
```

```        def isBipartite(G):
"""
Return True if G is bipartite, False otherwise.
"""
try:
TwoColor(G)
return True
except NonBipartite:
return False
```

```import BFS
import Medium
from Bipartite import isBipartite
from UnionFind import UnionFind
from StrongConnectivity import StronglyConnectedComponents
```
```    # Main contraction loop in place of the original algorithm's recursion
while len(CG) > 1:
if not isBipartite(CG):
raise Medium.MediumError("graph is not bipartite")

```

```import BFS
import Medium
from Bipartite import isBipartite
from UnionFind import UnionFind
from StrongConnectivity import StronglyConnectedComponents
```
```    # Main contraction loop in place of the original algorithm's recursion
while len(CG) > 1:
if not isBipartite(CG):
raise Medium.MediumError("graph is not bipartite")

```