pykappa.pattern¶
Classes
|
Represents an agent with a type and collection of sites. |
|
A set of agents that are all in the same connected component. |
Dictionary representing a mapping from pattern agents to mixture agents. |
|
|
A pattern consisting of multiple agents, some of which may be None (empty slots). |
|
A site on an agent with state and binding partner information. |
- class pykappa.pattern.Site(label, state, partner)[source]¶
A site on an agent with state and binding partner information.
- Parameters:
label (str)
state (str)
partner (str | _TypedPartner | int | Site)
- label: str¶
Name of the site
- state: str¶
Internal state of the site
- property kappa_str: str¶
- property instantiable: bool¶
Check if a concrete Site can be created from this pattern.
- property bound: bool¶
- class pykappa.pattern.Agent(type, sites)[source]¶
Represents an agent with a type and collection of sites.
- Parameters:
type (str)
sites (Iterable[Site])
- static neighborhood(agents, radius)[source]¶
Get all agents within a distance radius of the given agents.
- classmethod from_kappa(kappa_str)[source]¶
Parse a single agent from a Kappa string.
- Raises:
AssertionError – If the string doesn’t describe exactly one agent.
- Parameters:
kappa_str (str)
- Return type:
Self
- type: str¶
Type name of the agent
- property kappa_str¶
- property instantiable: bool¶
Check if a concrete Agent can be created from this pattern.
- property neighbors: list[Self]¶
The agents directly connected to this one.
- class pykappa.pattern.Embedding[source]¶
Dictionary representing a mapping from pattern agents to mixture agents.
- class pykappa.pattern.Component(agents)[source]¶
A set of agents that are all in the same connected component.
Note
Connectedness is not guaranteed statically and must be enforced.
- Parameters:
agents (IndexedSet[Agent])
- classmethod from_kappa(kappa_str)[source]¶
Parse a single component from a Kappa string.
- Raises:
AssertionError – If the pattern doesn’t represent exactly one component.
- Parameters:
kappa_str (str)
- Return type:
Self
- property kappa_str: str¶
- isomorphisms(other)[source]¶
Find bijections which respect links in the site graph.
Checks for bijections ensuring that any internal site state specified in one component exists and is the same in the other.
Note
Handles isomorphism generally, between instantiated components in a mixture and potentially between rule patterns.
- property diameter: int¶
Get the maximum minimum shortest path between any two agents.
- class pykappa.pattern.Pattern(agents)[source]¶
A pattern consisting of multiple agents, some of which may be None (empty slots).
- Parameters:
agents (list[Agent | None])
- classmethod from_kappa(kappa_str)[source]¶
- Raises:
AssertionError – If the string doesn’t describe exactly one pattern.
- Parameters:
kappa_str (str)
- Return type:
Self
- property kappa_str: str¶
- property instantiable: bool¶
Check if all agents in the pattern are specific enough to instantiate.