Skip to content

subgraph.find_subgraph has unexpected behaviour if some nodes are disconnected. Only nodes assocaited to at least one edge are embedded #254

@jackraymond

Description

@jackraymond

Description
subgraph fails to find an embedding if source graph contains nodes without edges.
This is a pathological case, but worth protecting against.

To Reproduce

S = nx.Graph()
S.add_node_from(1)
T = S.copy()
emb = minorminer.subgraph.find_subgraph(S, T)
# emb is an empty list, not {1: 1} as expected

Expected behavior
A graph that includes disconnected nodes should be embeddable if the connected components are embeddable and there are sufficiently many total nodes.

Environment:

  • OS: [Ubuntu 16.04.4 LTS]
  • Python version: [e.g. 3.7.0]

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions