Interface GetPoly<E, V, D>

This pair of functions describes how to turn your graph's vertices and edges into production numbers.

If your application has the following graph...

type Edge = {from: string, to: string, each: number}
const vertices = new Map([['drone', 3], ['meat', 2]])
const edges: readonly Edge[] = [{from: 'drone', to: 'meat', each: 5}]

...here's what you pass to production functions:

const getters: GetPoly<Edge, string, number> = {
each: (edge: Edge) => edge.each,
count: (vertex: string) => vertices.get(vertex),
}

Production graphs can be any shape you like, any format you like, as long as your GetPoly functions correctly describe how to count each node and how much each edge produces.

interface GetPoly<E, V, D> {
    count: ((vertex) => undefined | null | D);
    each: ((edge) => D);
}

Type Parameters

  • E

  • V

  • D

Properties

Properties

count: ((vertex) => undefined | null | D)

How many of this thing exist at t=0? null or undefined if no such vertex exists.

Type declaration

    • (vertex): undefined | null | D
    • How many of this thing exist at t=0? null or undefined if no such vertex exists.

      Parameters

      • vertex: V

      Returns undefined | null | D

each: ((edge) => D)

How many children does each parent produce per second?

Type declaration

    • (edge): D
    • How many children does each parent produce per second?

      Parameters

      • edge: E

      Returns D

Generated using TypeDoc