snarlpy modules

snarlpy.cycle_sampling

snarlpy.cycle_sampling.generate_networkx_cycle_from_edges(edge_set, input_graph)[source]

Generate networkx.Graph object representing a basis cycle from a given edge subset.

Args:

edge_set (list):

The binary edge vector representing the cycle.

input_graph (networkx.Graph):

The original simple graph used for reduction.

Returns:

networkx.Graph:

A simple eulerian cycle.

snarlpy.cycle_sampling.generate_random_coordinate(nullity)[source]

Generate a binary sequence vector of length ‘nullity’.

Args:

nullity (int):

The cyclomatic number determining the length of the binary vector.

Returns:

list:

A binary vector for cycle sampling from a set of cardinality ‘nullity’.

snarlpy.cycle_sampling.generate_random_index(nullity)[source]

Generate an index vector for sampling from a cycle basis of cardinality ‘nullity’.

Args:

nullity (int):

The cyclomatic number determining the length of the binary vector.

Returns:

list:

An index vector for cycle sampling from a set of cardinality ‘nullity’.

snarlpy.cycle_sampling.get_binary(j, a)[source]

Generate a binary sequence vector of length a.

Args:

j (int):

The j-th binary to generate.

a (int):

The cyclomatic number deterining the vector length/scope.

Returns:

list:

A binary vector for further cycle sampling processes.

snarlpy.cycle_sampling.get_keyNumbers_forBinary(null, iteration)[source]

Sample a random index from the cycle space of a graph with nullity ‘null’. Args:

null (int):

The cyclomatic number determining the the exponential size of the cycle space.

iteration (int):

Sample size.

Returns:

iterable:

An index vector for cycle sampling from a set of basis cardinality ‘null’.

snarlpy.cycle_sampling.get_new_cycle(new_key, cycle_matrix, backbone_graph)[source]

Generate a new networkx.Graph object, representing a cycle from a given graph, its cycle basis and a binary coefficient vector.

Args:

new_key (int):

The binary coefficient vectorto generate a cycle superpostion.

cycle_matrix (int):

The graph’s mesh matrix for a given cycle basis.

backbone_graph (int):

The input graph used to reconstruct a full networkx.Graph object

Returns:

networkx.Graph:

A simple eulerian cycle.

snarlpy.cycle_sampling.get_new_cycle_components(edge_set, edge_matrix, nx_cycle, backbone_graph)[source]

Generate a new networkx.Graph object, representing a cycle from a given graph, its cycle basis and a binary coefficient vector.

Args:

edge_set (list):

A list of all edges in the simple graph.

edge_matrix (list):

The binary mesh matrix of the graph.

nx_cycle (networkx.Graph):

The networx.Graph object representing a Eulerian cycle.

backbone_graph (networkx.Graph):

The original simple graph used for reduction.

Returns:

ndarray:

The coefficient vector for given cycle in the current cycle basis.

networkx.Graph:

The rebuild of the given Eulerian cycle for simplification.

snarlpy.cycle_sampling.get_new_cycle_components_gamma(edge_set, edge_matrix, key, backbone_graph)[source]

Generate a new networkx.Graph object, representing a cycle from a given graph, its cycle basis and a binary coefficient vector.

Args:

edge_set (list):

A list of all edges in the simple graph.

edge_matrix (list):

The binary mesh matrix of the graph.

key (networkx.Graph):

An index list indicating which cycles are to be superimposed.

backbone_graph (networkx.Graph):

The original simple graph used for reduction.

Returns:

ndarray:

The coefficient vector for given cycle in the current cycle basis.

networkx.Graph:

The rebuild of the given Eulerian cycle for simplification.

snarlpy.cycle_sampling.grab_all_cycles_from_space(*args)[source]

Generate and catch all cycle space coefficient vectors. (CAREFUL CYCLE SPACES HAVE EXPONENTIAL COMPLEXITY, ONLY USE FOR SMALL CYCLOMATIC NUMBERS)

Args:

args (list):

A list of cyclomatic numbers.

Returns:

iterable:

A list of binary vectors for further cycle sampling processes.

snarlpy.cycle_sampling.grab_cycles_from_space(*args)[source]

Generate random cycle space coefficient vectors.

Args:

args (list):

A list of cyclomatic numbers.

Returns:

iterable:

A list of binary vectors for further cycle sampling processes.

snarlpy.cycleToolsLinking

class snarlpy.cycleToolsLinking.linkedCycles_extraTools[source]

Bases: linkedCycles_tools

A class f function tools to compte linking of cycle basis of simple, spatially embedded graphs. Attributes:

tck (dict):

Spline parameters for curve smoothening

edge_res (int):

Edge point resolution.

XS (list):

Array of curve parameters (0,1) for edge point densification.

N (int):

???

res (int):

Numeric resoltuion of Gauss map (double integral) evaluation.

threshold (float):

Linkage number demanded accuracy.

limit (int):

Internal limit numbers.

lm (list):

List of internal limit numbers.

itvl (list):

Double integral borders.

x (list):

An array holding curve parameters for smoothened curves.

dxy (float):

Double integral infinitesimal square factor.

Methods:
__post_init__()

The model post_init function.

calc_linkage_cycleSets_nxGraph(cycle_sets1, cycle_sets2)

Compute the linkage dictionaries in boolean and numeric form for two sets of cycle bases (in networkx format).

extract_points_nxGraph(cycle_sets1, cycle_sets2)

Extract the polygonial representation of each edge of the given graph sets.

calc_linkage_cycleSets_points3D(curves_set1, curves_set2)

Compute the linkage dictionaries in boolean and numeric form for two sets of cycle bases (in polygonial format).

calc_linkage_points3D(curves_set1, curves_set2)

Compute the linkage of polygonial curves in 3D via the Gauss map for each cycle pairing.

get_geoInfo(curve_sets)

Compute cycle centers and maximal point distance from center (For pre-sorting spatially distant cycles which cant’possibly be linked)

compute_link_number(curve1, curve2):

Compute the specific link for a pair of curves, via Gauss map evaluation.

get_smooth_curve(points3D)

Smoothing of polygonial curves in order to improve results for sharp bending points and fourther function generator dependencies.

refine_curve_points(points3D)

Increase point density of the graph’sedges, by inserting extra points along the line segments.

get_smooth_points(t, tck)

Create a smooth 3D point representation by utilizing previoulsy calucalted spline parameters and current curve parameters.

get_smooth_director(t, tck):

Create a smooth 3D point representation of the curves tangent by utilizing previoulsy calucalted spline parameters and current curve parameters.

gauss_map(points, tangents)

Gauss map evaluation utilizing the entirety of curve points and their tangents (equal to entire double integral kernel evaluation).

compute_link_number(curve1, curve2)

Compute the linking number of two closed curves (3D point representation).

Compute the linking number of two closed curves (3D point representation).

Args:

curve_1 (list):

A list of 3D-point sets representing a cycle of graph #1.

curve_2 (list):

A list of 3D-point sets representing a cycle of graph #2.

Returns:

dict:

A dictionary containing the numeric value of the linking number integral (Gauss map).

gauss_map(x1, x2, p12, t, t12)[source]

Gauss mappiecewise linear bits of the entire closed super-curves.

Args:
x1 (float):

Curve parameter #1.

x2 (float):

Curve parameter #2.

p12 (ndarray):

Anchor point difference.

t (list):

A list of ndarrays representing the current edge tangent vector.

p12 (ndarray):

Anchor point difference.

Returns:

float:

The evaluated, non-rounded value of the Gauss map kernel bit.

class snarlpy.cycleToolsLinking.linkedCycles_tools[source]

Bases: simple_cycles

A class f function tools to compte linking of cycle basis of simple, spatially embedded graphs. Attributes:

tck (dict):

Spline parameters for curve smoothening

edge_res (int):

Edge point resolution.

XS (list):

Array of curve parameters (0,1) for edge point densification.

N (int):

???

res (int):

Numeric resoltuion of Gauss map (double integral) evaluation.

threshold (float):

Linkage number demanded accuracy.

x (list):

An array holding curve parameters for smoothened curves.

dxy (float):

Double integral infinitesimal square factor.

Methods:
__post_init__()

The model post_init function.

calc_linkage_cycleSets_nxGraph(cycle_sets1, cycle_sets2)

Compute the linkage dictionaries in boolean and numeric form for two sets of cycle bases (in networkx format).

extract_points_nxGraph(cycle_sets1, cycle_sets2)

Extract the polygonial representation of each edge of the given graph sets.

calc_linkage_cycleSets_points3D(curves_set1, curves_set2)

Compute the linkage dictionaries in boolean and numeric form for two sets of cycle bases (in polygonial format).

calc_linkage_points3D(curves_set1, curves_set2)

Compute the linkage of polygonial curves in 3D via the Gauss map for each cycle pairing.

get_geoInfo(curve_sets)

Compute cycle centers and maximal point distance from center (For pre-sorting spatially distant cycles which cant’possibly be linked)

compute_link_number(curve1, curve2):

Compute the specific link for a pair of curves, via Gauss map evaluation.

get_smooth_curve(points3D)

Smoothing of polygonial curves in order to improve results for sharp bending points and fourther function generator dependencies.

refine_curve_points(points3D)

Increase point density of the graph’sedges, by inserting extra points along the line segments.

get_smooth_points(t, tck)

Create a smooth 3D point representation by utilizing previoulsy calucalted spline parameters and current curve parameters.

get_smooth_director(t, tck):

Create a smooth 3D point representation of the curves tangent by utilizing previoulsy calucalted spline parameters and current curve parameters.

gauss_map(points, tangents)

Gauss map evaluation utilizing the entirety of curve points and their tangents (equal to entire double integral kernel evaluation).

calc_linkage_cycleSets_nxGraph(cycle_sets1, cycle_sets2)[source]

Compute the linkage dictionaries in boolean and numeric form for two sets of cycle bases (in networkx format).

Args:

cycle_sets1 (list):

A list of networkx.Graph objects representing the cycle basis of graph #1.

cycle_sets2 (list):

A list of networkx.Graph objects representing the cycle basis of graph #2.

Returns:

dict:

A dictionary containing the boolean value of linkage for each cycle pair of the input bases.

dict:

A dictionary containing the numeric value of linkage (Gauss map) for each cycle pair of the input bases.

calc_linkage_cycleSets_points3D(curves_set1, curves_set2)[source]

Compute the linkage dictionaries in boolean and numeric form for two sets of cycle bases (in polygonial format).

Args:

cycle_sets1 (list):

A list of 3D-point sets representing the cycle basis of graph #1.

cycle_sets2 (list):

A list of 3D-point sets representing the cycle basis of graph #2.

Returns:

dict:

A dictionary containing the boolean value of linkage for each cycle pair of the input bases.

dict:

A dictionary containing the numeric value of linkage (Gauss map) for each cycle pair of the input bases.

calc_linkage_points3D(curves_set1, curves_set2)[source]

Compute the linkage of polygonial curves in 3D via the Gauss map for each cycle pairing.

Args:

cycle_sets1 (list):

A list of 3D-point sets representing the cycle basis of graph #1.

cycle_sets2 (list):

A list of 3D-point sets representing the cycle basis of graph #2.

Returns:

dict:

A dictionary containing the numeric value of linkage (Gauss map) for each cycle pair of the input bases.

Compute the specific link for a pair of curves, via Gauss map evaluation.

Args:

curve_1 (list):

A list 3D points (ordered) forming a closed curve (cycle #1).

curve_1 (list):

A list 3D points (ordered) forming a closed curve (cycle #2).

Returns:

float:

Non-rounded result of numeric double integral evaluation.

extract_points_nxGraph(cycle_sets1, cycle_sets2)[source]

Extract the polygonial representation of each edge of the given graph sets.

Args:

cycle_sets1 (list):

A list of networkx.Graph objects representing the cycle basis of graph #1.

cycle_sets2 (list):

A list of networkx.Graph objects representing the cycle basis of graph #2.

Returns:

list:

A list of polygons for each input basis representing the spatially embeded curve for each basis cycle.

gauss_map(points, tangents)[source]

Gauss map evaluation utilizing the entirety of curve points and their tangents (equal to entire double integral kernel evaluation).

Args:

points (list):

A list of 3D points as part of the smooth curve representation, for each cyce.

tangents (tuple):

A list 3D points as part of the smooth curve representation, for each cycle.

Returns:

float:

The evaluated, non-rounded value of the Gauss map kernel.

get_geoInfo(curve_sets)[source]

Compute cycle centers and maximal point distance from center (For pre-sorting spatially distant cycles which cant’possibly be linked)

Args:

curve_sets (list):

A list of polygons for each input basis representing the spatially embeded curve for each basis cycle.

Returns:

dict:

A dictionary containing cycle centers for each cycle basis (3D points)

dict:

A dictionary containing maximal point distance from the center for each cycle basis.

get_smooth_curve(points3D)[source]

Smoothing of polygonial curves in order to improve results for sharp bending points and fourther function generator dependencies.

Args:

points3D (list):

A list 3D points (ordered) forming a closed curve.

Returns:

tuple:

(t,c,k) a tuple containing the vector of knots, the B-spline coefficients, and the degree of the spline.

get_smooth_director(t, tck)[source]

Create a smooth 3D point representation of the curves tangent by utilizing previoulsy calucalted spline parameters and current curve parameters.

Args:

t (list):

Current curve parameter.

tck (tuple):

(t,c,k) a tuple containing the vector of knots, the B-spline coefficients, and the degree of the spline.

Returns:

ndarrray:

A 3D point as part of the smooth curve representation.

get_smooth_points(t, tck)[source]

Create a smooth 3D point representation by utilizing previoulsy calucalted spline parameters and current curve parameters.

Args:

t (list):

Current curve parameter.

tck (tuple):

(t,c,k) a tuple containing the vector of knots, the B-spline coefficients, and the degree of the spline.

Returns:

ndarrray:

A 3D point as part of the smooth curve representation.

refine_curve_points(points3D)[source]

Increase point density of the graph’sedges, by inserting extra points along the line segments.

Args:

points3D (list):

A list 3D points (ordered) forming a closed curve, each consecutive tuple represents an edge from the graph.

Returns:

list:

Denser 3D point representation of closed curves.

snarlpy.edge_algebra

snarlpy.edge_algebra.calc_echelon_form(Ax)[source]

Compute the echelon form of a given binary equations system and checking for inconsistencies and solutions of the key problem.

Args:

Ax (ndarray):

A given binary equation system, used for linear independence tests of Eulerian cycles.

Returns:

ndarray:

The last column of the echelon, indicating whether the column vectors are linear independent or not.

snarlpy.edge_algebra.check_superposition_edge_connected(keys, edge_matrix)[source]

Compute cycle superpostion with consectuive test whether the cycles generated during superposition are connected.

Args:

keys (list):

An index list indicating which cycles are to be superimposed.

cycle_matrix (ndarray):

The binary edge vectors of all cycles bundled into one matrix (technically the graph’s mesh matrix).

Returns:

bool:

True or False, depending on whether the cycles generated during superposition are connected.

snarlpy.edge_algebra.edge_column(c, edge_set, sig_graph)[source]

Compute the signature-sensitive edge vector representation of a given cycle.

Args:

c (networkx.Graph):

A networkx.Graph representing a Eulerian cycle in the simple graph.

edge_set (list):

A list of all edges in the simple graph.

sig_graph (dict):

A dictionary holding the information on the graph’s intrinsic edge signatures (directions) for comparison with cycle edge directions.

Returns:

nadarray:

The signature-sensitive edge vector representation of the given cycle.

snarlpy.edge_algebra.edge_column_binary(c, edge_set)[source]

Compute the binary edge vector representation of a given cycle.

Args:

c (networkx.Graph):

A networkx.Graph representing a Eulerian cycle in the simple Graph.

edge_set (list):

A list of all edges in the simple graph.

Returns:

nadarray:

The binary edge vector representation of the given cycle.

snarlpy.edge_algebra.edge_column_rand(c, edge_set, sig_graph)[source]

Compute the signature-sensitive edge vector representation of a given cycle. Randomize the initial node for the ycle’s signature computation.

Args:

c (networkx.Graph):

A networkx.Graph representing a Eulerian cycle in the simple graph.

edge_set (list):

A list of all edges in the simple graph.

sig_graph (dict):

A dictionary holding the information on the graph’s intrinsic edge signatures (directions) for comparison with cycle edge directions.

Returns:

nadarray:

The signature-sensitive edge vector representation of the given cycle.

snarlpy.edge_algebra.generate_edge_matrix(basis, edge_set, sig_graph)[source]

Compute the signature-sensitive edge vector representations of an entire cycle basis.

Args:

basis (list):

A list networkx.Graph objects, representing the Eulerian cycle basis of the simple graph.

edge_set (list):

A list of all edges in the simple graph.

sig_graph (dict):

A dictionary holding the information on the graph’s intrinsic edge signatures (directions) for comparison with cycle edge directions.

Returns:

nadarray:

The signature-sensitive edge vectors of all cycles bundled into one matrix (technically the graph’s mesh matrix)

snarlpy.edge_algebra.generate_edge_matrix_binary(basis, edge_set)[source]

Compute the binary edge vector representations of an entire cycle basis.

Args:

basis (list):

A list networkx.Graph objects, representing the Eulerian cycle basis of the simple graph.

edge_set (list):

A list of all edges in the simple graph.

Returns:

nadarray:

The binary edge vectors of all cycles bundled into one matrix (technically the graph’s mesh matrix).

snarlpy.edge_algebra.get_component_key(edge_vector, edge_matrix)[source]

For a given binary edge vector, compute its coefficient vector with respect to the currently used basis.

Args:

edge_vector (ndarray):

The binary edge vector presentation of an Eulerian cycle.

edge_matrix (ndarray):

The simple graph’s mesh matrix, representing the set of basis cycles.

Returns:

ndarray:

The coefficient vector for given cycle in the current cycle basis.

snarlpy.edge_algebra.get_cycle_superpositions_edge_vector(keys, cycle_matrix)[source]

Compute the edge vector of a cycle aquired from superposition of basis cycles.

Args:

keys (list):

An index list indicating which cycles are to be superimposed.

cycle_matrix (ndarray):

The binary edge vectors of all cycles bundled into one matrix (technically the graph’s mesh matrix).

Returns:

nadarray:

The signature-sensitive edge vectors of all cycles bundled into one matrix (technically the graph’s mesh matrix)

snarlpy.edge_algebra.sort_rows(column, idx, Ax)[source]

Resort rows, as part of acquiring the echelon form of the linear system Ax.

Args:

column (ndarray):

Current column index being processed.

idx (ndarray):

The current row processed that needs to be shifted.

Ax (ndarray):

A given binary equation system, used for linear independence tests of Eulerian cycles.

snarlpy.edgePriority

members:

show-inheritance:

snarlpy.edgePriorityCoarseSystem

snarlpy.snarlpyness_randRobustness

snarlpy.sampling

snarlpy.sampling.calc_basisIntertwinedness(graph_sets)[source]

Compute the first intertwinedness metrics (linkage matrices for arbitrary cycle bases).

Args:

grap_sets (list):

A list of networkx.Graph objects which posses a defined spatial embedding (nodal pos-attributes).

Returns:

list:

A list of the arbitrarily chosen cycle matrix for the graphs.

ndarray:

The linkage matrix of the graph set.

snarlpy.sampling.calc_basis_linkage(cycle_sets1, cycle_sets2)[source]

Compute the linkage dictionary for each cycle pair.

Args:

cycle_sets1 (list):

A list of networkx.Graph objects, represting the basis cycles of the input graph #1.

cycle_sets2 (list):

A list of networkx.Graph objects, represting the basis cycles of the input graph #2.

Returns:

dict:

The linkage dictionary, contaitning the non-rounded results of the Gauss-Map calculations for each cycle pair.

snarlpy.sampling.calc_cycle_basis(nx_graph)[source]

Compute a cycle basis of a simple graph via a bfs search algorithm.

Args:

nx_graph (networkx.Graph):

A simple graph.

Returns:

list:

A list of networkx.Graph objeccts, represting the basis cycles of the input graph.

snarlpy.sampling.calc_cycle_minimum_basis(nx_graph)[source]

Compute a minimal topological cycle basis of a simple graph via Horton’s algorithm.

Args:

nx_graph (networkx.Graph):

A simple graph.

Returns:

list:

A list of networkx.Graph objects, represting the basis cycles of the input graph.

snarlpy.sampling.calc_nullity(G)[source]

Compute a simple graph’s nullity/cyclomatic number.

Args:

G (networkx.Graph):

A simple graph.

Returns:

int:

The cyclomatic number of the graph.

snarlpy.sampling.extract_linkage_matrix(numeric_res)[source]

Compute the linkage matrix from raw, non-rounded resuts dict structure.

Args:

numeric_res (networkx.Graph):

The linkage dictionary, contaitning the non-rounded results of the Gauss-Map calculations for each cycle pair.

Returns:

ndarray:

The linkage matrix of two graphs in cycle per cycle representation.

snarlpy.sampling.get_basis_matrices(input_graphs, cyc_nx_base)[source]

Compute auxillary matrix sets for further computation intertwinedness metrics.

Args:

input_graphs (list):

A list of networkx.Graph objects which posses a defined spatial embedding (nodal pos-attributes).

cyc_nx_base (list):

A list of basis cycles for each graph.

Returns:

list:

A list of edge-tuples for each graph.

list:

The respective edge signatures for each graph.

list:

A list of (directed) mesh matrices for each graph.

list:

A list of (undirected) mesh matrices for each graph.

snarlpy.signature

snarlpy.signature.extract_eulerpath(nx_cycle, root)[source]

Extract the Eulerian path as an edge sequence from a cycle, given an arbitrary starting node.

Args:

nx_cycle (networkx.Graph):

A networkx.Graph object represeting a cycle.

nroot (networkx.Graph.node):

A networkx.Graph.node object to start the path search.

Returns:

iterable:

A sequence of edges (ordered)/ a walk along the cyle.

snarlpy.signature.get_edge_direction(edge_set)[source]

Setting the intrinsic direction for all edges in a given set.

Args:

edge-set (list):

A set of edges, with aplha and omega nodes non-equal.

Returns:

dict:

A dictionary holding the signature information for any edge in the set.

snarlpy.signature.get_relative_direction(edge, sig_graph)[source]

Getting the edge signature for an edge set in relation to a reference set.

Args:

edge-set (list):

A set of edges, with aplha and omega nodes non-equal.

sig_grapht (dict):

A dictionary holding the signature information for any edge in the reference graph.

Returns:

dict:

A dictionary holding the signature information for any edge in the set.

snarlpy.signature.get_signature(nx_cycle, sig_graph)[source]

Given a simple graph for reference, compute the edge signatures for the Eulerian path through the cycle.

Args:

nx_cycle (networkx.Graph):

A networkx.Graph object represeting a cycle.

sig_grapht (dict):

A dictionary holding the signature information for any edge in the reference graph.

Returns:

dict:

A dictionary holding the signature information for any edge in the cycle graph.

snarlpy.signature.get_signature_rand(nx_cycle, sig_graph)[source]

Given a simple graph for reference, compute the edge signatures for the Eulerian path through the cycle. Randomize the root node during path search.

Args:

nx_cycle (networkx.Graph):

A networkx.Graph object represeting a cycle.

sig_grapht (dict):

A dictionary holding the signature information for any edge in the reference graph.

Returns:

dict:

A dictionary holding the signature information for any edge in the cycle graph.

snarlpy.simpleCycles

class snarlpy.simpleCycles.simple_cycles(G=None)[source]

Bases: object

A class to generate cycle bases and create a minimal basis in networkx formats

Attributes

Gnx.Graph()

A simple graph which on which the cycle basis is calcuclated

breadth_first_tree(root)[source]

Return a bfs-tree from root, as well a dictionary of shortest paths between branching points and leaves.

Args:

root (int):

The root vertex for bfs search.

Returns:

nx.Graph:

The spanning tree from bfs search

dictionary:

A dicitonary of shortest paths between branching points and leaves.

compute_cycles_superlist(root)[source]

Returns an edge list of cycles drawn from a Horton cycle search for one vertex.

Args:

root (int): The root vertex of the current bfs tree

Returns:

list: The superlist of cycles from all bfs trees, in edge list representation

Raises:

Exception: description

compute_linear_independence(edge_mat)[source]

Return bool whether all columns of E are linear independent in Z2.

Args:

edge_mat (ndarray):

An ndarray representing a binary cycle matrix in Z2.

Returns:

bool:

Result indicating whether the columns are linear independent.

Raises:

Exception: description

compute_sprouts(root, T, labels, push_down, dict_path, queue)[source]

Update bfs push list and tree structure.

construct_minimum_basis()[source]

Return a cycle basis for the input graph, with all elements edge lists.

Args:

input_graph (nx.Graph):

A networkx graph

Returns:

list:

The minimal basis of the graph, represented by a list of edge lists.

Raises:

Exception: description

construct_networkx_basis(input_graph=None, root='random')[source]

Return a cycle basis for the input graph, with all elements edge lists.

Args:

input_graph (nx.Graph):

A networkx graph with ‘many’ cycles

Returns:

list:

The basis of the graph, represented by a list of networkx graphs.

construct_networkx_minimum_basis(input_graph=None)[source]

Return a minimum cycle basis for the input graph, with all elements edge lists.

Args:

input_graph (nx.Graph):

A networkx graph with ‘many’ cycles

Returns:

list:

The minimal basis of the graph, represented by a list of networkx graphs.

edge_matrix(nx_edges, minimum_label, new_cycle)[source]

Return a binary matrix for operations on Z2, representing current cycle candidates and a test cycle.

Args:

nx_edges (nx.Graph):

A networkx graph backbone being rebuilt with cycle base edges

minimum_label (list):

The labels sorting the edges in the binary cycle matrix.

new_cycle (list):

A list of edges of the cycle to be tested.

Returns:

ndarray: Numpy array representing a binary cycle matrix in Z2.

Raises:

Exception: description

extract_path_origin(cycle)[source]

Find and return an oriented closed edge walk on a simple cycle.

Args:

cycle (nx.Graph):

A networkx graph representing a simple Eulerian cycle.

Returns:

list:

A list of nodes, in order of the cyclic path.

find_cycle(dict_path, e, n)[source]

Returns an edge list, and node list for a cycle constructed from spanning tree + additional edge.

Args:

dict_path (dictionary):

A dictionary of shortest paths in the bfs tree

e (tuple):

The edge which is to be plugge into the bfs tree and generates a cycle.

n (int):

The root of the current bfs tree

Returns:

list:

A list of vertices for the new cycle

list:

A list of edges for the new cycle

generate_cycle_lists()[source]

Returns an edge list, and labeled dictionary of cycles drawn from a Horton cycle search for all vertices.

Returns:

dictionary:

A dictionary which of cycles generated from bfs searches

list:

a list of cycles represented by their edge sets

Raises

NotImplementedError

If no graph is initially set for the backbone Graph G.

snarlpy.tangledGenerators