src.embedding package

Submodules

src.embedding.embedding module

class src.embedding.embedding.Embedding(H: src.graph.undirected_graph.UndirectedGraphAdjList)

Bases: object

add_chain_to_used_nodes(from_node, to_node, to_node_new=None)

Adds a new chain. Does NOT check if this chain is even possible in the graph at the moment. TODO: “insource” the check to this class

embed_edge(node_from, node_to) None
embed_edge_with_mapping(from_H, from_G, to_H, to_G) None
exists_edge(frm, to)
extend_one_node_to_chain(frm, to, extend_G)

Extends one node to a chain.

Note that en edge from replace_G to frm must be viable. TODO: add a check

get_connected_neighbors(from_node) list
get_embedded_nodes() list[int]

Returns all embedded nodes.

Returns

The embedded nodes.

Return type

list[int]

get_embedding(G_to_H_mapping=True)
get_free_neighbors(from_node) list
get_mapping_G_to_H()
get_mapping_H_to_G()
get_mapping_H_to_G_node(node_H) set
get_playground()
get_reachable_neighbors(from_node)
is_valid_embedding() bool
remove_edge_inconsistently(from_node, to_node)
try_to_add_missing_edges() int

Tries to add missing edges if possible.

Return type

How many missing edges were successfully added.

exception src.embedding.embedding.NoFreeNeighborNodes(from_node)

Bases: Exception

src.embedding.graph_mapping module

class src.embedding.graph_mapping.GraphMapping

Bases: object

Invertable unique dict using sets as values to encode the mapping between the small view of a graph and the big view.

add_mapping_new_node_H(node_G: int)
extend_mapping(node_H: int, node_G: int)
get_mapping_G_to_H()
get_mapping_H_to_G()
get_node_G(node_H)
get_node_H(node_G)
remove_mapping(node_H: int, node_G: int)
set_mapping(node_H: int, node_G: int)

Module contents