|
mCRL2
|
#include <Graph.h>
Public Types | |
| enum class | EdgeDirection { EDGE_NONE = 0 , EDGE_SUCCESSOR = 1 , EDGE_PREDECESSOR = 2 , EDGE_BIDIRECTIONAL = 3 } |
| using | const_iterator = const verti * |
| using | edge_list = std::vector< std::pair< verti, verti > > |
Public Member Functions | |
| StaticGraph () | |
| ~StaticGraph () | |
| void | clear () |
| void | make_random (verti V, unsigned outdeg, EdgeDirection edge_dir, bool scc) |
| void | make_random_clustered (verti cluster_size, verti V, unsigned outdeg, EdgeDirection edge_dir) |
| void | shuffle_vertices () |
| void | shuffle_vertices (const std::vector< verti > &perm) |
| void | assign (const StaticGraph &graph) |
| void | assign (edge_list edges, EdgeDirection edge_dir) |
| edge_list | get_edges () const |
| template<class ForwardIterator > | |
| void | make_subgraph (const StaticGraph &graph, ForwardIterator vertices_begin, ForwardIterator vertices_end, bool proper, EdgeDirection edge_dir=EdgeDirection::EDGE_NONE) |
| void | make_subgraph_threads (const StaticGraph &graph, const verti *verts, verti nvert, bool proper, EdgeDirection edge_dir=EdgeDirection::EDGE_NONE) |
| void | remove_edges (edge_list &edges) |
| void | write_raw (std::ostream &os) const |
| void | read_raw (std::istream &is) |
| void | swap (StaticGraph &g) noexcept |
| bool | empty () const |
| verti | V () const |
| edgei | E () const |
| EdgeDirection | edge_dir () const |
| const_iterator | succ_begin (verti v) const |
| const_iterator | succ_end (verti v) const |
| const_iterator | pred_begin (verti v) const |
| const_iterator | pred_end (verti v) const |
| bool | has_succ (verti v, verti w) const |
| bool | has_pred (verti w, verti v) const |
| edgei | degree (verti v) const |
| edgei | outdegree (verti v) const |
| edgei | indegree (verti v) const |
| StaticGraph (const StaticGraph &graph)=delete | |
| StaticGraph & | operator= (const StaticGraph &graph)=delete |
Protected Member Functions | |
| void | make_random_scc (edge_list &edges) |
| void | reset (verti V, edgei E, EdgeDirection edge_dir) |
| template<class ForwardIterator , class VertexMapT > | |
| void | make_subgraph (const StaticGraph &graph, ForwardIterator vertices_begin, ForwardIterator vertices_end, VertexMapT &vertex_map, bool proper, EdgeDirection edge_dir=EdgeDirection::EDGE_NONE) |
Private Attributes | |
| verti | V_ = 0UL |
| edgei | E_ = 0UL |
| verti * | successors_ = nullptr |
| verti * | predecessors_ = nullptr |
| edgei * | successor_index_ = nullptr |
| edgei * | predecessor_index_ = nullptr |
| EdgeDirection | edge_dir_ |
Friends | |
| class | SmallProgressMeasures |
| class | EdgeIterator |
| constexpr bool | operator& (EdgeDirection a, EdgeDirection b) |
A static graph consists of V vertices (numbered from 0 to V, exclusive) and E edges, and can store either edge successors, predecessors, or both.
| using StaticGraph::const_iterator = const verti* |
| using StaticGraph::edge_list = std::vector<std::pair<verti, verti> > |
|
strong |
Specifies which parts of the edges are stored. When storing successors only, the functions succ_begin() and succ_end() can be used to iterate over the successors of a given vertex. Conversely, when storing predecessors, pred_begin() and pred_end() can be used to iterate over predecessors. When storing bidirectional edges, both pairs of functions can be used, but this requires more memory.
| Enumerator | |
|---|---|
| EDGE_NONE | |
| EDGE_SUCCESSOR | |
| EDGE_PREDECESSOR | |
| EDGE_BIDIRECTIONAL | |
| StaticGraph::StaticGraph | ( | ) |
|
explicitdelete |
| void StaticGraph::assign | ( | const StaticGraph & | graph | ) |
| void StaticGraph::assign | ( | edge_list | edges, |
| EdgeDirection | edge_dir | ||
| ) |
|
inline |
|
inline |
|
inline |
| StaticGraph::edge_list StaticGraph::get_edges | ( | ) | const |
| void StaticGraph::make_random | ( | verti | V, |
| unsigned | outdeg, | ||
| EdgeDirection | edge_dir, | ||
| bool | scc | ||
| ) |
Generate a random graph (replacing the old contents). The resulting game does not contain loops.
| V | number of vertices to generate |
| outdeg | desired average outdegree (at least 1) |
| edge_dir | which parts of edges to store |
| scc | create a single strongly-connected component |
| void StaticGraph::make_random_clustered | ( | verti | cluster_size, |
| verti | V, | ||
| unsigned | outdeg, | ||
| EdgeDirection | edge_dir | ||
| ) |
Generate a random clustered game, which is based on random games of size cluster_size each, which are connected recursively by being substituting for the vertices of another game of size cluster_size, repeatedly, until a single game remains.
The resulting game is always a single connected component without loops.
Passing V <= cluster_size is equivalent to calling make_random() with scc = true. Choosing V = cluster_sized creates a game with recursion depth d.
| cluster_size | number of vertices per cluster |
| V | total number of vertices to generate |
| outdeg | average outdegree (at least 1) |
| edge_dir | which parts of the edges to store |
|
protected |
| void StaticGraph::make_subgraph | ( | const StaticGraph & | graph, |
| ForwardIterator | vertices_begin, | ||
| ForwardIterator | vertices_end, | ||
| bool | proper, | ||
| StaticGraph::EdgeDirection | edge_dir = EdgeDirection::EDGE_NONE |
||
| ) |
Reset the graph to the subgraph induced by the given vertex set.
Definition at line 52 of file Graph_impl.h.
|
protected |
Reset the graph to the subgraph induced by the given vertex set, using the given map data structure to create the vertex mapping.
Definition at line 76 of file Graph_impl.h.
| void StaticGraph::make_subgraph_threads | ( | const StaticGraph & | graph, |
| const verti * | verts, | ||
| verti | nvert, | ||
| bool | proper, | ||
| EdgeDirection | edge_dir = EdgeDirection::EDGE_NONE |
||
| ) |
|
delete |
|
inline |
|
inline |
| void StaticGraph::read_raw | ( | std::istream & | is | ) |
| void StaticGraph::remove_edges | ( | StaticGraph::edge_list & | edges | ) |
|
protected |
| void StaticGraph::shuffle_vertices | ( | ) |
Randomly shuffles vertex indices. This is useful to obfuscate some of the structure remaining after make_random_clustered().
| void StaticGraph::shuffle_vertices | ( | const std::vector< verti > & | perm | ) |
Shuffle vertex indices by the given permutation. Vertex v becomes perm[v], for all v.
|
inline |
|
inline |
|
noexcept |
|
inline |
| void StaticGraph::write_raw | ( | std::ostream & | os | ) | const |
|
friend |
|
friend |
|
private |
|
private |
|
private |