stk.Edge
- class stk.Edge(id, vertex1, vertex2, periodicity=(0, 0, 0), position=None)[source]
Bases:
object
Represents an edge in a topology graph.
Initialize an
Edge
instance.- Parameters:
id (
int
) – The id of the edge.vertex1 (
Vertex
) – The first vertex the edge is connected to.vertex2 (
Vertex
) – The second vertex the edge is connected to.periodicity (
tuple
ofint
, optional) – The periodicity of the edge, when going from vertex1 to vertex2. For example, if(0, 0, 0)
the edge is not periodic, if(1, 0, -1)
the edge is periodic going in the positive direction along the x axis, is not periodic across the y axis and is periodic in the negative direction along the z axis.position (
numpy.ndarray
, optional) – The position of the edge, ifNone
, the midpoint of the vertices is used.
Methods
Return a clone.
Get the id of the edge.
Get the periodicity of the edge.
Get the position.
Get the id of the first vertex.
Get the id of the second vertex.
Yield the ids of the vertices connected by the edge.
Return
True
if periodic.Return a clone at position.
Return a clone with a scaled position.
- clone()[source]
Return a clone.
- Returns:
The clone. Has the same type as the original edge.
- Return type:
- get_vertex1_id()[source]
Get the id of the first vertex.
- Returns:
The id of the first vertex.
- Return type:
- get_vertex2_id()[source]
Get the id of the second vertex.
- Returns:
The id of the second vertex.
- Return type:
- get_vertex_ids()[source]
Yield the ids of the vertices connected by the edge.
The id of the first vertex is yielded first, followed by the id of the second vertex.
- with_position(position)[source]
Return a clone at position.
- Parameters:
position (
numpy.ndarray
) – The desired position of the clone.- Returns:
The clone. Has the same type as the original edge.
- Return type:
- with_scale(scale)[source]
Return a clone with a scaled position.
- Parameters:
scale (
float
ortuple
offloat
) – The value by which the position of theEdge
is scaled. Can be a single number if all axes are scaled by the same amount or atuple
of three numbers if each axis is scaled by a different value.- Returns:
The clone. Has the same type as the original edge.
- Return type: