Karana.KUtils.MultibodyTUI.graph
================================

.. py:module:: Karana.KUtils.MultibodyTUI.graph

.. autoapi-nested-parse::

   Classes for working with directed graphs.



Attributes
----------

.. autoapisummary::

   Karana.KUtils.MultibodyTUI.graph.T


Classes
-------

.. autoapisummary::

   Karana.KUtils.MultibodyTUI.graph.GraphAdapter
   Karana.KUtils.MultibodyTUI.graph.BodyGraphAdapter
   Karana.KUtils.MultibodyTUI.graph.FrameGraphAdapter


Module Contents
---------------

.. py:data:: T

.. py:class:: GraphAdapter

   Bases: :py:obj:`abc.ABC`, :py:obj:`Generic`\ [\ :py:obj:`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.


   .. py:method:: parents(node: T, /) -> list[T]
      :abstractmethod:


      Get the list of parents for a given node.



   .. py:method:: children(node: T, /) -> list[T]
      :abstractmethod:


      Get the list of children for a given node.



   .. py:method:: nodes() -> list[T]
      :abstractmethod:


      Get the list of all nodes in the graph.



   .. py:method:: descendants(node: T, /) -> list[T]

      Get the list of all descendants for a given node.



   .. py:method:: ancestors(node: T, /) -> list[T]

      Get the list of all ancestors for a given node.



.. py:class:: BodyGraphAdapter(multibody: Karana.Dynamics.Multibody)

   Bases: :py:obj:`GraphAdapter`\ [\ :py:obj:`Karana.Dynamics.PhysicalBody`\ ]


   Multibody wrapper implementing the GraphAdapter interface.


   .. py:attribute:: multibody


   .. py:method:: parents(body: Karana.Dynamics.PhysicalBody) -> list[Karana.Dynamics.PhysicalBody]

      Get the parents of a body.

      :param body: The body to get the parents for.
      :type body: PhysicalBody

      :returns: The parents of the given body.
      :rtype: list[PhysicalBody]



   .. py:method:: children(body: Karana.Dynamics.PhysicalBody) -> list[Karana.Dynamics.PhysicalBody]

      Get the children of a body.

      :param body: The body to get the children of.
      :type body: PhysicalBody

      :returns: The children of a the given body.
      :rtype: list[PhysicalBody]



   .. py:method:: nodes() -> list[Karana.Dynamics.PhysicalBody]

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

      :returns: All the bodies in the Multibody.
      :rtype: list[PhysicalBody]



.. py:class:: FrameGraphAdapter(frame_container: Karana.Frame.FrameContainer)

   Bases: :py:obj:`GraphAdapter`\ [\ :py:obj:`Karana.Frame.Frame`\ ]


   FrameContainer wrapper implementing the GraphAdapter interface.


   .. py:attribute:: frame_container


   .. py:method:: parents(frame: Karana.Frame.Frame) -> list[Karana.Frame.Frame]

      Get the parents of a Frame.

      :param frame: The Frame to get the parents of.
      :type frame: Frame

      :returns: The parent frame of the given frame.
      :rtype: list[Frame]



   .. py:method:: children(frame: Karana.Frame.Frame) -> list[Karana.Frame.Frame]

      Get the children of a Frame.

      :param frame: The Frame to get the children of.
      :type frame: Frame

      :returns: The children of the provided Frame.
      :rtype: list[Frame]



   .. py:method:: nodes() -> list[Karana.Frame.Frame]

      Get all Frames of the FrameContainer.

      :returns: All Frames of the FrameContainer.
      :rtype: list[Frame]



