phylox.base.find_unused_node

phylox.base.find_unused_node(network, exclude=[])

Find an unused node in the network.

Parameters:
  • network (networkx.DiGraph) – The network to find an unused node in.

  • exclude (list) – A list of additional nodes to exclude from the search.

Returns:

The unused node.

Return type:

int

Examples

>>> import networkx as nx
>>> import phylox
>>> network = nx.DiGraph()
>>> network.add_edges_from([(0, 1), (1, 2), (2, 3)])
>>> phylox.find_unused_node(network)
-1
>>> phylox.find_unused_node(network, exclude=[-1])
-2