Class GraphDifference

Inheritance Relationships

Base Type

Class Documentation

class GraphDifference : public NetworKit::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.

Public Functions

GraphDifference(const Graph &G1, const Graph &G2)

Construct the edge edit difference with two graphs to compare.

Parameters:
  • G1 – The first graph to compare.

  • G2 – The second graph to compare.

virtual void run() override

Execute the algorithm and compute the difference.

const std::vector<GraphEvent> &getEdits() const

Get the required edits.

Returns:

A vector of graph events.

count getNumberOfEdits() const

Get the required number of edits.

This is only the number of actual changes. In order to get correct node ids, more edits might be generated.

Returns:

The number of edits.

count getNumberOfNodeAdditions() const

Get the required number of node additions.

Returns:

The number of node additions.

count getNumberOfNodeRemovals() const

Get the required number of node removals.

Returns:

The number of node removals.

count getNumberOfNodeRestorations() const

Get the required number of node restorations.

Returns:

The number of node restorations.

count getNumberOfEdgeAdditions() const

Get the required number of edge additions.

Returns:

The number of edge additions.

count getNumberOfEdgeRemovals() const

Get the required number of edge removals.

Returns:

The number of edge removals.

count getNumberOfEdgeWeightUpdates() const

Get the required number of edge weight updates.

Returns:

The number of edge weight updates.