<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described.
<END_TASK>
<USER_TASK:>
Description:
Print negative weight cycle in a Directed Graph
Structure to represent a weighted edge in graph ; Structure to represent a directed and weighted graph ; V . Number of vertices , E . Number of edges ; Graph is represented as an array of edges . ; Creates a new graph with V vertices and E edges ; Function runs Bellman - Ford algorithm and prints negative cycle ( if present ) ; Relax all edges
V
- 1 times . ; Check for negative - weight cycles ; Store one of the vertex of the negative weight cycle ; To store the cycle vertex ; Reverse cycle [ ] ; Printing the negative cycle ; Driver Code ; Number of vertices in graph ; Number of edges in graph ; Given Graph ; Function Call

<ASSISTANT_TASK:>
Python Code:
class Edge : 
	 def __init__(self ) : 
	 self . src = 0 
 self . dest = 0 
 self . weight = 0 
   class Graph : 
	 def __init__(self ) : 
	 self . V = 0 
 self . E = 0 
 self . edge =[] 
   def createGraph(V , E ) : 
	 graph = Graph() ; 
 graph . V = V ; 
 graph . E = E ; 
 graph . edge =[Edge() for i in range(graph . E ) ] 
 return graph ; 
  def NegCycleBellmanFord(graph , src ) : 
	 V = graph . V ; 
 E = graph . E ; 
 dist =[1000000 for i in range(V ) ] 
 parent =[- 1 for i in range(V ) ] 
 dist[src ] = 0 ; 
 for i in range(1 , V ) : 
	 for j in range(E ) : 
	 u = graph . edge[j ] . src ; 
 v = graph . edge[j ] . dest ; 
 weight = graph . edge[j ] . weight ; 
 if(dist[u ] != 1000000 and dist[u ] + weight < dist[v ] ) : 
	 dist[v ] = dist[u ] + weight ; 
 parent[v ] = u ; 
    C = - 1 ; 
 for i in range(E ) : 
	 u = graph . edge[i ] . src ; 
 v = graph . edge[i ] . dest ; 
 weight = graph . edge[i ] . weight ; 
 if(dist[u ] != 1000000 and dist[u ] + weight < dist[v ] ) : 
	 C = v ; 
 break ; 
   if(C != - 1 ) : 
	 for i in range(V ) : 
	 C = parent[C ] ; 
  cycle =[] 
 v = C 
 while(True ) : 
	 cycle . append(v ) 
 if(v == C and len(cycle ) > 1 ) : 
	 break ; 
  v = parent[v ] 
  cycle . reverse() 
 for v in cycle : 
	 print(v , end = "▁ ") ; 
  print() 
  else : 
	 print(- 1 ) ; 
   if __name__== ' __main __' : 
	 V = 5 ; 
 E = 5 ; 
 graph = createGraph(V , E ) ; 
 graph . edge[0 ] . src = 0 ; 
 graph . edge[0 ] . dest = 1 ; 
 graph . edge[0 ] . weight = 1 ; 
 graph . edge[1 ] . src = 1 ; 
 graph . edge[1 ] . dest = 2 ; 
 graph . edge[1 ] . weight = 2 ; 
 graph . edge[2 ] . src = 2 ; 
 graph . edge[2 ] . dest = 3 ; 
 graph . edge[2 ] . weight = 3 ; 
 graph . edge[3 ] . src = 3 ; 
 graph . edge[3 ] . dest = 4 ; 
 graph . edge[3 ] . weight = - 3 ; 
 graph . edge[4 ] . src = 4 ; 
 graph . edge[4 ] . dest = 1 ; 
 graph . edge[4 ] . weight = - 3 ; 
 NegCycleBellmanFord(graph , 0 ) ; 
 
<END_TASK>
