Skip to content

graph

7 motifs. Import them from geomotif.motifs, or build one by name with registry.create("graph.bipartite").

graph.bipartite

graph.bipartite

Two rows of nodes, and every line from one row to the other.

from geomotif import save_svg
from geomotif.motifs import BipartiteGraph

motif = BipartiteGraph()
save_svg(motif.build(), "graph.bipartite.svg", width=320, height=320)
geomotif render graph.bipartite --out graph.bipartite.svg
{
  "geomotif": "1.3.1",
  "motif": "graph.bipartite",
  "params": {
    "merge": false,
    "show_nodes": false,
    "left": 4,
    "right": 5,
    "span": 200.0,
    "height": 220.0,
    "center": [
      0.0,
      0.0
    ]
  }
}
Parameters
Name Type Default
left int 4
right int 5
span float 200.0
height float 220.0
center Point (0.0, 0.0)
merge bool False
show_nodes bool False

graph.chord

graph.chord

Nodes on a circle and whichever chords you name between them.

from geomotif import save_svg
from geomotif.motifs import ChordDiagram

motif = ChordDiagram()
save_svg(motif.build(), "graph.chord.svg", width=320, height=320)
geomotif render graph.chord --out graph.chord.svg
{
  "geomotif": "1.3.1",
  "motif": "graph.chord",
  "params": {
    "merge": false,
    "show_nodes": true,
    "order": 16,
    "chords": [
      [
        0,
        7
      ],
      [
        0,
        9
      ],
      [
        1,
        5
      ],
      [
        2,
        11
      ],
      [
        3,
        8
      ],
      [
        3,
        14
      ],
      [
        4,
        10
      ],
      [
        5,
        13
      ],
      [
        6,
        12
      ],
      [
        7,
        15
      ],
      [
        8,
        2
      ],
      [
        9,
        4
      ],
      [
        10,
        1
      ],
      [
        11,
        6
      ],
      [
        12,
        3
      ],
      [
        13,
        0
      ]
    ],
    "radius": 120.0,
    "rotation": 1.5707963267948966,
    "center": [
      0.0,
      0.0
    ]
  }
}
Parameters
Name Type Default
order int 16
chords tuple[tuple[int, int], ...] ((0, 7), (0, 9), (1, 5), (2, 11), (3, 8), (3, 14), (4, 10), (5, 13), (6, 12), (7, 15), (8, 2), (9, 4), (10, 1), (11, 6), (12, 3), (13, 0))
radius float 120.0
rotation float 1.5707963267948966
center Point (0.0, 0.0)
show_nodes bool True
merge bool False

graph.complete

graph.complete

Every node joined to every other: K5, K12, and the ones in between.

from geomotif import save_svg
from geomotif.motifs import CompleteGraph

motif = CompleteGraph()
save_svg(motif.build(), "graph.complete.svg", width=320, height=320)
geomotif render graph.complete --out graph.complete.svg
{
  "geomotif": "1.3.1",
  "motif": "graph.complete",
  "params": {
    "merge": false,
    "show_nodes": false,
    "order": 12,
    "radius": 120.0,
    "rotation": 1.5707963267948966,
    "center": [
      0.0,
      0.0
    ]
  }
}
Parameters
Name Type Default
order int 12
radius float 120.0
rotation float 1.5707963267948966
center Point (0.0, 0.0)
merge bool False
show_nodes bool False

graph.cyclic

graph.cyclic

The circulant: join every node to the ones a fixed number of steps away.

from geomotif import save_svg
from geomotif.motifs import CyclicGraph

motif = CyclicGraph()
save_svg(motif.build(), "graph.cyclic.svg", width=320, height=320)
geomotif render graph.cyclic --out graph.cyclic.svg
{
  "geomotif": "1.3.1",
  "motif": "graph.cyclic",
  "params": {
    "merge": false,
    "show_nodes": false,
    "order": 16,
    "steps": [
      1,
      3,
      5
    ],
    "radius": 120.0,
    "rotation": 1.5707963267948966,
    "center": [
      0.0,
      0.0
    ]
  }
}
Parameters
Name Type Default
order int 16
steps tuple[int, ...] (1, 3, 5)
radius float 120.0
rotation float 1.5707963267948966
center Point (0.0, 0.0)
merge bool False
show_nodes bool False

graph.prime-chords

graph.prime-chords

Join two numbers whenever they add up to a prime.

from geomotif import save_svg
from geomotif.motifs import PrimeChords

motif = PrimeChords()
save_svg(motif.build(), "graph.prime-chords.svg", width=320, height=320)
geomotif render graph.prime-chords --out graph.prime-chords.svg
{
  "geomotif": "1.3.1",
  "motif": "graph.prime-chords",
  "params": {
    "merge": false,
    "show_nodes": false,
    "limit": 60,
    "radius": 120.0,
    "rotation": 1.5707963267948966,
    "center": [
      0.0,
      0.0
    ]
  }
}
Parameters
Name Type Default
limit int 60
radius float 120.0
rotation float 1.5707963267948966
center Point (0.0, 0.0)
merge bool False
show_nodes bool False

modular.addition

modular.addition

Join each number to the one a fixed distance further round.

from geomotif import save_svg
from geomotif.motifs import ModularAddition

motif = ModularAddition()
save_svg(motif.build(), "modular.addition.svg", width=320, height=320)
geomotif render modular.addition --out modular.addition.svg
{
  "geomotif": "1.3.1",
  "motif": "modular.addition",
  "params": {
    "merge": false,
    "show_nodes": false,
    "modulus": 120,
    "addend": 37,
    "radius": 120.0,
    "rotation": 1.5707963267948966,
    "center": [
      0.0,
      0.0
    ]
  }
}
Parameters
Name Type Default
modulus int 120
addend int 37
radius float 120.0
rotation float 1.5707963267948966
center Point (0.0, 0.0)
merge bool False
show_nodes bool False

modular.multiplication

modular.multiplication

The times table drawn as chords, which turns out to be a cardioid.

from geomotif import save_svg
from geomotif.motifs import ModularMultiplication

motif = ModularMultiplication()
save_svg(motif.build(), "modular.multiplication.svg", width=320, height=320)
geomotif render modular.multiplication --out modular.multiplication.svg
{
  "geomotif": "1.3.1",
  "motif": "modular.multiplication",
  "params": {
    "merge": false,
    "show_nodes": false,
    "modulus": 200,
    "factor": 2,
    "radius": 120.0,
    "rotation": 3.141592653589793,
    "center": [
      0.0,
      0.0
    ]
  }
}
Parameters
Name Type Default
modulus int 200
factor int 2
radius float 120.0
rotation float 3.141592653589793
center Point (0.0, 0.0)
merge bool False
show_nodes bool False