Bases: Algorithm
Abstract base class for matching algorithms
Returns the matching.
Current Matching of graph.
networkit.Matching
Bases: object
Implements a graph matching. Create a new matching data structure for z elements.
Maximum number of nodes. Default: 0
Check if the nodes u and v are matched to each other.
u (int) – The first node.
v (int) – The second node.
True if node u and v are matched to each other.
bool
Get the vector storing the data.
Vector indexed by node id containing the node id of mate or networkit.none if unmatched
list(int or None)
Check if node u is matched.
u (int) – The input node.
True if u has a matching partner.
bool
Check whether this is a proper matching in the graph, i.e. there is an edge between each pair and if the matching partner of v is u then the matching partner of u is v.
G (networkit.Graph) – Graph to be checked.
True if this is a proper matching.
bool
Set two nodes u and v as each others matching partners.
u (int) – The first node.
v (int) – The second node.
Get the matched neighbor of v if it exists, otherwise +inf.
v (int) – The input node.
Matching partner of v if it exists, otherwise +inf.
int
Get the number of edges in this matching.
G (networkit.Graph) – The input graph.
Total number of edges in the matching.
int
Convert matching to a Partition object where matched nodes belong to the same subset and unmatched nodes belong to a singleton subset.
G (networkit.Graph) – The corresponding graph.
The resulting partition.
networkit.Partition
Reset the two nodes u and v to unmatched.
u (int) – The first node.
v (int) – The second node.
Get total weight of edges in this matching.
G (networkit.Graph) – The corresponding graph.
Total weight of edges in this matching.
float
Bases: Matcher
Path growing matching algorithm as described by Hougardy and Drake. Computes an approximate maximum weight matching with guarantee 1/2.
Bases: Matcher
Computes a 1/2-approximation of the maximum (weighted) matching of an undirected graph using the Suitor algorithm from Manne and Halappanavar presented in “New Effective Multithreaded Matching Algorithms”, IPDPS 2014. The algorithm has two versions: SortSuitor (faster, but only works on graphs with adjacency lists sorted by non-increasing edge weight) and Suitor (works on generic graphs). If using SortSuitor, call nk.graphtools.sortEdgesByWeight(G, True) to sort the adjacency lists by non-increasing edge weight.
G (networkit.Graph) – The input graph, must be undirected.
sortSuitor (bool, optional) – If True uses the SortSuitor version, otherwise it uses Suitor. Default: True
checkSortedEdges (bool, optional) – If True and sortSuitor is True it checks whether the adjacency lists of the input graph are sorted by non-increasing edge weight. If they are not it raises a RuntimeError. Default: False