'Conversion to incidence matrix'

def test_incidence_matrix(self):

    I = nx.incidence_matrix(self.G, nodelist=sorted(self.G), edgelist=sorted(self.G.edges()), oriented=True).todense().astype(int)
    assert_equal(I, self.OI)
    I = nx.incidence_matrix(self.G, nodelist=sorted(self.G), edgelist=sorted(self.G.edges()), oriented=False).todense().astype(int)
    assert_equal(I, numpy.abs(self.OI))
    I = nx.incidence_matrix(self.MG, nodelist=sorted(self.MG), edgelist=sorted(self.MG.edges()), oriented=True).todense().astype(int)
    assert_equal(I, self.OI)
    I = nx.incidence_matrix(self.MG, nodelist=sorted(self.MG), edgelist=sorted(self.MG.edges()), oriented=False).todense().astype(int)
    assert_equal(I, numpy.abs(self.OI))
    I = nx.incidence_matrix(self.MG2, nodelist=sorted(self.MG2), edgelist=sorted(self.MG2.edges()), oriented=True).todense().astype(int)
    assert_equal(I, self.MGOI)
    I = nx.incidence_matrix(self.MG2, nodelist=sorted(self.MG), edgelist=sorted(self.MG2.edges()), oriented=False).todense().astype(int)
    assert_equal(I, numpy.abs(self.MGOI))
