Dgraph

scalation.animation.Dgraph
class Dgraph(name: String, bipartite: Boolean)

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 Object
trait Matchable
class Any

Members list

Type members

Classlikes

case class Edge(shape: CurvilinearShape, label: String, primary: Boolean, var color: Color, from: Node, to: Node, bend: Double, shift: Int, direct: Boolean)

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 Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Edge

The Edge companion object provides factory mathods for creating various forms of edges.

The Edge companion object provides factory mathods for creating various forms of edges.

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Edge.type
case class Node(shape: RectPolyShape, label: String, primary: Boolean, var color: Color, x: Double, y: Double, w: Double, h: Double)

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 Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class Token(shape: RectangularShape, label: String, primary: Boolean, var color: Color, var onNode: Node, w: Double, h: Double)

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 Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

def addEdge(e: Edge): Unit

Add an edge to the graph.

Add an edge to the graph.

Value parameters

e

the edge to add

Attributes

def addFreeToken(t: Token): Unit

Add a free token to the graph.

Add a free token to the graph.

Value parameters

t

the free token to add

Attributes

def addNode(n: Node): Unit

Add a node to the graph.

Add a node to the graph.

Value parameters

n

the node to add

Attributes

def getRoots: ListBuffer[Node]

Get all the root nodes (those with no incoming edges).

Get all the root nodes (those with no incoming edges).

Attributes

def removeEdge(e: Edge): Unit

Remove an edge from the graph.

Remove an edge from the graph.

Value parameters

e

the edge to remove

Attributes

def removeFreeToken(t: Token): Unit

Remove a free token from the graph.

Remove a free token from the graph.

Value parameters

t

the free token to remove

Attributes

def removeNode(n: Node): Unit

Remove a node from the graph.

Remove a node from the graph.

Value parameters

n

the node to remove

Attributes

def traverse(n: Node, level: Int): Unit

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

def traverseNodes(): Unit

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

val edges: ListBuffer[Edge]

List of edges in the graph

List of edges in the graph

Attributes

val freeTokens: ListBuffer[Token]

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)

Attributes

val nodes: ListBuffer[Node]

List of nodes in the graph

List of nodes in the graph

Attributes