# Revision history [back]

Define the graph G and plot it:

sage: G = Graph([(1, 2), (2, 3), (3, 4), (3, 5), (2, 5), (5, 6)]); G
Graph on 6 vertices
sage: G.plot()
Launched png viewer for Graphics object consisting of 13 graphics primitives


Find adjacency matrix b of G, and inverse u of b:

sage: b = G.adjacency_matrix()
sage: u = ~b
sage: b, u
(
[0 1 0 0 0 0]  [ 0  1  0 -1  0 -1]
[1 0 1 0 1 0]  [ 1  0  0  0  0  0]
[0 1 0 1 1 0]  [ 0  0  0  1  0  0]
[0 0 1 0 0 0]  [-1  0  1  0  0 -1]
[0 1 1 0 0 1]  [ 0  0  0  0  0  1]
[0 0 0 0 1 0], [-1  0  0 -1  1  0]
)


Some entries in u are -1, so it's slightly weird to use it as adjacency matrix, but it works, with edges for nonzero entries.

sage: H = Graph(u)
sage: H.plot()
Launched png viewer for Graphics object consisting of 13 graphics primitives