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)
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)
Contributing
Issues and Pull requests are very welcome! [On GitHub](https://github.com/brandones/graphpca).
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)
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f52eea9590e8575050af3368bf62a4506de513280fa5d65e6db37eaab549237e
|
|
| MD5 |
96de145a3f839681b06a557fad97edcb
|
|
| BLAKE2b-256 |
3d8f682e1594aff9f7138bead7f5c310e5690251c137b32b1c12c28ca1fd33c3
|