toyplot.scenegraph module

Functionality for managing scene graphs.

Note that the scenegraph is an internal implementation detail for developers adding new functionality to Toyplot, casual Toyplot users will never need to work with it.

class toyplot.scenegraph.AdjacencyList[source]

Bases: object

Adjaceny list representation for a directed graph.

add_edge(source, target)[source]

Add a directed edge from source to target.

remove_edge(source, target)[source]

Remove the directed edge from source to target, if it exists.

sources(target)[source]

Return nodes that are connected to target via incoming edges.

targets(source)[source]

Return nodes are connected to source via outgoing edges.

class toyplot.scenegraph.SceneGraph[source]

Bases: object

Collection of graphs representing semantic relationships among a (small number) of canvas objects.

add_edge(source, relationship, target)[source]

Add an edge of type relationship from source to target.

remove_edge(source, relationship, target)[source]

Remove an edge of type relationship from source to target, if one exists.

source(relationship, target)[source]

Return a single node that is connected to target via an incoming edge of type relationship.

Raises an exception if there isn’t exactly one incoming edge of type relationship.

sources(relationship, target)[source]

Return nodes that are connected to target via incoming edges of type relationship, if any.

targets(source, relationship)[source]

Return nodes are connected to source via outgoing edges of type relationship.