Published
Edited
Apr 19, 2022
13 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
edges = FileAttachment("mobilite_edges.csv").csv()
Insert cell
nodes = FileAttachment("mobilite_nodes.csv").csv()
Insert cell
Insert cell
graph = {
let graph = new Graph({type: 'undirected', weighted: true, weight: 'weight'})
nodes.forEach(n => {
graph.addNode(n.id)
})
edges.forEach((e) => {
graph.addEdge(e.source, e.target, {weight: +e.weight, size: (+e.size - 1)})
})
GraphologyLibrary.communitiesLouvain.assign(graph, {
resolution: 1 // the higher, more communities
})
return graph
}
Insert cell
Insert cell
renderer = {
GraphologyLibrary.layout.circular.assign(graph) // Disposition de départ. circular peut être remplacé par random ou circlepack
let sensibleSettings = GraphologyLibrary.layoutForceAtlas2.inferSettings(graph)
//sensibleSettings.gravity = 0.01
//sensibleSettings.scalingRatio = 10
sensibleSettings.outboundAttractionDistribution = true

GraphologyLibrary.layoutForceAtlas2.assign(graph, {iterations: 1000, settings: sensibleSettings, getEdgeWeight: "weight"})

GraphologyLibrary.layoutNoverlap.assign(graph) // traitement complémentaire pour réduire les superpositions

add_colors_sizes_to_graph() // ajout d'infos au graphe pour conversion en variables visuelles : couleurs et taille des cercles

return new Sigma.Sigma(graph, document.getElementById('sigma-container'),
{labelRenderedSizeThreshold: 2.5} // densité réglable d'étiquettes de villes
)
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
graph.degree('Toulouse')
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more