chain
Bases: base_topology
Represents a chain topology, a linear sequence of connected nodes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
length
|
int
|
The number of nodes in the chain. Must be a positive integer. |
required |
name
|
str
|
The name of the topology, by default 'chain'. |
'chain'
|
bi_directional
|
bool
|
Specifies whether the chain is bidirectional. If True, links between nodes are bidirectional. By default, False (unidirectional). |
False
|
*args
|
tuple
|
Additional positional arguments to be passed to the |
()
|
**kwargs
|
dict
|
Additional keyword arguments to be passed to the |
{}
|
Raises:
Type | Description |
---|---|
ValueError
|
If |
Inherits From
base_topology The base class for topological structures.
Source code in tinybig/koala/topology/chain.py
__init__(length, name='chain', bi_directional=False, *args, **kwargs)
Initializes the chain topology.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
length
|
int
|
The number of nodes in the chain. Must be a positive integer. |
required |
name
|
str
|
The name of the topology, by default 'chain'. |
'chain'
|
bi_directional
|
bool
|
Specifies whether the chain is bidirectional. If True, links between nodes are bidirectional. By default, False (unidirectional). |
False
|
*args
|
tuple
|
Additional positional arguments to be passed to the |
()
|
**kwargs
|
dict
|
Additional keyword arguments to be passed to the |
{}
|
Raises:
Type | Description |
---|---|
ValueError
|
If |
Source code in tinybig/koala/topology/chain.py
length()
Returns the number of links in the chain, which corresponds to the size of the topology.
Returns:
Type | Description |
---|---|
int
|
The number of links in the chain. |