Skip to main content

Produces a low-dimensional representation of the input graph

Project description

Produces a low-dimensional representation of the input graph.

Calculates the ECTD [1] of the graph and reduces its dimension using PCA. The result is an embedding of the graph nodes as vectors in a low-dimensional space.

Graph data in this repository is courtesy of University of Florida Sparse Matrix Collection.

Python 3.x and 2.6+.

See the API docs: https://brandones.github.io/graphpca/

Usage

Draw a graph, including edges, from a mat file

>>> import scipy.io
>>> import networkx as nx
>>> import graphpca
>>> mat = scipy.io.loadmat('test/bcspwr01.mat')
>>> A = mat['Problem'][0][0][1].todense()  # that's just how the file came
>>> G = nx.from_numpy_array(A)
>>> graphpca.draw_graph(G)
output/bcspwr01-drawing.png

Get a 2D PCA of a high-dimensional graph and plot it.

>>> import networkx as nx
>>> import graphpca
>>> g = nx.erdos_renyi_graph(1000, 0.2)
>>> g_2 = graphpca.reduce_graph(g, 2)
>>> graphca.plot_2d(g_2)
output/erg-1000.png

Contributing

Issues and Pull requests are very welcome! [On GitHub](https://github.com/brandones/graphpca).

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

graphpca-1.1.1.tar.gz (7.0 kB view details)

Uploaded Source

File details

Details for the file graphpca-1.1.1.tar.gz.

File metadata

  • Download URL: graphpca-1.1.1.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for graphpca-1.1.1.tar.gz
Algorithm Hash digest
SHA256 f52eea9590e8575050af3368bf62a4506de513280fa5d65e6db37eaab549237e
MD5 96de145a3f839681b06a557fad97edcb
BLAKE2b-256 3d8f682e1594aff9f7138bead7f5c310e5690251c137b32b1c12c28ca1fd33c3

See more details on using hashes here.

Supported by

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