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: 4149,
label: 'Célia Caillet-Saguy',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2015/05/research_pasteur-celia-caillet-saguy-img-20240421-203216-150x150.jpg',
x: 0,
y: 0,
size: 30,
color: '#DDDDDD'
});
var biggest_node_size = 0;
N=8
// 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: 231566,
label: 'COURSE: Structure et fonction des protéines',
x: x_node,
y: y_node,
type: 'image',
url: '',
page_url: 'https://research.pasteur.fr/en/course/cours-structure-et-fonction-des-proteines/',
size: 35,
color: '#DDDDDD'
});
//link content to central post
g.edges.push({
id: 4149231566,
size: 0.5,
source: 4149,
target: 231566,
});
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 4149) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 2315664149,
size: 0.5,
source: 231566,
target: 4149 });
//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: 836,
label: 'Thierry Rose',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2015/02/Thierry_Rose-e1423234985507-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/member/thierry-rose/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 231566836,
size: 0.5,
source: 231566,
target: 836 });
//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: 4156,
label: 'Nicolas Wolff',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2015/09/research.pasteur.fr_photo-du-30-09-2015-a-09.47-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/member/nicolas-wolff/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 2315664156,
size: 0.5,
source: 231566,
target: 4156 });
//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: 7063,
label: 'Monica Sala',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2015/05/research_pasteur-monica-sala-research-pasteur-monica-sala-monicaphoto2020-3-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/member/monica-sala/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 2315667063,
size: 0.5,
source: 231566,
target: 7063 });
//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: 7199,
label: 'Hervé Waxin',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2015/07/research.pasteur.fr_herve-150x150.jpeg',
page_url: 'https://research.pasteur.fr/en/member/herve-waxin/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 2315667199,
size: 0.5,
source: 231566,
target: 7199 });
//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: 232303,
label: 'Sarah Michel-Anfray',
type: 'image',
url: '',
page_url: 'https://research.pasteur.fr/en/member/sarah-michel-anfray/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 231566232303,
size: 0.5,
source: 231566,
target: 232303 });
//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: 90725,
label: 'Virginie Ponticelli',
type: 'image',
url: '',
page_url: 'https://research.pasteur.fr/en/member/virginie-ponticelli/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 23156690725,
size: 0.5,
source: 231566,
target: 90725 });
// 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: 189882,
label: 'PROJECT: Hijacking of host PDZ proteins during hepatitis B virus infection',
x: x_node,
y: y_node,
type: 'image',
url: '',
page_url: 'https://research.pasteur.fr/en/project/hijacking-of-host-pdz-proteins-during-hepatitis-b-virus-infection/',
size: 35,
color: '#DDDDDD'
});
//link content to central post
g.edges.push({
id: 4149189882,
size: 0.5,
source: 4149,
target: 189882,
});
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 4149) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 1898824149,
size: 0.5,
source: 189882,
target: 4149 });
// 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: 168161,
label: 'COURSE: Biochimie des Protéines',
x: x_node,
y: y_node,
type: 'image',
url: '',
page_url: 'https://research.pasteur.fr/en/course/biochimie-des-proteines-2/',
size: 35,
color: '#DDDDDD'
});
//link content to central post
g.edges.push({
id: 4149168161,
size: 0.5,
source: 4149,
target: 168161,
});
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 4149) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 1681614149,
size: 0.5,
source: 168161,
target: 4149 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 4156) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 1681614156,
size: 0.5,
source: 168161,
target: 4156 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 836) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 168161836,
size: 0.5,
source: 168161,
target: 836 });
// 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: 163557,
label: 'PROJECT: Myosins-Usher2 proteins complexes in hearing loss',
x: x_node,
y: y_node,
type: 'image',
url: '',
page_url: 'https://research.pasteur.fr/en/project/myosins-usher2-proteins-complexes-in-hearing-loss/',
size: 35,
color: '#DDDDDD'
});
//link content to central post
g.edges.push({
id: 4149163557,
size: 0.5,
source: 4149,
target: 163557,
});
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 4149) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 1635574149,
size: 0.5,
source: 163557,
target: 4149 });
// 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: 148381,
label: 'COURSE: Biochimie des Protéines',
x: x_node,
y: y_node,
type: 'image',
url: '',
page_url: 'https://research.pasteur.fr/en/course/biochimie-des-proteines/',
size: 35,
color: '#DDDDDD'
});
//link content to central post
g.edges.push({
id: 4149148381,
size: 0.5,
source: 4149,
target: 148381,
});
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 4149) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 1483814149,
size: 0.5,
source: 148381,
target: 4149 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 836) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 148381836,
size: 0.5,
source: 148381,
target: 836 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 4156) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 1483814156,
size: 0.5,
source: 148381,
target: 4156 });
// 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: 144475,
label: 'PROJECT: Identification of cellular PDZ-containing Proteins targeted by the virus SARS-Cov-2 during infection (PPCOVi)',
x: x_node,
y: y_node,
type: 'image',
url: '',
page_url: 'https://research.pasteur.fr/en/project/identification-of-cellular-pdz-containing-proteins-targeted-by-the-virus-sars-cov-2-during-infection-ppcovi/',
size: 35,
color: '#DDDDDD'
});
//link content to central post
g.edges.push({
id: 4149144475,
size: 0.5,
source: 4149,
target: 144475,
});
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 4149) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 1444754149,
size: 0.5,
source: 144475,
target: 4149 });
//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: 4928,
label: 'Yves Jacob',
type: 'image',
url: '',
page_url: 'https://research.pasteur.fr/en/?post_type=member&p=4928',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 1444754928,
size: 0.5,
source: 144475,
target: 4928 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 4156) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 1444754156,
size: 0.5,
source: 144475,
target: 4156 });
// adding node
var x_node = Math.cos(2 * 6 * Math.PI / N) * 10;
var y_node = Math.sin(2 * 6 * Math.PI / N) * 10;
g.nodes.push({
id: 103035,
label: 'PROJECT: Mutations in PDZ Binding Motif (PBM)-containing proteins associated to the Usher syndrome',
x: x_node,
y: y_node,
type: 'image',
url: '',
page_url: 'https://research.pasteur.fr/en/project/mutations-pdz-binding-motif-pbm-containing-proteins-associated-usher-syndrome/',
size: 35,
color: '#DDDDDD'
});
//link content to central post
g.edges.push({
id: 4149103035,
size: 0.5,
source: 4149,
target: 103035,
});
//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: 4147,
label: 'Florence Cordier',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2019/08/research_pasteur-photo_flo_2019.06.25a_crop-2-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/member/florence-cordier/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 1030354147,
size: 0.5,
source: 103035,
target: 4147 });
//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: 93342,
label: '',
type: 'image',
url: '',
page_url: '',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 10303593342,
size: 0.5,
source: 103035,
target: 93342 });
//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: 103007,
label: 'Baptiste Colcombet-Cazenave',
type: 'image',
url: '',
page_url: 'https://research.pasteur.fr/en/?post_type=member&p=103007',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 103035103007,
size: 0.5,
source: 103035,
target: 103007 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 4149) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 1030354149,
size: 0.5,
source: 103035,
target: 4149 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 4156) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 1030354156,
size: 0.5,
source: 103035,
target: 4156 });
// adding node
var x_node = Math.cos(2 * 7 * Math.PI / N) * 10;
var y_node = Math.sin(2 * 7 * Math.PI / N) * 10;
g.nodes.push({
id: 6119,
label: 'TEAM: Humoral Immunology',
x: x_node,
y: y_node,
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2015/05/research_pasteur-enhumoral-immunology-frimmunologie-humorale-bandeau-labo-mouquet-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/team/humoral-immunology/',
size: 35,
color: '#DDDDDD'
});
//link content to central post
g.edges.push({
id: 41496119,
size: 0.5,
source: 4149,
target: 6119,
});
//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: 7732,
label: 'Valérie Lorin',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2015/07/research.pasteur.fr_val-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/member/valerie-lorin/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 61197732,
size: 0.5,
source: 6119,
target: 7732 });
//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: 85533,
label: 'Pierre Rosenbaum',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2017/03/research.pasteur.fr_dsc0589-copie-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/member/pierre-rosenbaum/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 611985533,
size: 0.5,
source: 6119,
target: 85533 });
//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: 126491,
label: 'Sophie Mutricy',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2019/05/research_pasteur-sophie-mutricy-s.-mutricy-photo-badge-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/member/mutricy-sophie/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 6119126491,
size: 0.5,
source: 6119,
target: 126491 });
//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: 83681,
label: 'Cyril Planchais',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2017/01/research.pasteur.fr_cyril-1-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/member/cyril-planchais/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 611983681,
size: 0.5,
source: 6119,
target: 83681 });
//check if content already exist
// update node size depending on the amount of edges
g.nodes.forEach(function(n) {
if (n.id == 4149) {
n.size = n.size + 8;
}
});
//link to content
g.edges.push({
id: 61194149,
size: 0.5,
source: 6119,
target: 4149 });
//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: 210032,
label: 'Lina Boumediene',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2023/10/research_pasteur-enlina-boumedienefrlina-boumediene-img-8807bis-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/member/lina-boumediene/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 6119210032,
size: 0.5,
source: 6119,
target: 210032 });
//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: 230197,
label: 'Marius Allombert',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2024/09/research_pasteur-enmarius-allombertfrmarius-allombert-img-1375-150x150.jpg',
page_url: 'https://research.pasteur.fr/en/member/marius-allombert/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 6119230197,
size: 0.5,
source: 6119,
target: 230197 });
//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: 4575,
label: 'Hugo Mouquet',
type: 'image',
url: 'https://research.pasteur.fr/wp-content/uploads/2019/05/research_pasteur-mouquet_id-150x150.png',
page_url: 'https://research.pasteur.fr/en/member/hugo-mouquet/',
x: x_site,
y: y_site,
size: 10,
color: '#dddddd'
});
//link to content
g.edges.push({
id: 61194575,
size: 0.5,
source: 6119,
target: 4575 });
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) {
});