topology - the diarc graph data structure¶
This module contains the graph data structures used by diarc.
-
class
topology.Topology¶ Storage container for describing the graph and diagram
-
blocks¶ A dictionary of
Blockobjects indexed byBlock.index. The dictionary is generated every time it is requested. Only blocks with properBlock.indexvalues are included.
-
bands¶ A dictionary of
Bandobjects, listed byBand.altitude. Bands which have not been assigned altitudes are not reported. All bands that have an altitude (regardless of if they are being used (indicated by isUsed) are reported.
-
snaps¶ A dictionary of
Snapobjects, by snapkey. Snaps which have not been assigned an order are not reported. All snaps that have an order regardless of if they are being used (indicated by isUsed) are reported.
-
hide_disconnected_snaps¶
-
-
class
topology.Vertex¶ A Vertex in a directional graph. A vertex can connect to multiple edges as either an input (source) or output (sink) to the edge. It is graphically represented by a Block object.
-
block¶ Blockobject for this Vertex. It is created when the vertex is instantiated, and cannot be reassigned.
-
release()¶ Removes this vertex from the topology. This additionally removes all its associated
ConnectionandBlockobjects from the topology.
-
-
class
topology.Edge¶ A directional multiple-input multiGple-output edge in the graph. Inputs (sources) and outputs (sinks) are linked to vertices. An edge is represented graphically by either 1 or 2 Band objects.
-
sources¶
-
sinks¶
-
posBand¶
-
negBand¶
-
release()¶
-
-
class
topology.Connection¶ A base class for connecting a vertex to an edge, but without specifing the nature of the connection (input or output). Rather then using this class directly, Source or Sink objects should be used.
-
snap¶
-
edge¶
-
vertex¶
-
block¶
-
release()¶
-
-
class
topology.Source(Connection)¶ A logical connection from a Vertex to an Edge. Graphically represented by a Snap object.
-
release()¶
-
-
class
topology.Sink(Connection)¶ A logical connection from an Edge to a Vertex. Graphically represented by a Snap object.
-
release()¶
-
-
class
topology.Block¶ Visual Representation of a Vertex Visual Parameters Index - Unique int value to determine order in which to draw blocks.
Lower values to the left, higher to the right. Indices do not necessarily need to be consecutive.-
index¶ Defines the order in which blocks are arranged. This value is initially unset (defaults to None). For the block to be displayed as part of the graph, this value must be changed to a positive integer that is unique among blocks.
-
vertex¶ Returns the logical component (Vertex) for this relative object. The vertex is bound to this block, and cannot be changed.
-
emitter¶ Dictionary of Snaps that represent source connections for this block. Only snaps which have been assigned an order value are represented, since the order is used as the dictionary key. If hide_disconnected_snaps is set in the topology, only return snaps where isLinked() is true.
-
collector¶ Dictionary of
Snapobjects that represent sink connections for this block. Only snaps which have been assigned an order value are represented, since the order is used as the dictionary key. If hide_disconnected_snaps is set in the topology, only return snaps where isLinked() is true.
-
leftBlock¶ returns the block to the left, determined by block which has the next lowest index value.
-
rightBlock¶ returns the block to the right, determined by block which has the next highest index value.
-
-
class
topology.Band¶ Visual Representation of an Edge. An Edge can have up to two Bands - one with positive altitude and one negative. Visual Parameters Rank - the Z drawing order (higher values closer to user) Altitude - the distance above or below the Block ribbon
-
altitude¶
-
rank¶
-
edge¶
-
emitters¶
-
collectors¶
-
isPositive¶
-
topBand¶
-
bottomBand¶
-
isUsed()¶
-
-
class
diarc.topology.Vertex(topology)[source]¶ A Vertex in a directional graph. A vertex can connect to multiple edges as either an input (source) or output (sink) to the edge. It is graphically represented by a Block object.
Sources - outgoing connections to Edges Sinks - incomming connections from Edges
-
sources¶ Returns an unordered list of outgoing connections (Source objects) from this vertex.
-
sinks¶ Returns an unordered list of outgoing connections (Sink objects) from this vertex.
-
block¶ Returns the relative graphical object (Block) for this Vertex. The block cannot be changed
-
-
class
diarc.topology.Edge(topology)[source]¶ A directional multiple-input multiGple-output edge in the graph. Inputs (sources) and outputs (sinks) are linked to vertices. An edge is represented graphically by either 1 or 2 Band objects.
Sources - inputs from vertices Sinks - outputs to vertices
-
sources¶ returns list of all source connections to this edge
-
sinks¶ returns list of all sink connections from this edge
-
-
class
diarc.topology.Connection(topology, vertex, edge)[source]¶ A base class for connecting a vertex to an edge, but without specifing the nature of the connection (input or output). Rather then using this class directly, Source or Sink objects should be used.
-
class
diarc.topology.Source(topology, vertex, edge)[source]¶ A logical connection from a Vertex to an Edge. Graphically represented by a Snap object.
-
class
diarc.topology.Sink(topology, vertex, edge)[source]¶ A logical connection from an Edge to a Vertex. Graphically represented by a Snap object.
-
class
diarc.topology.Block(vertex)[source]¶ Visual Representation of a Vertex Visual Parameters Index - Unique int value to determine order in which to draw blocks.
Lower values to the left, higher to the right. Indices do not necessarily need to be consecutive.-
vertex¶ Returns the logical component (Vertex) for this relative object. The vertex is bound to this block, and cannot be changed.
-
emitter¶ Dictionary of Snaps that represent source connections for this block. Only snaps which have been assigned an order value are represented, since the order is used as the dictionary key. If hide_disconnected_snaps is set in the topology, only return snaps where isLinked() is true.
-
collector¶ Dictionary of Snaps that represent sink connections for this block. Only snaps which have been assigned an order value are represented, since the order is used as the dictionary key. If hide_disconnected_snaps is set in the topology, only return snaps where isLinked() is true.
-
-
class
diarc.topology.Band(edge, isPositive)[source]¶ Visual Representation of an Edge. An Edge can have up to two Bands - one with positive altitude and one negative. Visual Parameters Rank - the Z drawing order (higher values closer to user) Altitude - the distance above or below the Block ribbon
-
emitters¶ returns a list of source snaps that reach this band
-
collectors¶ returns list of sink snaps that reach this band
-
isUsed()[source]¶ returns true if this band is needed to represent connections on its edge, else false. This is determined by checking if any sources reach this band.
-
topBand¶ Returns the band with the next highest altitude, or None if either there is no band above this one or the block ribbon is above it. Bands for which isUsed() is false are skipped over.
-
bottomBand¶ Returns the band with the next lowest altitude, or None if either there is no band below this one or the block ribbon is below it. Bands for which isUsed() is false are skipped over.
-
-
class
diarc.topology.Snap(connection)[source]¶ Visual Representation of a Source or Sink. Snaps are layedout horizontally inside of an Emitter or Collector of a Block. A Snap provides a mapping between a Source/Sink and one or two Bands associated with a single Edge. Visual Layout Paramters Order - 0-indexed order in which to draw snaps within an Emitter or Collector
-
posBandLink¶ returns the positive band connection - if it exists. Just because a positive band link exists does not mean that it should be drawn. The check for if we should draw the connection happens at drawing time when we decide if we should be using positive or negative
-
negBandLink¶ returns the negative band connection - if it exists. See posBand for more details.
-
isUsed()[source]¶ returns true if topology.hide_disconnected_snaps is True and isLinked is True, or if topology.hide_disconnected_snaps is false. Otherwise, return true.
-
leftSnap¶ Returns the snap directly to the left of this snap within either an emitter or collector. Returns None if this is leftmost snap.
-
rightSnap¶ Returns the snap directly to the right of this snap within either an emitter or collector. Returns None if this is rightmost snap.
-