I am trying to find a way in Python to pair up nodes in an undirected graph such that the maximal amounts of nodes is reached, while no node appears more than once.
Example:
Input1: Graph with 3 nodes and edges [A, B], [A, C], [B, C]
Output1: should be 2 because there is no way to choose more than one edge such that no node is repeated.
Input2: Graph with 6 nodes and edges [A, B], [A, C], [A, D], [B, D], [B, E], [B, F], [C, D], [C, F], [E, F]
Output2: should be 6 because all nodes can be paired. For example, with edges [A, B], [C, D], [E, F].