Class: Network

Network(graph, nxGraph, svg, width, height, labeling)

new Network(graph, nxGraph, svg, width, height, labeling)

Represents the network.
Parameters:
Name Type Description
graph Object Graph object containing the nodes and links of the graph as properties. Nodes and links are arrays of node/link objects.
nxGraph Object Data structure of the graph as needed for the networkx library to detect cliques.
svg d3.selection D3.selection containing the svg HTML-Element to draw the graph.
width number Width of svg.
height number Height of svg.
labeling function Function returning the label of a node object.
Source:

Methods

clearNetwork()

Stops the d3 simulation and d3 zoom listener of this network.
Source:

collapseMotifs(motifType, min, max)

Function that detects motifs and replaces them by glyphs.
Parameters:
Name Type Description
motifType Motif Type of motif to detect and replace. Either "CLIQUE", "FAN" or "CONNECTOR".
min number Minimum number of nodes that may be replaced by a glyph of type motifType.
max number Maximum number of nodes that may be replaced by a glyph of type motifType.
Source:

getCliques() → {Object}

Returns all stored cliques
Source:
Returns:
list of cliques
Type
Object

getConnectors() → {Object}

Return all stored connectors
Source:
Returns:
list of connectors
Type
Object

getFans() → {Object}

Returns all stored fans
Source:
Returns:
list of fans
Type
Object

getLegend() → {Array}

Returns the legend according to the current coloring.
Source:
Returns:
Array where the indices represent the labels and the values the corresponding color.
Type
Array

getMotifColor(motif_id) → {Object}

Returns the color of the glyph of the motif with the given id
Parameters:
Name Type Description
motif_id number id of the required motif
Source:
Returns:
d3-rgb-object resembling the color of the glyph
Type
Object

getNodeLabel(nodeid) → {string}

Returns the label of a given node
Parameters:
Name Type Description
nodeid string id of the required node
Source:
Returns:
label of the node
Type
string

hideLabel(d)

Sets the visibility of the given label to hidden.
Parameters:
Name Type Description
d Object Label object.
Source:

highlightMotif(motif_id)

Highlights a glyph in the visualization
Parameters:
Name Type Description
motif_id number id of the motif to highlight
Source:

initMotifDataStructure(motifType, min, max) → {Array}

Inits the data structure containing the information of the motifs and removes previously detected glyphs if needed.
Parameters:
Name Type Description
motifType Motif Type of motif to detect and replace. Either "CLIQUE", "FAN" or "CONNECTOR".
min number Minimum number of nodes that may be replaced by a glyph of type motifType.
max number Maximum number of nodes that may be replaced by a glyph of type motifType.
Source:
Returns:
Array containing a boolean which is true if the given detection query is different to the previus query and false otherwise and the suitable data structure to store motifs according to motifType.
Type
Array

setColorAttribute(attribute)

Sets the attribute according to which the nodes and glyphs will be colored and recolors the nodes and glyphs. Generates the color legend.
Parameters:
Name Type Description
attribute string Name of the node attribute to color the nodes and glyphs.
Source:

setUpNetwork()

Function to initialize the d3 force simulation and to create html-elements of the nodes, links and labels.
Source:

showLabel(d)

Sets the visibility of the given label to visible.
Parameters:
Name Type Description
d Object Label object.
Source:

unlightMotif(motif_id)

Resets the color of a glyph to its original color
Parameters:
Name Type Description
motif_id number id of the motif to color
Source:

(inner) appendClique(nodes, properties)

Appends clique glyphs on the svg html-element.
Parameters:
Name Type Description
nodes Array Array of node objects containing the data of the glyphs to append.
properties Object Array of properties (color, size, position,...) to visualize the glyph.
Source:

(inner) appendConnector(nodes, properties)

Appends connector glyphs on the svg html-element.
Parameters:
Name Type Description
nodes Array Array of node objects containing the data of the glyphs to append.
properties Object Array of properties (color, size, position,...) to visualize the glyph.
Source:

(inner) appendFan(nodes, properties)

Appends fan glyphs on the svg html-element.
Parameters:
Name Type Description
nodes Array Array of node objects containing the data of the glyphs to append.
properties Object Array of properties (color, size, position,...) to visualize the glyph.
Source:

(inner) appendGlyphs(motifType, nodes, properties)

Appends glyphs on the svg html-element.
Parameters:
Name Type Description
motifType Motif Type of motif to detect and replace. Either "CLIQUE", "FAN" or "CONNECTOR".
nodes Array Array of node objects containing the data of the glyphs to append.
properties Object Array of properties (color, size, position,...) to visualize the glyph.
Source:

(inner) calculateFanShape(scale) → {string}

Returns the description for a fan glyph according to the underlying nodes.
Parameters:
Name Type Description
scale number Scale factor of the fan glyph.
Source:
Returns:
Description of the arc.
Type
string

(inner) calculateGlyphProperties(motif_id) → {Object}

Calculates the properties of a glyph based on the nodes which are represented by the glyph.
Parameters:
Name Type Description
motif_id number Id of the motif.
Source:
Returns:
Object containing the properties(meanX, meanY, scale, radius, color, transform) as attributes.
Type
Object

(inner) calculateScaleExtent()

Calculates the scale extent of the graph according to its size.
Source:

(inner) describeArc(x, y, radius, startAngle, endAngle) → {string}

Generates the string for a path html-element to describe an arc.
Parameters:
Name Type Description
x number X coordinate of the center of the arc.
y number Y coordinate of the center of the arc.
radius number Radius of the arc.
startAngle number Degrees where to start the angle.
endAngle number Degrees where to end the angle.
Source:
Returns:
Description of the arc.
Type
string

(inner) dragended(d)

Event handler for end of drag action.
Parameters:
Name Type Description
d Object Node object that was dragged.
Source:

(inner) dragged(d)

Event handler for drag action.
Parameters:
Name Type Description
d Object Node object that is dragged.
Source:

(inner) dragstarted(d)

Event handler for start of drag action.
Parameters:
Name Type Description
d Object Node object that is dragged.
Source:

(inner) enlargeGlyph(index)

Enlarges (hides) a glyph such that the underlying nodes and links are visible.
Parameters:
Name Type Description
index number index of the glyph node inside the graph data structure.
Source:

(inner) fit()

Scales and positions the network such that all components are visible within the svg.
Source:

(inner) polarToCartesian(centerX, centerY, radius, angleInDegrees) → {Object}

Converts polar coordinates to cartesian corrdinates of an arc.
Parameters:
Name Type Description
centerX number X position of the center of the arc.
centerY number Y position of the center of the arc.
radius number Radius of the arc.
angleInDegrees number Angle of the arc in degrees.
Source:
Returns:
Object containing the cartesian x and y coordinates.
Type
Object

(inner) removeGlyph(index)

Removes a glyph.
Parameters:
Name Type Description
index number index of the glyph node inside the graph data structure.
Source:

(inner) replaceMotif(motifType, motif, motif_id)

Replaces a motif by its corresponding glyph. Hides the nodes of the motifs and all links between these nodes and adds a new node which is the glyph and modifies incoming links of the nodes of the motif such that they are connected with the glyph.
Parameters:
Name Type Description
motifType Motif Type of motif to detect and replace. Either "CLIQUE", "FAN" or "CONNECTOR".
motif Array Array containing the ids of the nodes of the motif.
motif_id number Id of the motif.
Source:

(inner) restartSimulation(alpha)

Restarts the d3 force simulation of the graph.
Parameters:
Name Type Description
alpha number Parameter for d3 force simulation.
Source:

(inner) ticked()

Function that handles the ticks of the d3 force simulation. Updates the positions and scales of the html-elements.
Source:

(inner) zoomEvent()

Event handler for zoom event. Applies zoom event to links, nodes and labels.
Source: