public void TestOneElementIncidenceMatrix() { var graph = new AdjacencyListGraph(1); var incidenceMatrix = graph.GetIncidenceMatrix(); Assert.That(incidenceMatrix.GetLength(0), Is.EqualTo(1)); Assert.That(incidenceMatrix.GetLength(1), Is.EqualTo(0)); }
public void FourVerticesGraphIncedenceMatrixTest() { var graph = new AdjacencyListGraph(4) .AddArrow(0, 1) .AddArrow(0, 2) .AddArrow(1, 0) .AddArrow(0, 3); var expectedMatrix = new short[, ] { { 1, 1, 1, -1 }, { -1, 0, 0, 1 }, { 0, -1, 0, 0 }, { 0, 0, -1, 0 } }; Assert.That(graph.GetIncidenceMatrix(), Is.EqualTo(expectedMatrix)); }