Module misc
misc
Collection of tools that don’t fit anywhere else.
See dbus, evdev, event, file, hwinfo, log, lua, misc, os, spawn, udev, xorg for more information about this type
Methods
Find maximum unweighted bipartite match. |
|
Solve a system of difference constraints. |
- bipartite_match(graph) [int]
- Return type:
[int]
- Parameters:
graph ([[int]])
Find maximum unweighted bipartite match.
The input is a list of edges. There is one list for each node on the left, containing the indices of the nodes on the right that it is connected to.
Returns a list of integers, the indices of the nodes on the right that each node on the left is matched to. Or -1 if it is not matched
- difference_constraints(constraints) [int]
- Return type:
[int]
- Parameters:
constraints ([[int]])
Solve a system of difference constraints.
The input is a list of constraints, which are formatted as a array of arrays of integers, array of integers at index \(i\) describes the constraints for \(x_i\). Each constraint is a pair of integers, the first being the index of the other variable, and the second being the difference between the two variables. e.g. if the first is \(j\) and the second is \(k\), then the constraint is \(x_j - x_i < = k\), note the order of the variables.
Returns a list of integers, the values of the variables that satisfy the constraints.