dwave_networkx.algorithms.elimination_ordering.is_almost_simplicial#

is_almost_simplicial(G, n)[source]#

Determines whether a node n in G is almost simplicial.

Parameters:
  • G (NetworkX graph) – The graph on which to check whether node n is almost simplicial.

  • n (node) – A node in graph G.

Returns:

is_almost_simplicial – True if all but one of its neighbors induce a clique

Return type:

bool

Examples

This example checks whether node 0 is simplicial or almost simplicial for a \(K_5\) complete graph with one edge removed.

>>> K_5 = nx.complete_graph(5)
>>> K_5.remove_edge(1,3)
>>> dnx.is_simplicial(K_5, 0)
False
>>> dnx.is_almost_simplicial(K_5, 0)
True