The cycle basis module

Cycle Basis class.

class hcga.features.cycle_basis.CycleBasis(graph=None)[source]

Cycle Basis class.

Computes features based on the cycles in the graph.

A basis for cycles of a network is a minimal collection of cycles such that any cycle in the network can be written as a sum of cycles in the basis. Here summation of cycles is defined as “exclusive or” of the edges. Cycle bases are useful, e.g. when deriving equations for electric circuits using Kirchhoff’s Laws.

Uses networkx, see ‘https://networkx.org/documentation/stable/reference/algorithms/generated/ networkx.algorithms.cycles.cycle_basis.html`

References

1

Paton, K. An algorithm for finding a fundamental set of cycles of a graph. Comm. ACM 12, 9 (Sept 1969), 514-518.

Initialise a feature class.

Parameters

graph (Graph) – graph for initialisation, converted to given encoding

compute_features()[source]

Main feature extraction function.

This function should be used by each specific feature class to add new features.

hcga.features.cycle_basis.average_cycle_length(graph)[source]
hcga.features.cycle_basis.eval_cycle_basis(graph)[source]

this evaluates the main function and cach it for speed up.

hcga.features.cycle_basis.minimum_cycle_length(graph)[source]

Minimum cycle length returns 0 if graph is a tree.

hcga.features.cycle_basis.num_cycles(graph)[source]
hcga.features.cycle_basis.ratio_nodes_cycle(graph)[source]