Dgraph
The Dgraph
class is for defining graph structures suitable for animation. Graphs consist of nodes, edges and tokens. Tokens can be positioned within nodes or on edges. A graph animation class that uses this class would typically move the tokens by changing there location over time. This class supports both directed graphs and bipartite graphs. Directed graphs contain only primary nodes, while bipartite graphs have both primary and secondary nodes along with the rule that edges must go from primaries to secondaries or secondaries to primaries. Bipartite graphs can be used to represent Petri Nets by letting Transitions be primary nodes and Places be secondary nodes. Everything can be labeled (nodes, edges and tokens as well as the graph itself). Nodes and edges may be added to/removed from graphs, while tokens may be added to/removed from either nodes or edges. Tokens may also be free (not bound to nodes or edges).
Value parameters
- bipartite
-
whether the graph is bipartite (edges only between 2 types of nodes)
- name
-
the name of the graph
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
Type members
Classlikes
The Edge
class is used to represent edges in the graph. If bend = 0, a straight line is created, otherwise a quadratic curve is created. It uses implicit coordinates for the edge endpoints.
The Edge
class is used to represent edges in the graph. If bend = 0, a straight line is created, otherwise a quadratic curve is created. It uses implicit coordinates for the edge endpoints.
Value parameters
- bend
-
the amount of bend in the curve (defaults to zero)
- color
-
the color of the edge
- direct
-
whether to directly set the line or allow factory function to set it
- from
-
the origination node
- label
-
the label for the created edge
- primary
-
whether it is a primary/transition/true or secondary/place node/false
- shape
-
the shape (line/curve) of the edge
- shift
-
amount of distance to shift the edge, e.g., to accommodate a bundle of edges in a composite edge
- to
-
the destination node
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
The Node
class is used to represent nodes in the graph.
The Node
class is used to represent nodes in the graph.
Value parameters
- color
-
the color of the node
- h
-
the height
- label
-
the label for the created node
- primary
-
whether it is a primary/transition/true or secondary/place node/false
- shape
-
the shape of the node
- w
-
the width
- x
-
the x-coordinate (top left)
- y
-
the y-coordinate (top left)
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
The Token
class is used to represent tokens in the graph.
The Token
class is used to represent tokens in the graph.
Value parameters
- color
-
the color of the token
- h
-
the height of the token
- label
-
the label for the created token
- onNode
-
the node the token is on
- primary
-
whether the token is primary/free/true to secondary/bound/false
- shape
-
the shape of the token
- w
-
the width of the token
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Value members
Concrete methods
Add an edge to the graph.
Add an edge to the graph.
Value parameters
- e
-
the edge to add
Attributes
Add a free token to the graph.
Add a free token to the graph.
Value parameters
- t
-
the free token to add
Attributes
Add a node to the graph.
Add a node to the graph.
Value parameters
- n
-
the node to add
Attributes
Get all the root nodes (those with no incoming edges).
Get all the root nodes (those with no incoming edges).
Attributes
Remove an edge from the graph.
Remove an edge from the graph.
Value parameters
- e
-
the edge to remove
Attributes
Remove a free token from the graph.
Remove a free token from the graph.
Value parameters
- t
-
the free token to remove
Attributes
Remove a node from the graph.
Remove a node from the graph.
Value parameters
- n
-
the node to remove
Attributes
Recursively visit all nodes in the graph.
Recursively visit all nodes in the graph.
Value parameters
- level
-
the recursion level
- n
-
the current node
Attributes
Traverse the graph printing out its nodes and showing connectivity by indentation.
Traverse the graph printing out its nodes and showing connectivity by indentation.
Attributes
Concrete fields
List of free tokens in the graph (bound tokens must be in a nodes or edges list)
List of free tokens in the graph (bound tokens must be in a nodes or edges list)