GUIDE
- Left-click and drag the background to move the graph
- Left-click and drag the nodes to reorganize
- Left-click a node to view first level connections
- Double left-click a node to navigate to its page
- Double left-click the background to zoom in
- Right-click the background to zoom out
sigma.utils.pkg('sigma.canvas.nodes');
sigma.canvas.nodes.image = (function() {
var _cache = {},
_loading = {},
_callbacks = {};
// Return the renderer itself:
var renderer = function(node, context, settings) {
var args = arguments,
prefix = settings('prefix') || '',
size = node[prefix + 'size'],
color = node.color || settings('defaultNodeColor'),
url = node.url;
if (_cache[url]) {
context.save();
// Draw the clipping disc:
context.beginPath();
context.arc(
node[prefix + 'x'],
node[prefix + 'y'],
node[prefix + 'size'],
0,
Math.PI * 2,
true
);
context.closePath();
context.clip();
// Draw the image
context.drawImage(
_cache[url],
node[prefix + 'x'] - size,
node[prefix + 'y'] - size,
2 * size,
2 * size
);
// Quit the "clipping mode":
context.restore();
// Draw the border:
context.beginPath();
context.arc(
node[prefix + 'x'],
node[prefix + 'y'],
node[prefix + 'size'],
0,
Math.PI * 2,
true
);
context.lineWidth = 1;
context.strokeStyle = node.color || settings('defaultNodeColor');
context.stroke();
} else {
sigma.canvas.nodes.image.cache(url);
sigma.canvas.nodes.def.apply(
sigma.canvas.nodes,
args
);
}
};
// Let's add a public method to cache images, to make it possible to
// preload images before the initial rendering:
renderer.cache = function(url, callback) {
if (callback)
_callbacks[url] = callback;
if (_loading[url])
return;
var img = new Image();
img.onload = function() {
_loading[url] = false;
_cache[url] = img;
if (_callbacks[url]) {
_callbacks[url].call(this, img);
delete _callbacks[url];
}
};
_loading[url] = true;
img.src = url;
};
return renderer;
})();
var i,
s,
o,
offset_left = 0.5,
N = 1,
E = 40,
C = 5,
d = 0.5,
cs = [],
g = {
nodes: [],
edges: []
};
if (!sigma.classes.graph.hasMethod('neighbors')){
sigma.classes.graph.addMethod('neighbors', function(nodeId) {
var k,
neighbors = {},
index = this.allNeighborsIndex[nodeId] || {};
for (k in index)
neighbors[k] = this.nodesIndex[k];
return neighbors;
});
}
//adding the central node
g.nodes.push({
id: 82057,
label: 'Juliette Paireau',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2017/05/research_pasteur-img_7168-34-2-150x150.jpg',
x: 0,
y: 0,
size: 30,
color: '#DDDDDD'
});
var biggest_node_size = 0;
N=6
// adding node
var x_node = Math.cos(2 * 0 * Math.PI / N) * 10;
var y_node = Math.sin(2 * 0 * Math.PI / N) * 10;
g.nodes.push({
id: 163908,
label: 'NEWS: Benefits and risks associated with the COVID-19 vaccine Vaxzevria',
x: x_node,
y: y_node,
type: 'image',
url: '',
page_url: 'https://research.pasteur.fr/en/news/benefits-and-risks-associated-with-the-covid-19-vaccine-vaxzevria/',
size: 35,
color: '#DDDDDD'
});
//link content to central post
g.edges.push({
id: 82057163908,
size: 0.5,
source: 82057,
target: 163908,
});
//check if content already exist
if (x_node<0){
x_site = x_node + ((Math.random() * 2)-1) - offset_left;
}else{
x_site = x_node + ((Math.random() * 2)-1) + offset_left;
}
if (y_node<0){
y_site = y_node + ((Math.random() * 2)-1) - offset_left;
}else{
y_site = y_node + ((Math.random() * 2)-1) + offset_left;
}
// adding site
g.nodes.push({
id: 135032,
label: 'Cécile Tran Kiem',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2019/11/research_pasteur-encecile-tran-kiemfrcecile-tran-kiem-20210720-fwis-c-tran-kiem-0076-crop-1-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/member/cecile-tran-kiem/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 163908135032,
size: 0.5,
source: 163908,
target: 135032 });
//check if content already exist
if (x_node<0){
x_site = x_node + ((Math.random() * 2)-1) - offset_left;
}else{
x_site = x_node + ((Math.random() * 2)-1) + offset_left;
}
if (y_node<0){
y_site = y_node + ((Math.random() * 2)-1) - offset_left;
}else{
y_site = y_node + ((Math.random() * 2)-1) + offset_left;
}
// adding site
g.nodes.push({
id: 4027,
label: 'Alessio Andronico',
type: 'image',
url: '',
page_url: 'https://research.pasteur.fr/en/?post_type=member&p=4027',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 1639084027,
size: 0.5,
source: 163908,
target: 4027 });
//check if content already exist
if (x_node<0){
x_site = x_node + ((Math.random() * 2)-1) - offset_left;
}else{
x_site = x_node + ((Math.random() * 2)-1) + offset_left;
}
if (y_node<0){
y_site = y_node + ((Math.random() * 2)-1) - offset_left;
}else{
y_site = y_node + ((Math.random() * 2)-1) + offset_left;
}
// adding site
g.nodes.push({
id: 120059,
label: 'Paolo Bosetti',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2019/03/research_pasteur-20190314_185852-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/member/paolo-bosetti/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 163908120059,
size: 0.5,
source: 163908,
target: 120059 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 82057) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 16390882057,
size: 0.5,
source: 163908,
target: 82057 });
//check if content already exist
if (x_node<0){
x_site = x_node + ((Math.random() * 2)-1) - offset_left;
}else{
x_site = x_node + ((Math.random() * 2)-1) + offset_left;
}
if (y_node<0){
y_site = y_node + ((Math.random() * 2)-1) - offset_left;
}else{
y_site = y_node + ((Math.random() * 2)-1) + offset_left;
}
// adding site
g.nodes.push({
id: 2624,
label: 'Arnaud Fontanet',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2015/07/research.pasteur.fr_arnaud-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/member/arnaud-fontanet/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 1639082624,
size: 0.5,
source: 163908,
target: 2624 });
//check if content already exist
if (x_node<0){
x_site = x_node + ((Math.random() * 2)-1) - offset_left;
}else{
x_site = x_node + ((Math.random() * 2)-1) + offset_left;
}
if (y_node<0){
y_site = y_node + ((Math.random() * 2)-1) - offset_left;
}else{
y_site = y_node + ((Math.random() * 2)-1) + offset_left;
}
// adding site
g.nodes.push({
id: 4028,
label: 'Simon Cauchemez',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2015/07/research.pasteur.fr_fig45-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/member/simon-cauchemez/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 1639084028,
size: 0.5,
source: 163908,
target: 4028 });
// adding node
var x_node = Math.cos(2 * 1 * Math.PI / N) * 10;
var y_node = Math.sin(2 * 1 * Math.PI / N) * 10;
g.nodes.push({
id: 19785,
label: 'PROJECT: Assessing the threat posed by zoonotic viruses like MERS-CoV, Nipah, Yellow Fever or plague',
x: x_node,
y: y_node,
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2015/11/research.pasteur.fr_picture-camel-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/project/tackling-the-puzzle-of-emerging-zoonotic-viruses/',
size: 35,
color: '#DDDDDD'
});
//link content to central post
g.edges.push({
id: 8205719785,
size: 0.5,
source: 82057,
target: 19785,
});
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 4028) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 197854028,
size: 0.5,
source: 19785,
target: 4028 });
//check if content already exist
if (x_node<0){
x_site = x_node + ((Math.random() * 2)-1) - offset_left;
}else{
x_site = x_node + ((Math.random() * 2)-1) + offset_left;
}
if (y_node<0){
y_site = y_node + ((Math.random() * 2)-1) - offset_left;
}else{
y_site = y_node + ((Math.random() * 2)-1) + offset_left;
}
// adding site
g.nodes.push({
id: 4031,
label: 'Henrik Salje',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2015/09/research.pasteur.fr_h_salje_pic1-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/member/henrik-salje/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 197854031,
size: 0.5,
source: 19785,
target: 4031 });
//check if content already exist
if (x_node<0){
x_site = x_node + ((Math.random() * 2)-1) - offset_left;
}else{
x_site = x_node + ((Math.random() * 2)-1) + offset_left;
}
if (y_node<0){
y_site = y_node + ((Math.random() * 2)-1) - offset_left;
}else{
y_site = y_node + ((Math.random() * 2)-1) + offset_left;
}
// adding site
g.nodes.push({
id: 48300,
label: '',
type: 'image',
url: '',
page_url: '',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 1978548300,
size: 0.5,
source: 19785,
target: 48300 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 120059) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 19785120059,
size: 0.5,
source: 19785,
target: 120059 });
//check if content already exist
if (x_node<0){
x_site = x_node + ((Math.random() * 2)-1) - offset_left;
}else{
x_site = x_node + ((Math.random() * 2)-1) + offset_left;
}
if (y_node<0){
y_site = y_node + ((Math.random() * 2)-1) - offset_left;
}else{
y_site = y_node + ((Math.random() * 2)-1) + offset_left;
}
// adding site
g.nodes.push({
id: 84205,
label: '',
type: 'image',
url: '',
page_url: '',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 1978584205,
size: 0.5,
source: 19785,
target: 84205 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 82057) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 1978582057,
size: 0.5,
source: 19785,
target: 82057 });
// adding node
var x_node = Math.cos(2 * 2 * Math.PI / N) * 10;
var y_node = Math.sin(2 * 2 * Math.PI / N) * 10;
g.nodes.push({
id: 123012,
label: 'PROJECT: Analysis and modelling to support decision making during epidemics',
x: x_node,
y: y_node,
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2019/02/research_pasteur-influenza-in-france-150x150.png',
page_url: 'https://research.pasteur.fr/en/project/analysis-and-modelling-to-support-decision-making-during-epidemics/',
size: 35,
color: '#DDDDDD'
});
//link content to central post
g.edges.push({
id: 82057123012,
size: 0.5,
source: 82057,
target: 123012,
});
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 4027) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 1230124027,
size: 0.5,
source: 123012,
target: 4027 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 4031) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 1230124031,
size: 0.5,
source: 123012,
target: 4031 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 82057) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 12301282057,
size: 0.5,
source: 123012,
target: 82057 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 84205) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 12301284205,
size: 0.5,
source: 123012,
target: 84205 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 48300) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 12301248300,
size: 0.5,
source: 123012,
target: 48300 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 4028) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 1230124028,
size: 0.5,
source: 123012,
target: 4028 });
// adding node
var x_node = Math.cos(2 * 3 * Math.PI / N) * 10;
var y_node = Math.sin(2 * 3 * Math.PI / N) * 10;
g.nodes.push({
id: 123000,
label: 'PROJECT: Statistical and mathematical methods to characterize disease transmission from incomplete epidemiological data',
x: x_node,
y: y_node,
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2019/02/research_pasteur-data-and-methods-150x150.png',
page_url: 'https://research.pasteur.fr/en/project/statistical-and-mathematical-methods-to-characterize-disease-transmission-from-incomplete-epidemiological-data/',
size: 35,
color: '#DDDDDD'
});
//link content to central post
g.edges.push({
id: 82057123000,
size: 0.5,
source: 82057,
target: 123000,
});
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 4027) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 1230004027,
size: 0.5,
source: 123000,
target: 4027 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 48300) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 12300048300,
size: 0.5,
source: 123000,
target: 48300 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 4031) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 1230004031,
size: 0.5,
source: 123000,
target: 4031 });
//check if content already exist
if (x_node<0){
x_site = x_node + ((Math.random() * 2)-1) - offset_left;
}else{
x_site = x_node + ((Math.random() * 2)-1) + offset_left;
}
if (y_node<0){
y_site = y_node + ((Math.random() * 2)-1) - offset_left;
}else{
y_site = y_node + ((Math.random() * 2)-1) + offset_left;
}
// adding site
g.nodes.push({
id: 95141,
label: 'Nathanaël Hozé',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2017/09/research_pasteur-nathanael-hoze-img-1380-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/member/nathanael-hoze/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 12300095141,
size: 0.5,
source: 123000,
target: 95141 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 82057) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 12300082057,
size: 0.5,
source: 123000,
target: 82057 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 84205) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 12300084205,
size: 0.5,
source: 123000,
target: 84205 });
//check if content already exist
if (x_node<0){
x_site = x_node + ((Math.random() * 2)-1) - offset_left;
}else{
x_site = x_node + ((Math.random() * 2)-1) + offset_left;
}
if (y_node<0){
y_site = y_node + ((Math.random() * 2)-1) - offset_left;
}else{
y_site = y_node + ((Math.random() * 2)-1) + offset_left;
}
// adding site
g.nodes.push({
id: 113742,
label: '',
type: 'image',
url: '',
page_url: '',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 123000113742,
size: 0.5,
source: 123000,
target: 113742 });
//check if content already exist
if (x_node<0){
x_site = x_node + ((Math.random() * 2)-1) - offset_left;
}else{
x_site = x_node + ((Math.random() * 2)-1) + offset_left;
}
if (y_node<0){
y_site = y_node + ((Math.random() * 2)-1) - offset_left;
}else{
y_site = y_node + ((Math.random() * 2)-1) + offset_left;
}
// adding site
g.nodes.push({
id: 73911,
label: '',
type: 'image',
url: '',
page_url: '',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 12300073911,
size: 0.5,
source: 123000,
target: 73911 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 120059) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 123000120059,
size: 0.5,
source: 123000,
target: 120059 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 4028) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 1230004028,
size: 0.5,
source: 123000,
target: 4028 });
// adding node
var x_node = Math.cos(2 * 4 * Math.PI / N) * 10;
var y_node = Math.sin(2 * 4 * Math.PI / N) * 10;
g.nodes.push({
id: 87638,
label: 'PROJECT: Improved understanding of patterns of pathogen infection risk',
x: x_node,
y: y_node,
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2017/03/research.pasteur.fr_example_map-01-150x150.png',
page_url: 'https://research.pasteur.fr/en/project/improved-understanding-of-patterns-of-arbovirus-infection-risk/',
size: 35,
color: '#DDDDDD'
});
//link content to central post
g.edges.push({
id: 8205787638,
size: 0.5,
source: 82057,
target: 87638,
});
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 4028) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 876384028,
size: 0.5,
source: 87638,
target: 4028 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 84205) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 8763884205,
size: 0.5,
source: 87638,
target: 84205 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 82057) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 8763882057,
size: 0.5,
source: 87638,
target: 82057 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 48300) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 8763848300,
size: 0.5,
source: 87638,
target: 48300 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 4031) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 876384031,
size: 0.5,
source: 87638,
target: 4031 });
// adding node
var x_node = Math.cos(2 * 5 * Math.PI / N) * 10;
var y_node = Math.sin(2 * 5 * Math.PI / N) * 10;
g.nodes.push({
id: 6186,
label: 'TEAM: Mathematical Modelling Of Infectious Diseases',
x: x_node,
y: y_node,
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2015/07/research.pasteur.fr_mathematical-modeling-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/team/mathematical-modelling-of-infectious-diseases/',
size: 35,
color: '#DDDDDD'
});
//link content to central post
g.edges.push({
id: 820576186,
size: 0.5,
source: 82057,
target: 6186,
});
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 82057) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 618682057,
size: 0.5,
source: 6186,
target: 82057 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 120059) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 6186120059,
size: 0.5,
source: 6186,
target: 120059 });
//check if content already exist
if (x_node<0){
x_site = x_node + ((Math.random() * 2)-1) - offset_left;
}else{
x_site = x_node + ((Math.random() * 2)-1) + offset_left;
}
if (y_node<0){
y_site = y_node + ((Math.random() * 2)-1) - offset_left;
}else{
y_site = y_node + ((Math.random() * 2)-1) + offset_left;
}
// adding site
g.nodes.push({
id: 174333,
label: 'Thomas Cortier',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2022/01/research_pasteur-thomas-cortier-thomas-cortier-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/member/thomas-cortier/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 6186174333,
size: 0.5,
source: 6186,
target: 174333 });
//check if content already exist
if (x_node<0){
x_site = x_node + ((Math.random() * 2)-1) - offset_left;
}else{
x_site = x_node + ((Math.random() * 2)-1) + offset_left;
}
if (y_node<0){
y_site = y_node + ((Math.random() * 2)-1) - offset_left;
}else{
y_site = y_node + ((Math.random() * 2)-1) + offset_left;
}
// adding site
g.nodes.push({
id: 183349,
label: 'Antoine Brault',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2022/07/research_pasteur-antoine-brault-bc8898e5-5dec-4ebe-b180-d9397ab43630-1-105-c-150x150.jpeg',
page_url: 'https://research.pasteur.fr/en/member/antoine-brault-2/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 6186183349,
size: 0.5,
source: 6186,
target: 183349 });
//check if content already exist
if (x_node<0){
x_site = x_node + ((Math.random() * 2)-1) - offset_left;
}else{
x_site = x_node + ((Math.random() * 2)-1) + offset_left;
}
if (y_node<0){
y_site = y_node + ((Math.random() * 2)-1) - offset_left;
}else{
y_site = y_node + ((Math.random() * 2)-1) + offset_left;
}
// adding site
g.nodes.push({
id: 186173,
label: 'Lina Cristancho Fajardo',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2022/09/research_pasteur-lina-cristancho-fajardo-2024-01-11-10.58.20-e1704967192825-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/member/lina-cristancho-fajardo/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 6186186173,
size: 0.5,
source: 6186,
target: 186173 });
//check if content already exist
if (x_node<0){
x_site = x_node + ((Math.random() * 2)-1) - offset_left;
}else{
x_site = x_node + ((Math.random() * 2)-1) + offset_left;
}
if (y_node<0){
y_site = y_node + ((Math.random() * 2)-1) - offset_left;
}else{
y_site = y_node + ((Math.random() * 2)-1) + offset_left;
}
// adding site
g.nodes.push({
id: 186314,
label: 'Charlotte Perlant',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2022/09/research_pasteur-charlotte-perlant-charlotte2-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/member/charlotte-perlant/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 6186186314,
size: 0.5,
source: 6186,
target: 186314 });
//check if content already exist
if (x_node<0){
x_site = x_node + ((Math.random() * 2)-1) - offset_left;
}else{
x_site = x_node + ((Math.random() * 2)-1) + offset_left;
}
if (y_node<0){
y_site = y_node + ((Math.random() * 2)-1) - offset_left;
}else{
y_site = y_node + ((Math.random() * 2)-1) + offset_left;
}
// adding site
g.nodes.push({
id: 188261,
label: 'Matthew Shin',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2022/10/research_pasteur-matthew-shin-20221003-213850-16-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/member/matthew-shin/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 6186188261,
size: 0.5,
source: 6186,
target: 188261 });
//check if content already exist
if (x_node<0){
x_site = x_node + ((Math.random() * 2)-1) - offset_left;
}else{
x_site = x_node + ((Math.random() * 2)-1) + offset_left;
}
if (y_node<0){
y_site = y_node + ((Math.random() * 2)-1) - offset_left;
}else{
y_site = y_node + ((Math.random() * 2)-1) + offset_left;
}
// adding site
g.nodes.push({
id: 7799,
label: 'Laurence Boutout',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2015/07/research.pasteur.fr_laurence-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/member/laurence-boutout/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 61867799,
size: 0.5,
source: 6186,
target: 7799 });
//check if content already exist
if (x_node<0){
x_site = x_node + ((Math.random() * 2)-1) - offset_left;
}else{
x_site = x_node + ((Math.random() * 2)-1) + offset_left;
}
if (y_node<0){
y_site = y_node + ((Math.random() * 2)-1) - offset_left;
}else{
y_site = y_node + ((Math.random() * 2)-1) + offset_left;
}
// adding site
g.nodes.push({
id: 217160,
label: 'Kelly Charniga',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2024/01/research_pasteur-enkelly-charnigafrkelly-charniga-research-pasteur-enkelly-charnigafrkelly-charniga-kelly3-1-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/member/kelly-charniga/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 6186217160,
size: 0.5,
source: 6186,
target: 217160 });
//check if content already exist
if (x_node<0){
x_site = x_node + ((Math.random() * 2)-1) - offset_left;
}else{
x_site = x_node + ((Math.random() * 2)-1) + offset_left;
}
if (y_node<0){
y_site = y_node + ((Math.random() * 2)-1) - offset_left;
}else{
y_site = y_node + ((Math.random() * 2)-1) + offset_left;
}
// adding site
g.nodes.push({
id: 217156,
label: 'Francesco Camaglia',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2024/01/research_pasteur-enfrancesco-camagliafrfrancesco-camaglia-research-pasteur-enfrancesco-camagliafrfrancesco-camaglia-francesco2-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/member/francesco-camaglia/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 6186217156,
size: 0.5,
source: 6186,
target: 217156 });
//check if content already exist
if (x_node<0){
x_site = x_node + ((Math.random() * 2)-1) - offset_left;
}else{
x_site = x_node + ((Math.random() * 2)-1) + offset_left;
}
if (y_node<0){
y_site = y_node + ((Math.random() * 2)-1) - offset_left;
}else{
y_site = y_node + ((Math.random() * 2)-1) + offset_left;
}
// adding site
g.nodes.push({
id: 217145,
label: 'Noé Ochida',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2024/01/research_pasteur-ennoe-ochidafrnoe-ochida-noe2-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/member/noe-ochida/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 6186217145,
size: 0.5,
source: 6186,
target: 217145 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 4028) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 61864028,
size: 0.5,
source: 6186,
target: 4028 });
var s = new sigma({
//container: document.getElementById('graph-main'),
graph: g,
renderer: {
// IMPORTANT:
// This works only with the canvas renderer, so the
// renderer type set as "canvas" is necessary here.
container: document.getElementById('graph-main'),
type: 'canvas'
},
settings: {
minNodeSize: 6,
maxNodeSize: 35,
mouseWheelEnabled: false,
font: 'Montserrat',
labelThreshold:25,
borderSize:1,
defaultNodeBorderColor: '#999',
sideMargin:25,
}
});
// We first need to save the original colors of our
// nodes and edges, like this:
s.graph.nodes().forEach(function(n) {
n.originalColor = n.color;
});
s.graph.edges().forEach(function(e) {
e.originalColor = e.color;
});
// When a node is clicked, we check for each node
// if it is a neighbor of the clicked one. If not,
// we set its color as grey, and else, it takes its
// original color.
// We do the same for the edges, and we only keep
// edges that have both extremities colored.
s.bind('clickNode', function(e) {
var nodeId = e.data.node.id,
toKeep = s.graph.neighbors(nodeId);
toKeep[nodeId] = e.data.node;
s.graph.nodes().forEach(function(n) {
if (toKeep[n.id])
n.color = '#35a9f5';
else
n.color = '#dddddd';
});
s.graph.edges().forEach(function(e) {
if (toKeep[e.source] && toKeep[e.target])
e.color = '#35a9f5';
else
e.color = '#dddddd';
});
// Since the data has been modified, we need to
// call the refresh method to make the colors
// update effective.
s.refresh();
});
// When the stage is clicked, we just color each
// node and edge with its original color.
s.bind('clickStage', function(e) {
s.graph.nodes().forEach(function(n) {
n.color = n.originalColor;
});
s.graph.edges().forEach(function(e) {
e.color = e.originalColor;
});
// Same as in the previous event:
s.refresh();
});
s.bind("doubleClickNode", function (e) {
$("#canvas-wrap, .sigma-scene, .sigma-mouse").val();
ajax_load_page( e.data.node.page_url );
});
var c = s.camera;
s.bind("rightClickStage", function (e) {
sigma.misc.animation.camera(c, {
ratio: c.ratio * c.settings('zoomingRatio')
}, {
duration: 200
});
});
// Configure the noverlap layout:
var noverlapListener = s.configNoverlap({
nodeMargin: 10,
scaleNodes: 0.3,
gridSize: 1,
easing: 'quadraticInOut', // animation transition function
duration: 4000 // animation duration. Long here for the purposes of this example only
});
// Bind the events:
noverlapListener.bind('start stop interpolate', function(e) {
//console.log(e.type);
if(e.type === 'start') {
//console.time('noverlap');
}
if(e.type === 'interpolate') {
//console.timeEnd('noverlap');
}
});
// Start the layout:
s.startNoverlap();
//s.refresh();
// Initialize the dragNodes plugin:
var dragListener = sigma.plugins.dragNodes(s, s.renderers[0]);
dragListener.bind('startdrag', function(event) {
});
dragListener.bind('drag', function(event) {
});
dragListener.bind('drop', function(event) {
});
dragListener.bind('dragend', function(event) {
});