dyng
DynamicGraphLayout
Public Member Functions | List of all members
dyng::dynamic_graph Class Reference

Represents the sequence of states of a dynamic graph. More...

#include <dynamic_graph.h>

Public Member Functions

 dynamic_graph ()=default
 Default constructor.
 
node_id add_node (unsigned time)
 
edge_id add_edge (unsigned time, node_id one, node_id two)
 
void remove_node (unsigned time, node_id id)
 
void remove_edge (unsigned time, edge_id id)
 
void build ()
 
void build (std::vector< graph_state > states)
 
void clear ()
 Clears all states and queued modifications.
 
std::vector< graph_state > & states ()
 Returns reference to the vector of graph states. More...
 
const std::vector< graph_state > & states () const
 Returns const reference to the vector of graph states. More...
 
unsigned node_count () const
 Returns the number of unique nodes in this dynamic graph. More...
 
unsigned edge_count () const
 Returns the number of unique edges in this dynamic graph. More...
 

Detailed Description

Represents the sequence of states of a dynamic graph.

Holds a sequence of modifications applied and builds a sequence of graph states. Also used to access the resulting layout.

(Described in section 6.1.1)

See also
dyng::graph_state, dyng::default_layout

Member Function Documentation

◆ add_edge()

edge_id dyng::dynamic_graph::add_edge ( unsigned  time,
node_id  one,
node_id  two 
)
inline

Adds an edge at specified time.

Parameters
timeTime when to create the edge. When time == 0 the edge counts as a part of the initial state.
oneOne of the nodes the edge connects to.
twoThe other node the edge connects to.
Returns
edge_id id of the created edge.

◆ add_node()

node_id dyng::dynamic_graph::add_node ( unsigned  time)
inline

Adds a node at specified time.

Parameters
timeTime when to create the node. When time == 0 the node counts as a part of the initial state.
Returns
node_id id of the created node.

◆ build() [1/2]

void dyng::dynamic_graph::build ( )
inline

Builds the sequence of states from modifications queued up until this point. The states can be accessed by the method states().

Exceptions
invalid_graphIf an edge connects to non-existent node or there is an attempt to remove a non-existent node or edge.
See also
states() const, states()

◆ build() [2/2]

void dyng::dynamic_graph::build ( std::vector< graph_state states)
inline

Clears the modification queue and assigns parameter states as its states.

You can use this if you have a sequence of graph states to setup the dynamic graph instead of having to call a sequence of modifications and then building it with build().

Exceptions
invalid_graphIf an edge connects to non-existent node or there is an attempt to remove a non-existent node or edge.
See also
build()

◆ edge_count()

unsigned dyng::dynamic_graph::edge_count ( ) const
inline

Returns the number of unique edges in this dynamic graph.

Can be inaccurate if you add edges in the same state you remove them in. That way the edges don't end up being present in any state but the return value will be greater by that number of edges.

◆ node_count()

unsigned dyng::dynamic_graph::node_count ( ) const
inline

Returns the number of unique nodes in this dynamic graph.

Can be inaccurate if you add nodes in the same state you remove them in. That way the nodes don't end up being present in any state but the return value will be greater by that number of nodes.

◆ remove_edge()

void dyng::dynamic_graph::remove_edge ( unsigned  time,
edge_id  id 
)
inline

Removes an edge at specified time.

Parameters
timeTime to remove the edge.
edgeThe id of the edge to remove.

◆ remove_node()

void dyng::dynamic_graph::remove_node ( unsigned  time,
node_id  id 
)
inline

Removes a node at specified time.

Parameters
timeTime to remove the node.
nodeThe id of the node to remove.

◆ states() [1/2]

std::vector<graph_state>& dyng::dynamic_graph::states ( )
inline

Returns reference to the vector of graph states.

In order for this method to return non-empty vector the build method has to have been called once (with non-empty sequence of modifications).

You can access the resulting sequence of layouts after this dynamic_graph object has been given to a layout object.

You shouldn't use this method to add/remove any elements.

See also
default_layout, graph_state

◆ states() [2/2]

const std::vector<graph_state>& dyng::dynamic_graph::states ( ) const
inline

Returns const reference to the vector of graph states.

In order for this method to return non-empty vector the build method has to have been called once (with non-empty sequence of modifications).

You can access the resulting sequence of layouts after this dynamic_graph object has been given to a layout object.

See also
default_layout, graph_state

The documentation for this class was generated from the following file: