Platform
Resources
Pricing
Sign in
Contact us
John Alexis Guerra Gómez
I love to build dataviz for insight discovery. I also love to put technology to the service of humanity
Workspace
Fork
Public
Networks
By
John Alexis Guerra Gómez
Edited
Nov 22
Networks
StackOverflow Survey Work vs Want
CS Faculty Hiring Network
My Tweets' Hashtags 2024
netClustering.js
Relative centering force
Network visualization Vega-Lite
BioFabric
Force-directed Graph with Edge-bundling
Network Utilities
Get Common Connections
Insert cell
Insert cell
Insert cell
target
=
html
`<div></div>`
Insert cell
update
=
(
doLinks
)
=>
vl
.
layer
(
doLinks
?
[
chartLinks
,
chartNodes
]
:
[
chartNodes
]
)
.
width
(
width
)
.
height
(
width
/
2
)
.
render
(
{
container
:
target
}
)
Insert cell
chartNodes
=
vl
.
markCircle
(
)
.
data
(
network
.
nodes
)
.
encode
(
vl
.
x
(
)
.
fieldQ
(
"x"
)
.
axis
(
null
)
,
vl
.
y
(
)
.
fieldQ
(
"y"
)
.
axis
(
null
)
,
vl
.
color
(
)
.
fieldN
(
"cluster"
)
)
Insert cell
chartLinks
=
vl
.
markRule
(
)
.
data
(
network
.
links
)
.
encode
(
vl
.
x
(
)
.
fieldQ
(
"source.x"
)
.
axis
(
null
)
,
vl
.
y
(
)
.
fieldQ
(
"source.y"
)
.
axis
(
null
)
,
vl
.
x2
(
)
.
fieldQ
(
"target.x"
)
,
vl
.
y2
(
)
.
fieldQ
(
"target.y"
)
,
vl
.
color
(
)
.
value
(
"#aaa3"
)
)
Insert cell
onClusterData
=
{
if
(
clusterData
)
{
netClustering
.
cluster
(
network
.
nodes
,
network
.
links
)
;
simulation
.
alphaTarget
(
0.7
)
;
update
(
)
;
}
}
Insert cell
simulation
=
{
const
simulation
=
d3
.
forceSimulation
(
network
.
nodes
)
.
force
(
"charge"
,
d3
.
forceManyBody
(
)
.
strength
(
-
300
)
)
.
force
(
"link"
,
d3
.
forceLink
(
network
.
links
)
.
strength
(
0.2
)
.
distance
(
30
)
)
;
simulation
.
on
(
"tick"
,
(
)
=>
update
(
simulation
.
alpha
(
)
<
0.5
)
)
;
update
(
)
;
return
simulation
;
}
Insert cell
network
=
d3
.
json
(
"https://gist.githubusercontent.com/john-guerra/6b11c24ca722dba7a8d87e827a457084/raw/0d052d64cb86321bd72b1da01fe7ed96ae82f663/citationsNetwork2018.min.json"
)
.
then
(
network
=>
{
network
.
nodes
.
forEach
(
n
=>
{
delete
n
.
cluster
;
delete
n
.
x
;
delete
n
.
y
;
}
)
;
return
network
;
}
)
Insert cell
import
{
vl
}
from
"@vega/vega-lite-api"
Insert cell
d3
=
require
(
"d3@5"
)
Insert cell
netClustering
=
require
(
"netclustering"
)
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.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
clusterData
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
target
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
update
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
chartNodes
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
chartLinks
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
onClusterData
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
simulation
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
network
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
d3
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
netClustering
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML