For a directed graph G defined by G(E, V), how can i find the adjacency matrix of line graph of G.
I am using networkx to learn graph:
I did calculate by this:
//out-edge incidence matrix
B = np.array([[1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 1, 0]]);
//in-edge Incidence matrix
E = np.array([[0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1]]);
ET = E.transpose();
// i created line graph from this
H = nx.line_graph(G)
//adjacency matrix of Line Graph
M = nx.to_numpy_matrix(H)
I read somewhere in internet that, this hold true for directed graph M = (Transpose of E) * B
// so i tried to check it and i got this
result = np.matmul(ET, B);
print(result)
and this is my M matrix
but this is not equal

