|
ADS
Algorithms and Data Structures
|
The graphs of ADS as graphs of NetworKit (https://networkit.github.io), and the changes of a graph of ADS driving the dynamic algorithms of NetworKit, beyond the book: More...
#include "ADS/Contract.h"#include "ADS/graph/Graph.h"#include "ADS/graph/Observable.h"#include <networkit/base/DynAlgorithm.hpp>#include <networkit/dynamics/GraphEvent.hpp>#include <networkit/graph/Graph.hpp>#include <cstddef>#include <span>#include <type_traits>#include <variant>#include <vector>Go to the source code of this file.
Classes | |
| class | ADS::networkit::NetworKitMirror< G > |
| a graph of NetworKit kept in step with a graph of ADS, as an observer of its ObservedGraph, which tells each change to the dynamic algorithms of NetworKit attached to it More... | |
Namespaces | |
| namespace | ADS |
| namespace | ADS::networkit |
Functions | |
| template<class W> | |
| NetworKit::edgeweight | ADS::networkit::weightOf (const W &w) |
| the weight \( w \) of ADS as a weight of NetworKit, the default weight of NetworKit if the graph is unweighted | |
| template<Graph G> | |
| NetworKit::Graph | ADS::networkit::toNetworKit (const G &g) |
| \( g \) copied into a graph of NetworKit, oriented and weighted as it is, the names of the nodes kept, in \( O( n + m ) \) time | |
The graphs of ADS as graphs of NetworKit (https://networkit.github.io), and the changes of a graph of ADS driving the dynamic algorithms of NetworKit, beyond the book:
The events map one to one: NodeInserted to NODE_ADDITION (or NODE_RESTORATION of a name that NetworKit had removed), NodeDeleted to NODE_REMOVAL, EdgeInserted to EDGE_ADDITION, EdgeDeleted to EDGE_REMOVAL and WeightChanged to EDGE_WEIGHT_UPDATE, with the new weight. Each algorithm is attached with the kinds of the events it takes (the masks of GraphEvents, the three kinds of the edges by default, since most dynamic algorithms of NetworKit reject the others): the graph of NetworKit sees every change, the algorithm only those of its kinds. A dynamic algorithm of NetworKit is told of the changes by its caller, who must change the graph and call update() in the same order; here the observer of ADS does both, for every change that goes through the wrapper.
NetworKit has its own graphs and many more algorithms of network analysis, and ADS does not replace them: the copy lets them run on a graph of ADS, and the mirror lets a program that changes its graphs through ADS keep their results up to date. Its cost is that of the change in NetworKit and of the update of the algorithms, plus \( O( 1 ) \) per event.
This header is of the set interop: no entry point of ADS includes it, and it needs NetworKit 11.2 or later (with fromCSR()) and its tlx, found by CMake when ADS_WITH_NETWORKIT is AUTO or ON (the target ADS::NetworKit). The contracts [see Contract.h]: the mirror sees the graph as it is at its construction and then every change through the wrapper; the algorithms attached outlive the mirror or are detached first, and they were run (run()) on its graph before the first change; nobody attaches or detaches within a batch.