Class: Graph

Graph

Represents a graph. Also acts as namespace for Graph.Node, Graph.Edge as well as static variables and functions.

Constructor

new Graph()

Source:

Classes

Edge
Label
Node
ResidualEdge

Members

(static) instance

Singleton to have just one Graph instance per app.
Source:

Methods

(static) addChangeListener()

Add callback functions to be executed after a graph was loaded asynchronically, e.g. to initialize the application
Source:

(static) handleFileSelect()

Upload graph file from a local computer using HTML5 FileReader feature calls setInstance async.
Source:

(static) loadInstance()

Ajax graph file loading from a server using d3.text instead of raw ajax calls calls setInstance async.
Source:

(static) parse(text) → {Graph}

Graph parser static factory method constructs a Graph object from a textuatl representation of the graph.
Parameters:
Name Type Description
text String sequentialized Graph
Source:
Returns:
- parsed Graph object
Type
Graph

(static) setInstance()

Replace the current graph singleton instance and call the defined callback functions. This function is both called asyncronically from within ajax loading of graphs from servers and from local file uploads.
Source:

(static) stringify(graphopt) → {String}

Graph serializer static method Serialize a graph with all resources to string, used when downloading a graph.
Parameters:
Name Type Attributes Description
graph Graph <optional>
Graph object. If not given the current Graph.instance is used
Source:
Returns:
text - sequentialized Graph
Type
String

(static) styleResources()

Style node or edge resources
Source:

addEdge(id, id)

Add an edge to the graph
Parameters:
Name Type Description
id Number | String of start node
id Number | String of end node
Source:

addNode(x, y)

add a node to the graph
Parameters:
Name Type Description
x Number | String coordinate
y Number | String coordinate
Source:

getNodeResourcesSize()

We allow arbitrary size of resources for each node.
Source: