Skip to content

Amritha16/Dynamic-Network-Viz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Copenhagen Contact Network

A dynamic contact network visualisation of the copenhagen network set.

About the dataset:

The dataset was a temporal contact network obtained from the copenhagen networks study.
https://www.nature.com/articles/s41597-019-0325-x
The data is present as a temporal, weighted edge list, and each edge is described using (1) the timestamp of the beginning of the timebin in seconds, (2, 3) the IDs of users who discovered each other, (4) the measured received signal strength in dB. The study was conducted in a closed space and the bluetooth signals from the device (phones of participants) iteractions. The signals are in the range of [-100, 0], with the signal strength being inversely proportional to the distance between the interacting devices.
The input dataset was of the form (timestamp, user A, user B, rssi) and was processed in into a json format for use in the following javascript code.

About the visualisation:

-> Node of the node is greater for nodes with higher degree centrality.
-> Color of the link is darker for nodes that have come in close contact. The distance is determined by the signal strength, i.e, rssi value.
-> The stride range will tell the range of time present displayed in the graph, eg, 1 min, 5 min, 1 hr, etc. (I would recommend increasing the range since in a 1 min range, there's not many edges)
-> No.of strides/sec: Using the corresponding buttons will increase/decrease the speed of the player -> The number of links at each corresponding range is also displayed.
-> This visualisation allows for a zoom in and zoom out too.

Additional code:

Since the existing templates from d3.js wasn't really that pretty, I switched to R's igrah package. The input file was a csv. Using some helper python code, and the positions from the igraph package, a json file was generated. And this was the file that was used by the javascript to generate a beautiful dynamic visualisation.

To run the code:

Download the files and run automate.sh which runs the preprocessingForR.py, getPositions.R and toJSON.py one by one to generate the JSON file.

https://observablehq.com/@amritha16/contact-network

View this notebook in your browser by running a web server in this folder. For example:

npx http-server

Or, use the Observable Runtime to import this module directly into your application. To npm install:

npm install @observablehq/runtime@4
npm install https://api.observablehq.com/d/6fbd15e35fccec7b.tgz?v=3

Then, import your notebook and the runtime as:

import {Runtime, Inspector} from "@observablehq/runtime";
import define from "@amritha16/contact-network";

To log the value of the cell named “foo”:

const runtime = new Runtime();
const main = runtime.module(define);
main.value("foo").then(value => console.log(value));

About

A dynamic contact network visualisation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published