Skip to main content

XGI extension for faster hypergraph operations

Project description

What has been done?:

Metrics computation has been updated

The computation of the linegraph vector centrality metric was accelerated by using the с++ instead of python. For comparison, implementations using the networkx.Graph class were retained.

H_enron = xgi.load_xgi_data("plant-pollinator-mpl-034")
H_enron_cleaned = H_enron.cleanup(
    multiedges=False, singletons=False, isolates=False, relabel=True, in_place=False
)
start_time = time.time()

xgi.centrality.line_vector_centrality(H_enron_cleaned)

middle_time = time.time()

xgi_optimized.vector_centrality(H_enron_cleaned, 3)

end_time = time.time()

print(f"Время выполнения python: {(middle_time-start_time):.6f} секунд")
print(f"Время выполнения c++: {(end_time-middle_time):.6f} секунд")

The implementation of bipartite graphs has been changed.

The implementation for working with bipartite graphs was modified: the igraph.Graph class is now used instead of networkx.Graph for converting from a Hypergraph to a bipartite graph and back to a Hypergraph .

hg = xgi.Hypergraph()
hg.add_edges_from(
    [[1, 2, 3], [3, 4, 5,8], [1, 4, 10, 11, 12], [7,0,8], [5,7,2]]
)

bpg = xgi_optimized.biparite_graph.to_bipartite_graph(hg)

Cpp implementation of сhecking graph connectivity

size = 38
hg = xgi.fast_random_hypergraph(size,[0.1, 0.2, 0.02,0.04])
start_time = time.time() 
xgi_optimized.connected.is_connected(hg)
middle_time = time.time()
xgi.centrality.is_connected(hg)
end_time = time.time()
print(f"Время выполнения c++: {(middle_time-start_time):.6f} секунд")
print(f"Время выполнения python: {(end_time-middle_time):.6f} секунд")

Cpp implementation of сhecking graph connectivity

size = 38
hg = xgi.fast_random_hypergraph(size,[0.1, 0.2, 0.02,0.04])
start_time = time.time() 
xgi_optimized.connected.is_connected(hg)
middle_time = time.time()
xgi.centrality.is_connected(hg)
end_time = time.time()
print(f"Время выполнения c++: {(middle_time-start_time):.6f} секунд")
print(f"Время выполнения python: {(end_time-middle_time):.6f} секунд")

Added the ability to use the package of accelerated functions on hypergraphs

pip install xgi_optimized

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

xgi_optimized-0.11.1.tar.gz (59.7 kB view details)

Uploaded Source

Built Distribution

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

xgi_optimized-0.11.1-cp313-cp313-manylinux_2_17_x86_64.whl (291.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

File details

Details for the file xgi_optimized-0.11.1.tar.gz.

File metadata

  • Download URL: xgi_optimized-0.11.1.tar.gz
  • Upload date:
  • Size: 59.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for xgi_optimized-0.11.1.tar.gz
Algorithm Hash digest
SHA256 9043abf80e33bc4dc222861ea244b6ab4f0be99cb41de7764b88d2e5b1d1f7ce
MD5 a5851f6b8b22be8eb1eb3d4cd5fc528b
BLAKE2b-256 2c1f9c7486f133623ae7a575c12e79b6ade15794c53e190a1d07c351b77e66a9

See more details on using hashes here.

File details

Details for the file xgi_optimized-0.11.1-cp313-cp313-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for xgi_optimized-0.11.1-cp313-cp313-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 0a808c9a4c662887541bc6c4fffe682070fbe92f604cf81c821cef5966aed086
MD5 d2a00c5e4fd5f94d1a59ef72822c3e07
BLAKE2b-256 3e7cc0b39f5125ce7df2fb0bd526d1dc1b107c0552896a625676164291f6d766

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