Before this package can be used, dependencies must be installed.
python3 -m pip install forcelayout
or
python3 -m pip install -r requirements.txt
Locations of the three main algorithms of this project:
- Chalmers' 1996 algorithm is implemented in
forcelayout/algorithms/neighbour_sampling.py
- Hybrid Layout algorithm is implemented in
forcelayout/algorithms/hybrid.py
- Pivot Layout algorithm is implemented in
forcelayout/algorithms/pivot.py
Documentation on full usage of the forcelayout
package is available in the forcelayout/README.md
Examples are contained in the examples/
folder. Three command line scripts are included and a jupyter notebook.
This script will create a static layout of the poker hands dataset rendering using matplotlib. This shows the colouring functionality and annotations for each node when hovered. Nodes can be clicked to highlight other nodes based on the algorithm:
- Chalmers' 1996: Highlight the nodes in the neighbour set for the selected node.
- Hybrid: Highlight the nodes in the sample layout
- Pivot: Highlight the pivot nodes
The size of dataset can be changed to any available size in datasets/poker/
and the algorithms available are: brute
, chalmers96
, hybrid
and pivot
.
Run it using the following commands:
cd examples/
# python3 poker_hands_layout.py [size] [brute | chalmers96 | hybrid | pivot]
python3 poker_hands_layout.py 500 pivot
This is similar to the above example but will show an animated version of the layout.
cd examples/
# python3 poker_hands_layout.py [size] [brute | chalmers96 | hybrid | pivot]
python3 animated_poker_hands_layout.py 500 pivot
This will show an animated layout of the iris dataset using Chalmers' 1996 algorithm, also an image will be saved of the final layout.
cd examples/
python3 iris_layout.py
This is an example notebook creating layouts of the poker hands dataset. Jupyter notebook is required to run this which can be installed here.
In order to run tests, pytest
is required:
python3 -m pip install pytest
To run the test cases run the following command from the root directory:
python3 -m pytest forcelayout/ tests/forcelayout
Note that the test cases are written and run on Ubuntu 18.04 with Python 3.6.7 with Pytest 4.0.2.
I do not own the datasets in this repository, they can be accessed from their source at: