Skip to main content

NetworkNode

Namespace: CONNECTIVITYLIB  ·  Library: Connectivity Library

#include <connectivity/networknode.h>

class CONNECTIVITYLIB::NetworkNode

Node of a Network.

Stores a unique ID, a 3D anatomical position (sensor coordinate or source vertex) and the lists of incident edges partitioned by direction (in / out) and by threshold state (full / thresholded), so that graph-theoretic measures can be read off without rescanning the global edge list.

Graph node carrying a 3D position and its incident in/out, full/thresholded edge lists.

src/examples/ex_connectivity_metrics/main.cpp
Network network("manual");
for (int i = 0; i < 3; ++i) {
network.append(NetworkNode::SPtr(new NetworkNode(i, positions.row(i))));
}
const QList<QPair<int, int>> pairs = {{0, 1}, {1, 2}};
const QList<double> weights = {0.9, 0.2};
for (int k = 0; k < pairs.size(); ++k) {
MatrixXd perBin = MatrixXd::Constant(1, 1, weights[k]);
NetworkEdge::SPtr edge(new NetworkEdge(pairs[k].first, pairs[k].second, perBin));
network.getNodeAt(pairs[k].first)->append(edge);
network.getNodeAt(pairs[k].second)->append(edge);
network.append(edge);
}

Public Methods​

NetworkNode(iId, vecVert)​

Constructs a NetworkNode object.

Parameters:

  • iId : qint16 The node's ID.

  • vecVert : const Eigen::RowVectorXf & The node's 3D position.


getFullEdges()​

Returns the ingoing edges corresponding to the full network.

Returns:

  • const QList< QSharedPointer<NetworkEdge> > & — Returns the list with all ingoing edges.

getThresholdedEdges()​

Returns all edges corresponding to the thresholded network.

Returns:

  • QList< QSharedPointer<NetworkEdge> > — Returns the list with all ingoing edges.

getFullEdgesIn()​

Returns the ingoing edges corresponding to the full network.

Returns:

  • QList< QSharedPointer<NetworkEdge> > — Returns the list with all ingoing edges.

getThresholdedEdgesIn()​

Returns the ingoing edges corresponding to the thresholded network.

Returns:

  • QList< QSharedPointer<NetworkEdge> > — Returns the list with all ingoing edges.

getFullEdgesOut()​

Returns the outgoing edges corresponding to the full network.

Returns:

  • QList< QSharedPointer<NetworkEdge> > — Returns the list with all outgoing edges.

getThresholdedEdgesOut()​

Returns the outgoing edges corresponding to the thresholded network.

Returns:

  • QList< QSharedPointer<NetworkEdge> > — Returns the list with all outgoing edges.

getVert()​

Returns the vertex (position) of the node.

Returns:

  • const Eigen::RowVectorXf & — Returns the 3D position of the node.

getId()​

Returns the node id.

Returns:

  • qint16 — Returns the node id.

getFullDegree()​

Returns node degree corresponding to the full network.

Returns:

  • qint16 — The node degree calculated as the number of edges connected to a node (undirected gaph).

getThresholdedDegree()​

Returns node degree corresponding to the thresholded network.

Returns:

  • qint16 — The node degree calculated as the number of edges connected to a node (undirected gaph).

getFullIndegree()​

Returns node indegree corresponding to the full network.

Returns:

  • qint16 — The node degree calculated as the number of incoming edges (only in directed graphs).

getThresholdedIndegree()​

Returns node indegree corresponding to the thresholded network.

Returns:

  • qint16 — The node degree calculated as the number of incoming edges (only in directed graphs).

getFullOutdegree()​

Returns node outdegree corresponding to the full network.

Returns:

  • qint16 — The node degree calculated as the number of outgoing edges (only in directed graphs).

getThresholdedOutdegree()​

Returns node outdegree corresponding to the thresholded network.

Returns:

  • qint16 — The node degree calculated as the number of outgoing edges (only in directed graphs).

getFullStrength()​

Returns node strength corresponding to the full network.

Returns:

  • double — The node strength calculated as the sum of all weights of all edges of a node.

getThresholdedStrength()​

Returns node strength corresponding to the thresholded network.

Returns:

  • double — The node strength calculated as the sum of all weights of all edges of a node.

getFullInstrength()​

Returns node strength of all ingoing edges corresponding to the full network.

Returns:

  • double — The node strength calculated as the sum of all weights of all ingoing edges of a node.

getThresholdedInstrength()​

Returns node strength of all ingoing edges corresponding to the thresholded network.

Returns:

  • double — The node strength calculated as the sum of all weights of all ingoing edges of a node.

getFullOutstrength()​

Returns node strength of all outgoing edges corresponding to the full network.

Returns:

  • double — The node strength calculated as the sum of all weights of all outgoing edges of a node.

getThresholdedOutstrength()​

Returns node strength of all outgoing edges corresponding to the thresholded network.

Returns:

  • double — The node strength calculated as the sum of all weights of all outgoing edges of a node.

setHubStatus(bIsHub)​

Sets the hub status of this node.

Parameters:

  • bIsHub : bool New hub status for this node.

getHubStatus()​

Returns flag describing whether this node is a hub or not.

Returns:

  • bool — Whether this node is a hub or not.

append(newEdge)​

Appends a network edge to this network node.

Automatically decides whether to add to the in or out edges.

Parameters:

  • newEdge : QSharedPointer<NetworkEdge> The new edge item.

Example​

Used in examples​

ex_connectivity_metrics​

Connectivity metrics on synthetic data with a known coupling.

src/examples/ex_connectivity_metrics/main.cpp, line 198
coherency.append(NetworkNode::SPtr(new NetworkNode(i, positions.row(i))));
}
Coherency::calculateAbs(coherency, settings);
coherency.setFrequencyRange(8.0f, 12.0f);
ok &= expect(std::fabs(edgeWeight(coherency, 0, 1) - coh01) < 1e-9, "Coherency::calculateAbs equals Coherence");

ex_disp3d_scene​

Disp3D scene data: sensor-to-surface interpolation, electrodes, MRI slices, video overlay and layers.

src/examples/ex_disp3d_scene/main.cpp, line 275
graph.append(NetworkNode::SPtr(new NetworkNode(i, RowVectorXf::Constant(3, 0.01f * static_cast<float>(i)))));
}
const QList<QPair<int, int>> links = {{0, 1}, {1, 2}};
const QList<double> strengths = {0.9, 0.3};
for (int k = 0; k < links.size(); ++k) {
NetworkEdge::SPtr edge(new NetworkEdge(links[k].first, links[k].second, MatrixXd::Constant(1, 1, strengths[k])));
graph.getNodeAt(links[k].first)->append(edge);
graph.getNodeAt(links[k].second)->append(edge);
graph.append(edge);
}
NetworkObject networkGlyphs;
networkGlyphs.load(graph, "Viridis"); // spheres for nodes, cylinders for edges
const int edgesAll = networkGlyphs.edgeInstanceCount();
networkGlyphs.setThreshold(0.5); // keep only the strong 0-1 link

Authors of this file​