Skip to content

Graph linking strategy

LinkNodesWithinGraph

Builder class for linking nodes within one graph, through which we can access linking strategies.

by_value(strategy)

Notes that we want to connect nodes based on values and strategy.

seasonalities(period)

Notes that we want to connect based on seasonalities, ad sets the period parameter.

StrategyLinkingGraph

Links nodes within graph.

Attributes:

  • graph: networkx.Graph object
  • strategy_precedence: tells in which order should the strategies be excetuted

StrategyLinkingGraphBySeasonalities

Bases: StrategyLinkingGraph

Links all nodes that are sequentially self.period apart.

Attributes:

  • period: tells how far apart must two nodes be to be linked

StrategyLinkingGraphByValue

Bases: StrategyLinkingGraph

Links nodes based on their value.

StrategyLinkingGraphByValueWithinRange

Bases: StrategyLinkingGraphByValue

Links nodes whose value difference is within range of allowed difference.

Attributes:

  • allowed_difference: tells us the allowed difference between values of two nodes for the nodes to be linked together