Revision history [back]

remove cycles of length 2 from directed line graph

I have the following calculations/definitions:
G = graphs.RandomGNP(4,1) #this gives a complete graph on 4 vertices
GD = G.to_directed() #replaces each edge with two edges with opposite orientations
LG = GD.line_graph() #creates a line graph from my directed graph GD

But, my problem is as such:
My line graph has loops (cycles) of length 2. I need to get rid of all the loops of length 2 - how would I go about doing this?

 2 fixed terminology: loops -> cycles of length 2 fidbc 2308 ●4 ●24 ●55

remove cycles of length 2 from directed line graph

I have the following calculations/definitions:
G = graphs.RandomGNP(4,1) #this gives a complete graph on 4 vertices
GD = G.to_directed() #replaces each edge with two edges with opposite orientations
LG = GD.line_graph() #creates a line graph from my directed graph GD

But, my problem is as such:
My line graph has loops (cycles) cycles of length 2. I need to get rid of all the loops cycles of length 2 - how would I go about doing this?

Line graph is incorrect therefore skews calculations further on! help!

I'VE COMPLETELY REVISED MY QUESTION

I wish to take a simple undirected graph (i.e. the complete graph K_4) Arbitrarily direct said graph, and then create a line graph from the directed version of the graph.

However, in Sage it appears to create a line graph that shows a connection between two edges (that are just inverses of each other), so what I really want is a line graph that doesn't give an edge connected to its own inverse.

That's why I asked if we could remove cycles of length 2 from directed line graph

2, but that doesn't seem to solve the problem.

Here's what I have the following calculations/definitions:
am trying to work out:

G = graphs.RandomGNP(4,1) #this gives
GD = G.to_directed() #orients G
m = GD.size() #number of edges of digraphG
LG = GD.line_graph() #the line graph of the digraph
IM = identity_matrix(QQ,GD.size())
var('u') #defines u as a variable
X=IM-u*T #defines a new matrix X
Z=X.det() #defines polynomial in u
Z #computes determinant of X
Z.coefficients(u) #extracts coefficients

considering my graph is a complete graph on 4 vertices
GD = G.to_directed() #replaces each edge with two edges with opposite orientations
LG = GD.line_graph() #creates a line graph from my directed graph GD

But, my problem is - the coefficients should be as such:
My line graph has cycles of length 2. I need to get rid of all the cycles of length 2 - how would I go about doing this?such:
[coeff,degree of u]
[1,0], [0,1], [0,2],[-8,3],[-2,4]

note: im only interested in coefficients up to the order of n=#of nodes in the graph, so here for K_4 obviously n=4.
where the coefficient of u^3 corresponds to the negative of twice the number of triangles in K_4
where the coefficient u^4 corresponds to the negative of twice the number of squares in K_4

Line graph is incorrect therefore skews calculations further on! help!

I'VE COMPLETELY REVISED MY QUESTION

I wish to take a simple undirected graph (i.e. the complete graph K_4) Arbitrarily direct said graph, and then create a line graph from the directed version of the graph.

However, in Sage it appears to create a line graph that shows a connection between two edges (that are just inverses of each other), so what I really want is a line graph that doesn't give an edge connected to its own inverse.

That's why I asked if we could remove cycles of length 2, but that doesn't seem to solve the problem.

Here's what I am trying to work out:

G = graphs.RandomGNP(4,1)
GD = G.to_directed() #orients G
m = GD.size() #number of edges of digraphG
LG = GD.line_graph() #the line graph of the digraph
IM = identity_matrix(QQ,GD.size())
var('u') #defines u as a variable
X=IM-u*T #defines a new matrix X
Z=X.det() #defines polynomial in u
aka inverse of the Ihara zeta function Z #computes determinant of X
Z.coefficients(u) #extracts coefficients

considering my graph is a complete graph on 4 vertices - the coefficients should be as such:
[coeff,degree of u]
[1,0], [0,1], [0,2],[-8,3],[-2,4]

note: im only interested in coefficients up to the order of n=#of nodes in the graph, so here for K_4 obviously n=4.
where the coefficient of u^3 corresponds to the negative of twice the number of triangles in K_4
where the coefficient u^4 corresponds to the negative of twice the number of squares in K_4

Line graph is incorrect therefore skews calculations further on! help!

I'VE COMPLETELY REVISED MY QUESTION

I wish to take a simple undirected graph (i.e. the complete graph K_4) Arbitrarily direct said graph, and then create a line graph from the directed version of the graph.

However, in Sage it appears to create a line graph that shows a connection between two edges (that are just inverses of each other), so what I really want is a line graph that doesn't give an edge connected to its own inverse.

That's why I asked if we could remove cycles of length 2, but that doesn't seem to solve the problem.

Here's what I am trying to work out:

G = graphs.RandomGNP(4,1)
GD = G.to_directed() #orients G
m = GD.size() #number of edges of digraphG
LG = GD.line_graph() #the line graph of the digraph
IM = identity_matrix(QQ,GD.size())
var('u') #defines u as a variable
X=IM-u*T #defines a new matrix X
Z=X.det() #defines polynomial in u aka inverse of the Ihara zeta function
Z #computes determinant of X
Z.coefficients(u) #extracts coefficients

considering my graph is a complete graph on 4 vertices - the coefficients should be as such:
[coeff,degree of u]
[1,0], [0,1], [0,2],[-8,3],[-2,4]

note: NOTE:
im only interested in coefficients up to the order of n=#of nodes in the graph, so here for K_4 obviously n=4.
where the coefficient of u^3 corresponds to the negative of twice the number of triangles in K_4
where the coefficient u^4 corresponds to the negative of twice the number of squares in K_4

Line graph is incorrect therefore skews calculations further on! help!

I'VE COMPLETELY REVISED MY QUESTION

I wish to take a simple undirected graph (i.e. the complete graph K_4) Arbitrarily direct said graph, and then create a line graph from the directed version of the graph.

However, in Sage it appears to create a line graph that shows a connection between two edges (that are just inverses of each other), so what I really want is a line graph that doesn't give an edge connected to its own inverse.

That's why I asked if we could remove cycles of length 2, but that doesn't seem to solve the problem.

Here's what I am trying to work out:

G = graphs.RandomGNP(4,1)
GD = G.to_directed() #orients G
m = GD.size() #number of edges of digraphG
LG = GD.line_graph() #the line graph of the digraph
IM = identity_matrix(QQ,GD.size())
var('u') #defines u as a variable
X=IM-u*T #defines a new matrix X
Z=X.det() #defines polynomial in u aka inverse of the Ihara zeta function
Z #computes determinant of X
Z.coefficients(u) #extracts coefficients

considering my graph is a complete graph on 4 vertices - the coefficients should be as such:
[coeff,degree of u]
[1,0], [0,1], [0,2],[-8,3],[-2,4]

NOTE:
im only interested in coefficients up to the order of n=#of nodes in the graph, so here for K_4 obviously n=4.
where the coefficient of u^3 corresponds to the negative of twice the number of triangles in K_4
where the coefficient u^4 corresponds to the negative of twice the number of squares in K_4

 7 Updated title and imprived style. fidbc 2308 ●4 ●24 ●55

Line graph is incorrect therefore skews calculations further on! help!How to get an arbitrary orientation of a graph.

I'VE COMPLETELY REVISED MY QUESTION

I wish to take a simple undirected graph (i.e. the complete graph K_4) Arbitrarily direct said graph, and then create a line graph from the directed version of the graph.

However, in Sage it appears to create a line graph that shows a connection between two edges (that are just inverses of each other), so what I really want is a line graph that doesn't give an edge connected to its own inverse.

That's why I asked if we could remove cycles of length 2, but that doesn't seem to solve the problem.

Here's what I am trying to work out:

G = graphs.RandomGNP(4,1)
GD = G.to_directed()      #orients G
m = GD.size()             #number of edges of digraphG digraph GD
LG = GD.line_graph()      #the line graph of the digraph
IM = identity_matrix(QQ,GD.size())
var('u')                  #defines u as a variable
X=IM-u*T                  #defines a new matrix X
Z=X.det()                 #defines polynomial in u  aka inverse of the Ihara zeta function  function
Z                         #computes determinant of X
Z.coefficients(u)         #extracts coefficients  coefficients


considering my graph is a complete graph on 4 vertices - the coefficients should be as such:
[coeff,degree of u]
[1,0], [0,1], [0,2],[-8,3],[-2,4]

NOTE:
im only interested in coefficients up to the order of n=#of nodes in the graph, so here for K_4 obviously n=4.
where the coefficient of u^3 corresponds to the negative of twice the number of triangles in K_4
where the coefficient u^4 corresponds to the negative of twice the number of squares in K_4

How to get an arbitrary orientation of a graph.

I'VE COMPLETELY REVISED MY QUESTION

I wish to take a simple undirected graph (i.e. the complete graph K_4) Arbitrarily direct said graph, and then create a line graph from the directed version of the graph.

However, in Sage it appears to create a line graph that shows a connection between two edges (that are just inverses of each other), so what I really want is a line graph that doesn't give an edge connected to its own inverse.

That's why I asked if we could remove cycles of length 2, but that doesn't seem to solve the problem.

Here's what I am trying to work out:

G = graphs.RandomGNP(4,1)
GD = G.to_directed()     #orients G
m = GD.size()            #number of edges of digraph GD
LG = GD.line_graph()     #the line graph of the digraph
IM = identity_matrix(QQ,GD.size())
var('u')                 #defines u as a variable
X=IM-u*T                 #defines a new matrix X
Z=X.det()                #defines polynomial in u  aka inverse of the Ihara zeta function
Z                        #computes determinant of X
Z.coefficients(u)        #extracts coefficients


considering my graph is a complete graph on 4 vertices - the coefficients should be as such:
[coeff,degree of u]
[1,0], [0,1], [0,2],[-8,3],[-2,4]

NOTE:
im only interested in coefficients up to the order of n=#of nodes in the graph, so here for K_4 obviously n=4.
where the coefficient of u^3 corresponds to the negative of twice the number of triangles in K_4
where the coefficient u^4 corresponds to the negative of twice the number of squares in K_4

How to get an arbitrary orientation of a graph.

I'VE COMPLETELY REVISED MY QUESTION

I wish to take a simple undirected graph (i.e. the complete graph K_4) Arbitrarily direct said graph, and then create a line graph from the directed version of the graph.

However, in Sage it appears to create a line graph that shows a connection between two edges (that are just inverses of each other), so what I really want is a line graph that doesn't give an edge connected to its own inverse.

That's why I asked if we could remove cycles of length 2, but that doesn't seem to solve the problem.

Here's what I am trying to work out:

G = graphs.RandomGNP(4,1)
GD = G.to_directed()     #orients G
m = GD.size()            #number of edges of digraph GD
LG = GD.line_graph()     #the line graph of the digraph
IM = identity_matrix(QQ,GD.size())
var('u')                 #defines u as a variable
X=IM-u*T                 #defines a new matrix X
Z=X.det()                #defines polynomial in u  aka inverse of the Ihara zeta function
Z                        #computes determinant of X
Z.coefficients(u)        #extracts coefficients


considering my graph is a complete graph on 4 vertices - the coefficients should be as such:
[coeff,degree of u]
[1,0], [0,1], [0,2],[-8,3],[-2,4]

NOTE:
im only interested in coefficients up to the order of n=#of nodes in the graph, so here for K_4 obviously n=4.
where the coefficient of u^3 corresponds to the negative of twice the number of triangles in K_4
where the coefficient u^4 corresponds to the negative of twice the number of squares in K_4

Here is an image of a K_4 graph minus an edge and the line graph construction of K_4 that i want