Skip to content

Solution not optimal for "Bubbles" #17

@BastienAubecq

Description

@BastienAubecq

I've found a case where the solution to the "Bubbles" exercice is not the smallest possible number of pairs as requested :

List<Contact> contacts = Collections.unmodifiableList(Arrays.asList(
    new Contact("C", "D"),
    new Contact("A", "B"),
    new Contact("B", "C"),
    new Contact("D", "E"),
    new Contact("E", "F")
));
List<ForbiddenRelation> fr = Bubbles.cleanBubbles(contacts, 1);
assertEquals(fr.size(), 2);

It corresponds to this graph : A-B-C-D-E-F. To ensure they all have a bubble size of 1, the best solution is to remove B-C and D-E, however the solution returns C-D, A-B and D-E.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions