Skip to main content

Infer communities, hierarchies, and their connection in directed graphs

Project description

directedstructure

Documentation Status PyPI version PyPI platforms

Infer communities, hierarchies, and their connection in directed graphs

Maximilian Jerdee, Elizabeth Bruch, Mark Newman

This python package uses Bayesian inference to identify communities and hierarchies of nodes in a directed network, as well as measure the interaction between those structures.

We model community structure using a stochastic block model, hierarchy structure with a Bradley-Terry model, and their interaction according to our work here [link paper].

Installation

directedstructure can be built locally by cloning this repository and running

pip install .

in the base directory (requires a C++ compiler).

Typical usage

Once installed, the package can be used to identify the network structures.

Load a network

We recommend using NetworkX to load the network and then using the directedstructure package to infer the node grouping and hierarchy.

import directedstructure as ds
import networkx as nx
import pandas as pd

# Load a network using NetworkX (this can also be read from an edgelist or other format)
G = nx.read_gml("examples/data/friends.gml")

Infer node properties

node_properties_df = ds.node_properties(G) # pandas DataFrame of inferred community identity and hierarchical position of each node in the network

Infer network properties

network_properties_df = ds.network_properties(G) # pandas DataFrame of network properties (for example depth of hierarchy within and between communities) inferred by the model, as well as their uncertainities

Full samples

To get a more complete picture of the inference, we can consider the full posterior distribution of Monte Carlo samples

samples_df = ds.samples(G)

With these samples we can ask more detailed questions like what is the posterior distribution of possible numbers of groups?

Customization

As this package focuses on the potential link between community and hierarchy, we can swap out the models considered of either community or hierarchy in isolation.

Neutral interactions can also be considered within the model if further interaction type information is provided (either type = dominant or type = neutral). If no type information is provided all interactions will be assumed to be dominant.

Further usage examples can be found in the examples directory of the repository and the package documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

directedstructure-0.1.1.tar.gz (6.6 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

directedstructure-0.1.1-cp313-cp313-win_amd64.whl (232.6 kB view details)

Uploaded CPython 3.13Windows x86-64

directedstructure-0.1.1-cp313-cp313-musllinux_1_2_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

directedstructure-0.1.1-cp313-cp313-musllinux_1_2_i686.whl (1.3 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ i686

directedstructure-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (208.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

directedstructure-0.1.1-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl (219.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ i686

directedstructure-0.1.1-cp313-cp313-macosx_11_0_arm64.whl (158.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

directedstructure-0.1.1-cp312-cp312-win_amd64.whl (232.5 kB view details)

Uploaded CPython 3.12Windows x86-64

directedstructure-0.1.1-cp312-cp312-musllinux_1_2_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

directedstructure-0.1.1-cp312-cp312-musllinux_1_2_i686.whl (1.3 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ i686

directedstructure-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (208.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

directedstructure-0.1.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl (219.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ i686

directedstructure-0.1.1-cp312-cp312-macosx_11_0_arm64.whl (158.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

directedstructure-0.1.1-cp311-cp311-win_amd64.whl (232.5 kB view details)

Uploaded CPython 3.11Windows x86-64

directedstructure-0.1.1-cp311-cp311-musllinux_1_2_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

directedstructure-0.1.1-cp311-cp311-musllinux_1_2_i686.whl (1.3 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ i686

directedstructure-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (210.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

directedstructure-0.1.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (219.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ i686

directedstructure-0.1.1-cp311-cp311-macosx_11_0_arm64.whl (156.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

directedstructure-0.1.1-cp310-cp310-win_amd64.whl (231.0 kB view details)

Uploaded CPython 3.10Windows x86-64

directedstructure-0.1.1-cp310-cp310-musllinux_1_2_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

directedstructure-0.1.1-cp310-cp310-musllinux_1_2_i686.whl (1.3 MB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ i686

directedstructure-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (208.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

directedstructure-0.1.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl (218.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ i686

directedstructure-0.1.1-cp310-cp310-macosx_11_0_arm64.whl (155.3 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file directedstructure-0.1.1.tar.gz.

File metadata

  • Download URL: directedstructure-0.1.1.tar.gz
  • Upload date:
  • Size: 6.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for directedstructure-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5fbbc6de364b49a23ed908354f57a246333848a119813d368052f29bb60d7246
MD5 c9fc81aca70ac7e981e02e04f14abf81
BLAKE2b-256 2f2dc91fb5005da6dca84c593220a6df0e5fa54813c8ed29ab96cb685809f30c

See more details on using hashes here.

File details

Details for the file directedstructure-0.1.1-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for directedstructure-0.1.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 95dcae6f8c86315d01fdc1f08a9d0e6cc6914ae9c327dd08485695fb3715c4a6
MD5 6387eb7ef21a042b9a0c216d9a86bf58
BLAKE2b-256 3478a8539144b2654be9e61cff105c7fe45030223957e8d25512f07b166532e1

See more details on using hashes here.

File details

Details for the file directedstructure-0.1.1-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for directedstructure-0.1.1-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 dd819f34c44d37768c066065dd1f579ce8894947be2bbd37ac8abae7166c4c7a
MD5 c7f80e75fb1b6374c58f190efbb93946
BLAKE2b-256 0c7cf160f6e58b2c2fbc4d87bec817a5def60a440da74d5a07cd5462590421bc

See more details on using hashes here.

File details

Details for the file directedstructure-0.1.1-cp313-cp313-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for directedstructure-0.1.1-cp313-cp313-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 62c72aeab5e2607c9ccab7c2d714b98b6142196eb30e8799f40955bcfdd21de3
MD5 9c565278e6a0f5805003c22381313f81
BLAKE2b-256 04f73d2bddf6d71fa9e0e6b8e7c87c6f0393f0f74bd8d54376133dcb1058e7be

See more details on using hashes here.

File details

Details for the file directedstructure-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for directedstructure-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 afdb8a29b68b1362d9b0ccc90d5af79c8939feee9cf9853f490acd4ca3db4924
MD5 0af16f4981472ba35b2de4c8e152ff1c
BLAKE2b-256 57388b5955557fd136108ab3dd72e800e11001fc6fce60688c6e02a3cc74cc41

See more details on using hashes here.

File details

Details for the file directedstructure-0.1.1-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for directedstructure-0.1.1-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 60d12d819b7045c0602d08fb37304e07ef71e440e18648514f37808d715933aa
MD5 fc22e770998c1178e7315c9e1ae9f411
BLAKE2b-256 fe5477f66fe0a0b892ffcd1d2a709f576deee237cb78f9731e33a60215ffe23a

See more details on using hashes here.

File details

Details for the file directedstructure-0.1.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for directedstructure-0.1.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b4b5a894e494733d4586ab6695add0f2ccd606f3f74d74c26a3f4f8a4778d88a
MD5 fb08df3f6d1102fa37e7ba240341017f
BLAKE2b-256 85091dcda16294462c37a28089e99f11a1978888b69d74ff03ea5805387c57a7

See more details on using hashes here.

File details

Details for the file directedstructure-0.1.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for directedstructure-0.1.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 001ad2c4270ce0481a3ea61312528e02ed9d4643510d4501b0e315e0c2233c5e
MD5 4fbfabd433dc08df80f2b5aeb6c57f97
BLAKE2b-256 92b18c2c0f79b52c9ab3c3e83807e79003f8808e857b65c739b19f2a23eccf2e

See more details on using hashes here.

File details

Details for the file directedstructure-0.1.1-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for directedstructure-0.1.1-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 9f0930966ebdc7c8fced2b83a472d18298c42f76c5484c174bf6e7c0678e4655
MD5 d6caea8f5823ecfe6a3a09f9e1dd1cc1
BLAKE2b-256 a895f10a195b4a855f4974e906cf89b246fd2c402dabd601d71050d7beba7216

See more details on using hashes here.

File details

Details for the file directedstructure-0.1.1-cp312-cp312-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for directedstructure-0.1.1-cp312-cp312-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 969402389e810a88f0226de0179e11d8f1a65a7f776dd9e936b64deedc72d913
MD5 81394fc8ebd1c5544f267489d423adb9
BLAKE2b-256 15017557c2378e19db71d9f37e99835d734f45eec827a6985ee65cbec535e856

See more details on using hashes here.

File details

Details for the file directedstructure-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for directedstructure-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eaa26f8d518ce2641601c822264bd1c39a197c35e66302b5f7358372a5e5fef7
MD5 e0f5da4f3f310982df6cec86d8157322
BLAKE2b-256 a0b0f79dc666a51e94e40a0636b203f923240b27053aaea675e7ab40cecb00cf

See more details on using hashes here.

File details

Details for the file directedstructure-0.1.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for directedstructure-0.1.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 72041e6829623f0d1070bab1225e3b13cd964478d5859d158b1d1cf9d13d5e93
MD5 6e2815432fc6834bbf08b32c88b7254f
BLAKE2b-256 ae9cb15f0a2dee227513180e54c52969d15adac2313f7283c1c846a1c361b8c0

See more details on using hashes here.

File details

Details for the file directedstructure-0.1.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for directedstructure-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 57278f6a91ed2d8cc237e90e69e35d63e230b244df8432e89b376a82d1846051
MD5 2b545a12ec6948722c304c3808f450d3
BLAKE2b-256 6b1c32a821e4e7c20c5a99bac1eda415c0d9c829be3516ee4b286ec4136fd5d0

See more details on using hashes here.

File details

Details for the file directedstructure-0.1.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for directedstructure-0.1.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c0bdc87b18dac23f99f9cf13e26ded35dc21adaa88baf4cc8dd84d385e86bfa5
MD5 d34ee923a872e6c67cf52a96e8b573a7
BLAKE2b-256 50ed6524c0867a44ad8eb12d14572fbacdbf5beab522851f1c64df888e94b769

See more details on using hashes here.

File details

Details for the file directedstructure-0.1.1-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for directedstructure-0.1.1-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 08d6bad1b003bd15b0035e60f5cb5fc01d281be08b77474e124cb5c85a5420fc
MD5 13c0201dbb57842daeab55c461717d6d
BLAKE2b-256 fc0a07f52251c5d28a08245ae93a184bbeb36dd66dc95034a393215a0b7d4aeb

See more details on using hashes here.

File details

Details for the file directedstructure-0.1.1-cp311-cp311-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for directedstructure-0.1.1-cp311-cp311-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 8a11ec2a8f069613228e843af020325c402f869de7c2b41c38ed27d37024efa0
MD5 876c086de14f3f3b7c269ffda0fd9857
BLAKE2b-256 9090932132761474d08e814d082e59fd3a085518b7ab68d19329646be80d1d9c

See more details on using hashes here.

File details

Details for the file directedstructure-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for directedstructure-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 425d808b15760cd75df00b17ebc8217536655c72243aaf2a9fae9223e79c1854
MD5 122b7b92babe4f89a990d024541bc932
BLAKE2b-256 9140d132e2cafa948137d0652deb2b4d23e6f65fd7c44cec3ffe7b0ddb40a9ed

See more details on using hashes here.

File details

Details for the file directedstructure-0.1.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for directedstructure-0.1.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 9378fd70f5d8ff59c2bd063f3fdb397d7ad7bf6676c8cd6c27413f3a83760d50
MD5 acae6128b15b94eb0a71055e9509d18d
BLAKE2b-256 9fa5c994d0292f1733d2fe51b2adfaae1d75cb6563c484ab08516a870f9ead0d

See more details on using hashes here.

File details

Details for the file directedstructure-0.1.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for directedstructure-0.1.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1d4c8f7ef03d580606353f441eef9ff8a5c1133655907fca99cc1688b4d36211
MD5 12e2dff5eb9f4b8fb453fd5b1b15c213
BLAKE2b-256 51ef3cdde60669881206f43983b4a184751ee67648e9611153e097c08429c2e3

See more details on using hashes here.

File details

Details for the file directedstructure-0.1.1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for directedstructure-0.1.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 bdd5e47f9a670772cc379d958461abea9d90e75d1d15ec9e07b193c6f559feb8
MD5 ff62621ec95dafc46e05943bb157fe70
BLAKE2b-256 38ce5529070156cd2ea58647d0848f71fefe3dd534e08bde568a85ee2c553b4a

See more details on using hashes here.

File details

Details for the file directedstructure-0.1.1-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for directedstructure-0.1.1-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e4aa1381ed342c423e9d4b462b38ed21d71ad83e4145300240c4c77ed431b710
MD5 35783b8599a48e5fd8a56c9c4634a0ac
BLAKE2b-256 90e19b504048c718006de74d7af498172acc01651a9b2b210d1089d0ed745e42

See more details on using hashes here.

File details

Details for the file directedstructure-0.1.1-cp310-cp310-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for directedstructure-0.1.1-cp310-cp310-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 814f711f1abed16f3ad853c5207f7d6909dfa322bb84a53ebe161599e810a4f0
MD5 828367479f001023568d5a3ef4477609
BLAKE2b-256 83fc36fc890c21ee6969404e92f2f28d618c0360a249217df527f16e4a777dcd

See more details on using hashes here.

File details

Details for the file directedstructure-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for directedstructure-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d3eb767cff9ee1c9ac2c4978197cf2d877ad26d76bcf59c5aa214b3814ba023f
MD5 b8231c4c46e2accb353e09d1baf2ca1b
BLAKE2b-256 596563e06e7f7d07b338e04bff8f0ccee85622f49745ee16a1c4ece8aa6ca069

See more details on using hashes here.

File details

Details for the file directedstructure-0.1.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for directedstructure-0.1.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 7efb15f3019c6ec5803d03fa87c3a29a5502823c837b9a3acc0c044af290c4c0
MD5 3ca79bad837351b1402a4560611abc41
BLAKE2b-256 2aceecf63f72e49901efbfcf73b92d504f80b4b27d64fc99fe16d1ee1b9055bb

See more details on using hashes here.

File details

Details for the file directedstructure-0.1.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for directedstructure-0.1.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a63bbc864384ff2cc1dbab963ed921bc1c44a1651fc4bea8332fc5e53cc67fd4
MD5 9d850a938dfd2b08bb820df8c7555e46
BLAKE2b-256 1841a2163ff17dd31b78ce1507d04c1c91c9fdf3e64d515e60c5e0d4a57a471d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page