Skip to main content
# Radial Distance Layout

Generates a radial layout for trees whose nodes are associated with a distance to the root, similar to how it has been done in [1]. You can choose the basic method or a more sophisticated version which makes a more efficient use of space.

[1] *The Hidden Geometry of Complex, Network-Driven Contagion Phenomena*, D Brockmann, D Helbing, Science Vol. 342, Issue 6164, pp. 1337-1342 (2013)

## Install

$ sudo python setup.py install

## Example

$ python example.py

or look here:

```
#!python
from radial_distance_layout import radial_distance_layout
import matplotlib.pyplot as pl
import networkx as nx

paths = [ [ 'a','b','c'] ]
paths += [ [ 'a','b','d'] ]
paths += [ [ 'a','e','f','g'] ]
paths += [ [ 'a','e','f','h'] ]
paths += [ [ 'a','e','i'] ]
paths += [ [ 'a','j','k'] ]
paths += [ [ 'a','j','l'] ]

dists = {'a': 0,
'b':1.1, 'e': 1.2, 'j': 1.4,
'c':2.1, 'd': 2.2, 'f': 2.1, 'i': 2.34, 'k':3.8, 'l':2.5,
'g': 3.9, 'h': 3.8}

#The Tree has to be a DiGraph! The root is always the one with distance 0.
T = nx.DiGraph()

for p in paths:
T.add_path(p)

keystr = 'dist'

nx.set_node_attributes(T,keystr,dists)

fig,ax = pl.subplots(1,2,figsize=(15,8))

pos = radial_distance_layout(T,keystr,mode='soph')
nx.draw_networkx(T,pos,ax=ax[0])
pos = radial_distance_layout(T,keystr,mode='normal')
nx.draw_networkx(T,pos,ax=ax[1])
pl.show()

```

Metadata

Release files for radial-distance-layout 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for radial-distance-layout 0.1
File Size Uploaded Provenance Actions
radial-distance-layout-0.1.tar.gz 3.8 kB Without provenance Details for radial-distance-layout-0.1.tar.gz

Release files / radial-distance-layout-0.1.tar.gz

Download URL radial-distance-layout-0.1.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ceeeedb7becbfb2fd154ca7902ad6478eac308783027690a029b696fe8a5e740
BLAKE2b-256 checksum
How to use checksums
b3e424d8ab3245b0780749b119ccf9f21f5fbb38bb37ab76a10381be2018e9ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for radial-distance-layout 0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page