cgexplore.scram.TopologyCode

class cgexplore.scram.TopologyCode(idx, vertex_map)[source]

Bases: object

Naming convention for topology graphs.

Methods

contains_doubles

True if the graph contains "double-walls".

contains_parallels

True if the graph contains "1-loops".

contains_xs

True if the graph contains cycles of size x.

get_as_string

Convert TopologyCode to string of the vertex map.

get_graph

Convert TopologyCode to a graph.

get_layout

Take a graph and generate a layout from graph vertex positions.

get_number_connected_components

Get the number of connected components.

get_nx_graph

Convert TopologyCode to a networkx graph.

get_weighted_graph

Convert TopologyCode to a graph.

Attributes

Parameters:
contains_doubles()[source]

True if the graph contains “double-walls”.

Return type:

bool

contains_parallels()[source]

True if the graph contains “1-loops”.

Return type:

bool

contains_xs(x)[source]

True if the graph contains cycles of size x.

Important

Warning: This does not currently handle repeated cycles, inverse cycles and shifted cycles.

Parameters:

x (int)

Return type:

bool

get_as_string()[source]

Convert TopologyCode to string of the vertex map.

Return type:

str

get_graph()[source]

Convert TopologyCode to a graph.

Return type:

PyGraph

get_layout(layout_type, scale)[source]

Take a graph and generate a layout from graph vertex positions.

Important

Warning: There is no guarantee the graph layout will give identical coordinates in multiple runs.

Parameters:
  • layout_type (str) – Which networkx layout to use (of spring, kamada, spectral).

  • scale (float) – Scale factor to apply to eventual constructed molecule.

Returns:

Vertex positions.

Return type:

dict[int, ndarray[tuple[Any, …], dtype[float64]]]

get_number_connected_components()[source]

Get the number of connected components.

Return type:

int

get_nx_graph()[source]

Convert TopologyCode to a networkx graph.

Return type:

Graph

get_weighted_graph()[source]

Convert TopologyCode to a graph.

Return type:

PyGraph

idx: int
vertex_map: Sequence[tuple[int, int]]