[Networkit] Request for Comments: Efficient Set Operations on Graphs

Maximilian Vogel maximilian.vogel at student.kit.edu
Wed Nov 4 16:34:12 CET 2015

Hi all,

On 03.11.2015 18:16, Christian Staudt wrote:
> Hi all,
> I would like to ask for comments on an area we have so far not worked on, namely support for set operations on graphs. For example:
> - Graph.union(Graph): merge two graphs, where nodes with same id are treated as identical
> - Graph.append(Graph): add the second graph as a subgraph to the first, remapping the nodes to new ids
> - Graph.intersect(Graph): …..
> - ….
> I think all these operations can be realized with the existing Graph API (i.e. calling modifier methods on the graph). But maybe they can be implemented more efficiently by allowing access to the internals of the data structure. E.g. ,could G1.append(G2) be realized by directly appending the adjacency structure of G2 to that of G1 and remapping the indices (add G1.upperNodeIdBound() to every node id of G2).
I guess your example would work and I would expect it to be more 
efficient than using the existing Graph API.

> I believe I need to implement something like Graph.append for my new graph generator. There is a chance to build a general instead of one (or several redundant) single-purpose solutions.
I think it's more useful to develop a general solution, even if your 
generator is the only piece of code that makes use of it.

More information about the NetworKit mailing list