Karana.KUtils.MultibodyTUI.graph#

Classes for working with directed graphs.

Attributes#

T

Classes#

GraphAdapter

Common interface for various types of directed graphs.

BodyGraphAdapter

Multibody wrapper implementing the GraphAdapater interface.

FrameGraphAdapter

FrameContainer wrapper implementing the GraphAdapater interface.

Module Contents#

Karana.KUtils.MultibodyTUI.graph.T#
class Karana.KUtils.MultibodyTUI.graph.GraphAdapter[source]#

Bases: abc.ABC, Generic[T]

Common interface for various types of directed graphs.

The purpose of this class is to define a common interface for wrapper classes that adapt different graphs, each with their own interface, to a single common interface.

abstract parents(node: T, /) list[T][source]#

Get the list of parents for a given node.

abstract children(node: T, /) list[T][source]#

Get the list of children for a given node.

abstract nodes() list[T][source]#

Get the list of all nodes in the graph.

descendants(node: T, /) list[T][source]#

Get the list of all descendants for a given node.

ancestors(node: T, /) list[T][source]#

Get the list of all ancestors for a given node.

class Karana.KUtils.MultibodyTUI.graph.BodyGraphAdapter(multibody: Karana.Dynamics.Multibody)[source]#

Bases: GraphAdapter[Karana.Dynamics.PhysicalBody]

Multibody wrapper implementing the GraphAdapater interface.

multibody#
parents(body: Karana.Dynamics.PhysicalBody) list[Karana.Dynamics.PhysicalBody][source]#

Get the parents of a body.

Parameters:

body (PhysicalBody) – The body to get the parents for.

Returns:

The parents of the given body.

Return type:

list[PhysicalBody]

children(body: Karana.Dynamics.PhysicalBody) list[Karana.Dynamics.PhysicalBody][source]#

Get the children of a body.

Parameters:

body (PhysicalBody) – The body to get the children of.

Returns:

The children of a the given body.

Return type:

list[PhysicalBody]

nodes() list[Karana.Dynamics.PhysicalBody][source]#

Get all the bodies in the multibody (these are all the nodes of the graph).

Returns:

All the bodies in the Multibody.

Return type:

list[PhysicalBody]

class Karana.KUtils.MultibodyTUI.graph.FrameGraphAdapter(frame_container: Karana.Frame.FrameContainer)[source]#

Bases: GraphAdapter[Karana.Frame.Frame]

FrameContainer wrapper implementing the GraphAdapater interface.

frame_container#
parents(frame: Karana.Frame.Frame) list[Karana.Frame.Frame][source]#

Get the parents of a Frame.

Parameters:

frame (Frame) – The Frame to get the parents of.

Returns:

The parent frame of the given frame.

Return type:

list[Frame]

children(frame: Karana.Frame.Frame) list[Karana.Frame.Frame][source]#

Get the children of a Frame.

Parameters:

frame (Frame) – The Frame to get the children of.

Returns:

The children of the provided Frame.

Return type:

list[Frame]

nodes() list[Karana.Frame.Frame][source]#

Get all Frames of the FrameContainer.

Returns:

All Frames of the FrameContainer.

Return type:

list[Frame]