ARE-d3js
January 4, 2026 ยท View on GitHub
A D3.js GUI for Information Retrieval and Visualization of Extracted Relations.
Stack:
- Flask -- web server
- ARElight -- AI / NLP backend ๐ค
- nlp-thidgate -- providers for NLP components ๐ฆ๏ธ
Installation
Clone project and install dependencies:
pip install -r dependencies.txt
Usage
python3 server.py
You may follow the UI page at http://127.0.0.1:8000/
Data Layout
noutput/
โโโ description/
โโโ ... // graph descriptions in JSON.
โโโ force/
โโโ ... // force graphs in JSON.
โโโ radial/
โโโ ... // radial graphs in JSON.
โโโ index.html // main HTML demo page.
Graph Operations
For graph analysis you can perform several graph operations by this script:
- Arguments mode:
python3 -m arelight.run.operations \
--operation "<OPERATION-NAME>" \
--graph_a_file output/force/boris.json \
--graph_b_file output/force/rishi.json \
--weights y \
-o output \
--description "[OPERATION] between Boris Johnson and Rishi Sunak on X/Twitter"
- Interactive mode:
python3 -m arelight.run.operations
arelight.run.operations allows you to operate ARElight's outputs using graphs: you can merge graphs, find their similarities or differences.
Parameters
--graph_a_fileand--graph_b_fileare used to specify the paths to the.jsonfiles for graphs A and B, which are used in the operations. These files should be located in the<your_output/force>folder.--name-- name of the new graph.--description-- description of the new graph.--host-- determines the server port to host after the calculations.-o-- option allows you to specify the path to the folder where you want to store the output. You can either create a new output folder or use an existing one that has been created by ARElight.
Parameter operation
operationPreparation
Consider that you used ARElight script for X/Twitter
to infer relations from
messages of UK politicians Boris Johnson and Rishi Sunak:
python3 -m arelight.run.infer ...other arguments... \
-o output --collection-name "boris" --from-files "twitter_boris.txt"
python3 -m arelight.run.infer ...other arguments... \
-o output --collection-name "rishi" --from-files "twitter_rishi.txt"
According to the results section, you will have output directory with 2 files force layout graphs:
output/
โโโ force/
โโโ rishi.json
โโโ boris.json
List of Operations
You can do the following operations to combine several outputs, ot better understand similarities, and differences between them:
UNION - combine multiple graphs together.
- The result graph contains all the vertices and edges that are in and .
The edge weight is given by , and the vertex weight is its weighted degree centrality: .
python3 -m arelight.run.operations --operation UNION \ --graph_a_file output/force/boris.json \ --graph_b_file output/force/rishi.json \ --weights y -o output --name boris_UNION_rishi \ --description "UNION of Boris Johnson and Rishi Sunak Twits"
INTERSECTION - what is similar between 2 graphs?
- The result graph contains only the vertices and edges common to and .
The edge weight is given by , and the vertex weight is its weighted degree centrality: .
python3 -m arelight.run.operations --operation INTERSECTION \ --graph_a_file output/force/boris.json \ --graph_b_file output/force/rishi.json \ --weights y -o output --name boris_INTERSECTION_rishi \ --description "INTERSECTION between Twits of Boris Johnson and Rishi Sunak"
DIFFERENCE - what is unique in one graph, that another graph doesn't have?
- NOTE: this operation is not commutative )_
- The results graph contains all the vertices from but only includes edges from that either don't appear in or have larger weights in compared to .
The edge weight is given by if , and .
python3 -m arelight.run.operations --operation DIFFERENCE \ --graph_a_file output/force/boris.json \ --graph_b_file output/force/rishi.json \ --weights y -o output --name boris_DIFFERENCE_rishi \ --description "Difference between Twits of Boris Johnson and Rishi Sunak"
Parameter weights
weightsYou have the option to specify whether to include edge weights in calculations or not. These weights represent the frequencies of discovered edges, indicating how often a relation between two instances was found in the text analyzed by ARElight.
--weightsy: the result will be based on the union, intersection, or difference of these frequencies.n: all weights of input graphs will be set to 1. In this case, the result will reflect the union, intersection, or difference of the graph topologies, regardless of the frequencies. This can be useful when the existence of relations is more important to you, and the number of times they appear in the text is not a significant factor.
Note that using or not using the
weightsoption may yield different topologies: