[Networkit] Request for Comments: Efficient Set Operations on Graphs
henning.meyerhenke at kit.edu
Wed Nov 4 16:56:16 CET 2015
Am 03.11.15 um 18:05 schrieb Christian Staudt:
> 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).
> What are your thoughts on this?
For append it makes sense what you propose since it is so much faster.
For union it depends on the result you want to have. Iirc, we do not
allow multiple edges. Thus, during a union, you would have to test for
duplicates. For that you have different options that depend on the size
of the respective adjacency "lists" you need to merge. For a small
addition the standard API should suffice, but for larger "lists" of
roughly equal size I'd go for something else.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 5399 bytes
Desc: S/MIME Cryptographic Signature
More information about the NetworKit