💼DSN Traveller

Travelling the Matrix network, for Science!

A Glimpse of the Matrix: Measurement Data

In conjunction with the Poster Abstract and the Extended Tech Report, we publish the used anonymized snapshot of the network structure of the public Matrix federation from 2018-07-25. We used the petgraph library for creating and analyzing this graph, which is why the graph is in a json format native to the library's data structure.

How to parse the format in Rust

Minimal Rust example using serde_json and petgraph:


use std::path::Path;
use std::fs;
use std::io;
use serde::Deserialize;

pub type Graph = petgraph::Graph<Node, (), petgraph::Undirected>;

#[derive(Deserialize)]
pub struct Node {
    pub kind: NodeType,
    pub id: u64,
}

#[derive(Deserialize)]
pub enum NodeType {
    Room,
    User,
    Server,
}


pub fn read_graph<P: AsRef<Path>>(path: P)
  -> Result<Graph, serde_json::Error> {
    let file = fs::File::open(path).unwrap();
    let reader = io::BufReader::new(file);
    serde_json::from_reader(reader)
}

        

Format Example

A small example graph as pretty-printed json looks like this:


{
   "edge_property" : "undirected",
   "edges" : [
      [ 0, 5, null ],
      [ 1, 6, null ],
      [ 2, 7, null ],
      [ 3, 7, null ],
      [ 4, 8, null ],
      [ 0, 9, null ],
      [ 5, 9, null ],
      [ 1, 9, null ],
      [ 6, 9, null ],
      [ 0, 10, null ],
      [ 5, 10, null ],
      [ 1, 10, null ],
      [ 6, 10, null ],
      [ 2, 10, null ],
      [ 3, 10, null ],
      [ 7, 10, null ],
      [ 4, 10, null ],
      [ 8, 10, null ],
      [ 2, 11, null ],
      [ 3, 11, null ],
      [ 7, 11, null ]
   ],
   "node_holes" : [],
   "nodes" : [
      { "id" : 0, "kind" : "User" },
      { "id" : 1, "kind" : "User" },
      { "id" : 2, "kind" : "User" },
      { "id" : 3, "kind" : "User" },
      { "id" : 4, "kind" : "User" },
      { "id" : 5, "kind" : "Server" },
      { "id" : 6, "kind" : "Server" },
      { "id" : 7, "kind" : "Server" },
      { "id" : 8, "kind" : "Server" },
      { "id" : 9, "kind" : "Room" },
      { "id" : 10, "kind" : "Room" },
      { "id" : 11, "kind" : "Room" }
   ]
}

        

License

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.