networkit.dynamics

class networkit.dynamics.DGSStreamParser(path, mapped=True, baseIndex=0)

Bases: object

Create a DGSStreamParser, handling graph streams encoded in DGS-based files. For documentation about DGS, see: https://graphstream-project.org/doc/Advanced-Concepts/The-DGS-File-Format/

Parameters:
  • path (str) – Filename including path for DGS-file.

  • mapped (bool, optional) – Indicates whether file includes mapping. Default: True

  • baseIndex (int, optional) – Indicates whether a fixed base index should be set. Default: 0

getStream()

Returns a list of graph events (networkit.GraphEvent).

Returns:

A list of graph events.

Return type:

list(networkit.dynamics.GraphEvent)

class networkit.dynamics.DGSWriter

Bases: object

Creates a DGS writer object.

write(stream, path)

Stores a graph event stream in a file (DGS format).

Parameters:
class networkit.dynamics.GraphDifference(G1, G2)

Bases: Algorithm

Calculate the edge difference between two graphs.

This calculates which graph edge additions or edge removals are necessary to transform one given graph into another given graph.

Both graphs need to have the same node set, directed graphs are not supported currently.

Note that edge weight differences are not detected but edge addition events set the correct edge weight.

Parameters:
  • G1 (networkit.Graph) – The first graph to compare

  • G2 (networkit.Graph) – The second graph to compare

getEdits()

Get the required edits.

Returns:

A list of graph events.

Return type:

list(networkit.dynamics.GraphEvent)

getNumberOfEdgeAdditions()

Get the required number of edge additions.

Returns:

The number of edge additions.

Return type:

int

getNumberOfEdgeRemovals()

Get the required number of edge removals.

Returns:

The number of edge removals.

Return type:

int

getNumberOfEdgeWeightUpdates()

Get the required number of edge weight updates.

Returns:

The number of edge weight updates.

Return type:

int

getNumberOfEdits()

Get the required number of edits.

Returns:

The number of edits.

Return type:

int

getNumberOfNodeAdditions()

Get the required number of node additions.

Returns:

The number of node additions.

Return type:

int

getNumberOfNodeRemovals()

Get the required number of node removals.

Returns:

The number of node removals.

Return type:

int

getNumberOfNodeRestorations()

Get the required number of node restorations.

Returns:

The number of node restorations.

Return type:

int

class networkit.dynamics.GraphEvent(type, u, v, w)

Bases: object

Representation of a graph event.

Parameter type is one of the following:

  • networkit.dynamics.GraphEventType.NODE_ADDITION

  • networkit.dynamics.GraphEventType.NODE_REMOVAL

  • networkit.dynamics.GraphEventType.NODE_RESTORATION

  • networkit.dynamics.GraphEventType.EDGE_ADDITION

  • networkit.dynamics.GraphEventType.EDGE_REMOVAL

  • networkit.dynamics.GraphEventType.EDGE_WEIGHT_UPDATE

  • networkit.dynamics.GraphEventType.EDGE_WEIGHT_INCREMENT

  • networkit.dynamics.GraphEventType.TIME_STEP

Parameters:
  • type (networkit.dynamics.GraphEvent) – Type of graph event.

  • u (int) – Node u involved in graph event.

  • v (int) – Node v involved in graph event.

  • w (int, float) – Weight of edge between node u and v.

type

Property of networkit.dynamics.GraphEvent

Type of graph event.

u

Property of networkit.dynamics.GraphEvent

Node u involved in graph event.

v

Property of networkit.dynamics.GraphEvent

Node v involved in graph event.

w

Property of networkit.dynamics.GraphEvent

Edgeweight w involved in graph event.

class networkit.dynamics.GraphUpdater(G)

Bases: object

Updates a graph according to a stream of graph events.

Parameters:

G (networkit.Graph) – Initial graph

update(stream)

Update the underlying graph based on an input stream.

Parameters:

stream (list(networkit.dynamics.GraphEvent)) – A list of graph events.

networkit.dynamics.graphFromStream(stream, weighted, directed)

Convenience function for creating a new graph from a stream of graph events

Parameters:
  • stream (list(networkit.dynamics.GraphEvent)) – Event stream

  • weighted (bool) – Produce a weighted or unweighted graph

  • directed (bool) – Produce a directed or undirected graph