Skip to content
PhillP edited this page Dec 1, 2014 · 1 revision

Change Tracking

A ChangeTracker object can be attached to a graph in order to keep a track of:

  • new vertices
  • new edges
  • changed vertices
  • changed edges
  • whether the properties of the graph itself have changed
  • deleted vertices
  • deleted edges

A change tracker is attached as follows:

	g = Graph()
	g.tracker = ChangeTracker()

It is then possible to determine whether any aspect of the graph has changed by inspecting the ischanged field.

The ChangeTracker maintains the following dictionaries that can be used to inspect changes:

	newedges::Dict{UUID.Uuid,Edge}
	newvertices::Dict{UUID.Uuid,Edge}
	
	changedgraphs::Dict{UUID.Uuid,Graph}
	changededges::Dict{UUID.Uuid,Edge}
	changedvertices::Dict{UUID.Uuid,Vertex}
	
	removededges::Dict{UUID.Uuid,Edge}
	removedvertices::Dict{UUID.Uuid,Vertex}

The clearchanges function can be used as follows to reset the ChangeTracker:

	clearchanges(g.tracker)

Change tracking is required to support functionality related to persistence, although persistence itself will not be built directly into this package.

Clone this wiki locally