Skip to content

Managing graph states

Alexander Smirnov edited this page Jul 13, 2016 · 1 revision

< Back to contents >

 Last checked against version: 2.1.8

All graph states operations are performed through GraphArea::StateStorage property. Following methods are exposed for the end user:

  • public bool ContainsState(string id) - returns true if state with specified ID exists within states collection.
  • public GraphState<TVertex, TEdge, TGraph> GetState(string id) - get graph state by specified id. Null value will be returned if no state with such id exists.
  • public Dictionary<string, GraphState<TVertex, TEdge, TGraph>> GetStates() - get the list of all available states.
  • public void LoadState(string id) - load and display graph state by specified id. Note that GraphArea::Graph, GraphArea::VertexList, GraphArea::EdgesList properties will be overwritten.
  • public void RemoveState(string id) - remove state by specified id.
  • public void SaveState(string id, string description = "") - save current graph state using specified id and optional state description.


When graph state is saved then following actions are performed:

  1. GraphArea::Graph property are copied.
  2. Vertex positions are copied.
  3. All visible edges data with route points are copied.


Note that algorithms and animations are NOT currently being saved into the states.

When graph state is loaded then following actions are performed:

  1. All vertex and edge visual controls are deleted.
  2. GraphArea::Graph property loaded from state.
  3. All visual vertices are loaded and saved positions are applied.
  4. All visual edges are loaded.