All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Matching.h
Go to the documentation of this file.
1 /*
2  * Matching.h
3  *
4  * Created on: 03.12.2012
5  */
6 
7 #ifndef MATCHING_H_
8 #define MATCHING_H_
9 
10 # include "../auxiliary/Log.h"
11 #include "../graph/Graph.h"
12 #include "../structures/Partition.h"
13 
14 namespace NetworKit {
15 
19 class Matching {
20 
21 
22 public:
23 
29  Matching(count z=0);
30 
31 
38  void match(node u, node v);
39 
40 
47  void unmatch(node u, node v);
48 
49 
56  bool isMatched(node u) const;
57 
58 
65  bool areMatched(node u, node v) const;
66 
74  bool isProper(const Graph& G) const;
75 
76 
81  count size(const Graph& G) const;
82 
89  index mate(node v) const;
90 
96  edgeweight weight(const Graph& G) const;
97 
103  Partition toPartition(const Graph& G) const;
104 
109  std::vector<node> getVector() const;
110 
111 protected:
112 
113 // const Graph& G; // reference to graph
114  std::vector<node> data;
115  // count n; //!< number of nodes
116 };
117 
118 } /* namespace NetworKit */
119 #endif /* MATCHING_H_ */
Matching(count z=0)
Construct new Matching.
Definition: Matching.cpp:12
count size(const Graph &G) const
Get the number of edges in this matching.
Definition: Matching.cpp:69
uint64_t index
Typedefs.
Definition: Globals.h:20
bool isMatched(node u) const
Check if node is matched.
Definition: Matching.cpp:15
index mate(node v) const
Get the matched neighbor of v if it exists, otherwise none.
Definition: Matching.cpp:79
std::vector< node > data
storage of matching nodes
Definition: Matching.h:114
std::vector< node > getVector() const
Get the actual vector storing the data.
Definition: Matching.cpp:113
bool isProper(const Graph &G) const
Check whether this is a proper matching in the graph, i.e.
Definition: Matching.cpp:19
Implements a partition of a set, i.e.
Definition: Partition.h:31
edgeweight weight(const Graph &G) const
Get total weight of edges in this matching.
Definition: Matching.cpp:83
uint64_t count
Definition: Globals.h:21
index node
Definition: Globals.h:23
void match(node u, node v)
Set two nodes u and v as each others matching partners.
Definition: Matching.cpp:55
Partition toPartition(const Graph &G) const
Convert matching to a Partition object where matched nodes belong to the same subset and unmatched no...
Definition: Matching.cpp:95
bool areMatched(node u, node v) const
Check if the two nodes u and v are matched together.
Definition: Matching.cpp:65
void unmatch(node u, node v)
Reset the two nodes u and v to unmatched.
Definition: Matching.cpp:60
A graph (with optional weights) and parallel iterator methods.
Definition: Graph.h:79
Definition: Matching.h:19
double edgeweight
Definition: Globals.h:24