public void IsBiGraph_When_ItIs() { biGraphReader.IsGraphBipartite().Should().BeTrue(); biGraphReader.PartEven.Should().BeEquivalentTo(new List <int>() { 2, 4 }); biGraphReader.PartOdd.Should().BeEquivalentTo(new List <int>() { 1, 3 }); }
private static void Main(string[] args) { args = File.ReadAllLines("in.txt"); var reader = new BipartiteGraphReader(args); var success = reader.IsGraphBipartite(); if (!success) { File.WriteAllText("out.txt", "N"); } else { WriteParts(reader); } }
public void TestBiggerBigraph() { var reader = new BipartiteGraphReader(new [] { "8", "2 4 0", "1 3 0", "2 4 0", "1 3 5 0", "6 0", "7 8 0", "0", "0" }); reader.IsGraphBipartite().Should().BeTrue(); }
public void NotBiGraph_When_ItIsNot() { noBiGraphReader.IsGraphBipartite().Should().BeFalse(); noBiGraphReader.PartEven.Should().BeEmpty(); noBiGraphReader.PartOdd.Should().BeEmpty(); }