Public
Edited
Oct 7, 2024
Insert cell
Insert cell
nodes = [
{ id: 0, group: 0 },
{ id: 1, group: 1 },
{ id: 2, group: 0 },
{ id: 3, group: 1 }
]
Insert cell
Insert cell
data = ({ nodes: nodes, links: links })
Insert cell
Insert cell
Insert cell
ForceGraph(data, {
nodeId: (d) => d.id,
nodeGroup: (d) => d.group,
nodeTitle: (d) => `ID: ${d.id}\nGrupo: ${d.group}`,
linkStrokeWidth: (l) => Math.sqrt(l.value),
width,
height: 100,
invalidation // a promise to stop the simulation when the cell is re-run
})
Insert cell
jL = require("https://bundle.run/jlouvain@2.0.0")
Insert cell
community = jL.jLouvain().nodes(node_data).edges(edge_data)
Insert cell
community()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
votos = d3.tsv("https://aaizemberg.github.io/datos/itba/votos_2c2024.tsv")
Insert cell
votos[0]["3"]
Insert cell
nodes_2c2024 = [
...d3.union(
votos.map((d) => d.source),
votos.map((d) => d["1"]),
votos.map((d) => d["2"]),
votos.map((d) => d["3"])
)
].map((d) => ({ id: d }))
Insert cell
Insert cell
links_2c2024.filter((d) => d.source === d.target)
Insert cell
data_2c2024 = ({ nodes: nodes_2c2024, links: links_2c2024 })
Insert cell
Insert cell
links_2c2024
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more