By using the equivalent definition of total graph as the square(or distance-2 graph) of the subdivision graph(the graph formed by subdividing each edge, we obtain the following pseudo-code:
def TotalGraph(G)
h=G
k = 1
G.subdivide_edges(G.edges(), k)
h=G.distance_graph(list(range(1,3)))
return h
This seems to work in my case.
![]() | 2 | No.2 Revision |
By using the equivalent definition of total graph as the square(or distance-2 graph) of the subdivision graph(the graph formed by subdividing each edge, we obtain the following pseudo-code:
def TotalGraph(G):
def TotalGraph(G)
h=Gh=G
1k =
1G.subdivide_edges(G.edges(), k)
G.subdivide_edges(G.edges(), k)h=G.distance_graph(list(range(1,3)))
h=G.distance_graph(list(range(1,3))) return
h
h
This seems to work in my case.