Graphs and Graph Algorithms in C++

Download (GitHub) • Reference manual

Developers

Synopsis

This C++ template library implements directed and undirected graphs with constant-time random access to incident vertices and edges. Vertices and edges can always be indexed by contiguous integers as well as by STL-compliant random access iterators. This simplifies the implementation of algorithms for static graphs. In dynamic graphs (where vertices or edges can be removed), their changing integer indices can be followed, if necessary, via callbacks. Subgraphs are defined by subgraph masks.

Features

Time Complexity

Operation Graph Digraph CompleteGraph GridGraph<d>
n = numberOfVertices() O(1) O(1) O(1) O(1)
n = numberOfEdges() O(1) O(1) O(1) O(1)
n = numberOfEdgesFromVertex(v) O(1) O(1) O(1) O(d)
n = numberOfEdgesToVertex(v) O(1) O(1) O(1) O(d)
v = vertexOfEdge(e, j) O(1) O(1) O(1) O(d)
e = edgeFromVertex(v, j) O(1) O(1) O(1) O(d)
e = edgeToVertex(v, j) O(1) O(1) O(1) O(d)
v = vertexFromVertex(v, j) O(1) O(1) O(1) O(d)
v = vertexToVertex(v, j) O(1) O(1) O(1) O(d)
r = findEdge(v0, v1) O(log deg G) O(log deg G) O(1) O(d2)
v = insertVertex() O(1) O(1) n/a n/a
v = insertVertices(n) O(1) O(1) n/a n/a
e = insertEdge(v0, v1) O(deg G) O(deg G) n/a n/a
eraseEdge(e) O(deg G) O(deg G) n/a n/a
eraseVertex(v) O((deg G)2) O((deg G)2) n/a n/a

Algorithms

References

  1. Levinkov E., Uhrig J., Tang S., Omran M., Insafutdinov E., Kirillov A., Rother C., Brox T., Schiele B. and Andres B. Joint Graph Decomposition and Node Labeling: Problem, Algorithms, Applications. CVPR 2017
  2. Horňáková A., Lange J.-H. and Andres B. Analysis and Optimization of Graph Decompositions by Lifted Multicuts. ICML 2017
  3. Chopra S. and Rao M. R. The partition problem. Mathematical Programming 59(1-3):87-115. 1993
  4. Edmonds J. and Karp R. M. Theoretical improvements in algorithmic efficiency for network flow problems. Journal of the ACM 19(2):248-264. 1972
  5. Goldberg A. V. and Tarjan R. E. A new approach to the maximum-flow problem. Journal of the ACM 35(4):921-940. 1988
  6. Hopcroft J. and Tarjan R. E. Efficient algorithms for graph manipulation. Communications of the ACM 16(6):372-378. 1973
  7. Kernighan B. W. and Lin S. An efficient heuristic procedure for partitioning graphs. Bell Systems Technical Journal. 49:291-307. 1970
  8. Keuper M., Levinkov E., Bonneel N., Lavoué G., Brox T. and Andres B. Efficient Decomposition of Image and Mesh Graphs by Lifted Multicuts. Int. Conf. on Computer Vision (ICCV) 2015
  9. Prim R. C. Shortest connection networks and some generalizations. Bell System Technical Journal 36:1389-1401. 1957
  10. Tarjan R. E. A note on finding the bridges of a graph. Information Processing Letters 2(6):160-161. 1974
  11. Bourgeois F. and Lasalle J.-C. An extension of the Munkres algorithm for the assignment problem to rectangular matrices. Communications of the ACM 14(12):802-804 1971.

License

Copyright © by Bjoern Andres (bjoern@andres.sc).

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

This is Bjoern Andres' personal website. © Copy freely.