Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New sphere graph #55

Open
wants to merge 372 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
372 commits
Select commit Hold shift + click to select a range
073cdb9
Import all the signals as asked in https://github.com/epfl-lts2/pygsp…
Oct 14, 2018
3f605fb
Simplify from_graphtool()
Oct 17, 2018
2f06053
Cleaner way of adding the signal
Oct 17, 2018
b519b65
Test environement on travis
Dec 27, 2018
531bd11
Bug fix
Feb 3, 2019
6b53fed
Add auto selection of save and load backend based on the format
Feb 7, 2019
7fde447
install dependencies for graph-tool on travis
Feb 7, 2019
d09bb0a
Fix extract_components
cafeal Feb 18, 2019
01fc3ef
test for python > 3.5 only
Feb 18, 2019
40c5755
Fix save for graph_tool (dot, gml)
Feb 18, 2019
ff928da
clean code
Feb 18, 2019
e892d0e
fix verison for test_save_load
Feb 18, 2019
fa369bf
use graph_tool.generation to gen random graph
Feb 19, 2019
023f4fe
remove useless isomorphic testing
Feb 19, 2019
605cbb6
Convert to float the singal when exporting to networkx
Feb 19, 2019
267e37f
skip graph tool tests for python2.7
Feb 19, 2019
a022f8d
Update pygsp/graphs/graph.py
mdeff Feb 19, 2019
f2684e6
Update pygsp/graphs/graph.py
mdeff Feb 19, 2019
393d185
Update pygsp/graphs/graph.py
mdeff Feb 19, 2019
68f0af2
remove support for dot export and import
Feb 20, 2019
957eabe
use graph_tool.spectral.adjacency
Feb 21, 2019
696397e
RandomRing: use a kernel
mdeff Feb 25, 2019
fd917d2
RandomRing: cleanup
mdeff Feb 25, 2019
a10062e
StochasticBlockModel: allow to indefinitely try to get a connected graph
mdeff Feb 25, 2019
1d92574
test: avoid failed tests due to non connected graphs
mdeff Feb 25, 2019
b101d6e
merge all the extra requirements in a single dev requirement
mdeff Feb 25, 2019
d6f2c90
tests: rename suite from documentation to reference
mdeff Feb 25, 2019
438cf74
Add examples
Feb 26, 2019
d97fec6
fix doctest
Feb 26, 2019
a700931
fix expcted nothing error
Feb 26, 2019
9f5f13e
rings need at least 3 vertices
mdeff Feb 27, 2019
fa9c1ae
RandomRing: allow user to pass angles
mdeff Feb 27, 2019
cf65889
readme: remove outdated installation note
mdeff Feb 27, 2019
9d3f9c3
readme: important information stands out
mdeff Feb 27, 2019
074cd54
readme: install from AUR
mdeff Feb 28, 2019
0dfac7c
improve is_connected
mdeff Feb 28, 2019
fa597f1
test connectedness
mdeff Feb 28, 2019
52bce1c
accept adjacencies as list of lists
mdeff Mar 1, 2019
242a1a7
accept signals as array_like
mdeff Mar 1, 2019
d5af8d4
some more array_like
mdeff Mar 1, 2019
dc80226
array-like => array_like
mdeff Mar 1, 2019
f6d8c8a
prefer asanyarray over asarray
mdeff Mar 1, 2019
4e25e04
improve and test subgraph
mdeff Mar 1, 2019
d746ab6
improve and test is_directed
mdeff Mar 1, 2019
841d4c4
simplify
mdeff Mar 1, 2019
a860487
fix python 2.7
mdeff Mar 1, 2019
138b45d
improve graph construction from adjacency
mdeff Mar 1, 2019
1a032d4
fix bug in weighted degree (had no impact)
mdeff Mar 5, 2019
083bb61
improve degree
mdeff Mar 5, 2019
5654ab7
changing the Laplacian invalidates Fourier and difference
mdeff Mar 5, 2019
6cc7764
in-place modification of the graph is not allowed anymore
mdeff Mar 5, 2019
79a8a42
Add highlight node color and normalize intercept
jbcdnr Mar 5, 2019
2e04059
import learning module in package
mdeff Mar 10, 2019
041ab7f
doc: some updates
mdeff Mar 10, 2019
6bcd3c1
doc: frame operator of the pseudo-inverse
mdeff Mar 12, 2019
9809dbd
doc: update Fourier coherence
mdeff Mar 12, 2019
4ca7e9a
doc: update modulation
mdeff Mar 12, 2019
f68a0c7
simplify travis.yml
mdeff Mar 13, 2019
e7daee7
improve and test set_signal
mdeff Mar 13, 2019
b903bca
add new methods to doc
mdeff Mar 13, 2019
a563249
remove redundant :py directive
mdeff Mar 13, 2019
18ee14a
improve and test convert_dtype
mdeff Mar 13, 2019
ca43e65
tests: cleaner skipping
mdeff Mar 13, 2019
96db535
show helpful message if networkx or graph-tool cannot be imported
mdeff Mar 13, 2019
964a6da
test import errors
mdeff Mar 14, 2019
2ea145d
improve save and load
mdeff Mar 14, 2019
4a248bf
use RandomState instead of seeding whole numpy
mdeff Mar 14, 2019
ce9f5e0
better test of save and load
mdeff Mar 14, 2019
6778299
clean & improve {to,from}_{networkx,graphtool}
mdeff Mar 15, 2019
cf8f741
test import/export without edge weights
mdeff Mar 20, 2019
2b945db
more simple and complete from_graphtool example
mdeff Mar 20, 2019
615650d
contributing: extras requirement and partial test suite
mdeff Mar 20, 2019
0ed20e9
break and join signals on I/O
mdeff Mar 20, 2019
714fdc0
sorted dict fix for python < 3.6
mdeff Mar 20, 2019
1b08b1b
update I/O doc
mdeff Mar 20, 2019
ed545cf
move I/O and layout in their own modules
mdeff Mar 20, 2019
40f234d
test: fix unknown backend
mdeff Mar 20, 2019
966303d
test for missing networkx node attribute
mdeff Mar 20, 2019
7f17463
test export of invalid signal type
mdeff Mar 20, 2019
6cff27d
doc: reference graph models from networkx and graph-tool
mdeff Mar 20, 2019
007f2ac
doc: See Also as numpy docstring standard
mdeff Mar 20, 2019
fc525e9
doc: some cross references
mdeff Mar 20, 2019
8e5e208
doc: path and DCT, ring and DFT
mdeff Mar 20, 2019
fb5cc22
doc: graph formats and manipulation + visualization software
mdeff Mar 21, 2019
82368f3
to_networkx: convert numpy int to python int
mdeff Mar 21, 2019
32c888b
subgraph: sub-sample signals as well
mdeff Mar 25, 2019
4d2f3bc
readme: update binder badge
mdeff Mar 27, 2019
d4ce59e
doc: Reference guide => API reference
mdeff Mar 28, 2019
e1728ae
doc: use sphinx-gallery for short examples
mdeff Mar 28, 2019
f345e9d
doc: eigenvalue concentration example
mdeff Mar 28, 2019
7aeab80
doc gallery: need this config for intersphinx links to work
mdeff Mar 29, 2019
1e8615c
doc: more examples from my talks
mdeff Mar 29, 2019
eaa8878
history: examples gallery
mdeff Mar 29, 2019
27f8809
examples: while math looks better (especially for papers and slides),…
mdeff Mar 29, 2019
27c1363
replace f-strings (>=3.6) and @ infix operator (>=3.5)
mdeff Mar 29, 2019
804b5a5
ring example: check that DFT is an eigenbasis (by Nathanaël)
mdeff Mar 29, 2019
fc195b0
Remove eigenvectors from concentration demo
nperraud Mar 29, 2019
83c2290
Add diagonals to grid2d
Apr 8, 2019
d7da209
Add test for the diagonal values
Apr 8, 2019
09b41b4
fix bug with small graphs
Apr 8, 2019
1560655
style
Apr 8, 2019
2dce0cb
renaming
Apr 8, 2019
b2eb1f3
rename doc
Apr 8, 2019
261a9a9
Update _layout.py
Jun 11, 2019
3e62548
add new sphere graphs
Droxef Jul 8, 2019
a6e23b6
icosahedron similar to jiang data
Droxef Jul 8, 2019
4f73fef
correct icosahedron and install healpy
Droxef Jul 15, 2019
bc4590c
checking for small difference between matrix require an absolute value
Aug 6, 2018
f6cc2b0
Adding import from Networkx and graph tool lib
Aug 29, 2018
f23f7ad
Documentation
Sep 6, 2018
7fb7a2b
Save and Load
Sep 9, 2018
96debbf
Import from graph tool by summing over multiple edge
Sep 11, 2018
3a4c228
Fix bug when creating a random graph_tool graph
Sep 11, 2018
01a5511
custom aggragation function implemented for merging multi-edges
Sep 15, 2018
e514e20
Export signal to networkx & graph_tool
Sep 15, 2018
0f05d96
Import with signals from networkx
Sep 15, 2018
446bb5b
graphtool import fix bug when a edge property not present
Sep 15, 2018
3e2c295
Import signal from graph_tool
Sep 15, 2018
8f6c31d
Fix some typos that were not covered by tests
Sep 18, 2018
5b6987b
Move tests for import and export into a new file
Sep 18, 2018
a867b58
Cleaning code and correct the indentation for of the doc
Sep 19, 2018
9bd7af3
Adding test for import export
Sep 23, 2018
33bdba6
remove test import file as it is now in the test_graph file
Sep 23, 2018
98f92c6
Some PR fixes
Oct 6, 2018
d957731
Fix test borken
Oct 6, 2018
7a3c72a
Correct typo in signal names
Oct 6, 2018
b6ebf8a
Make use of intersphinx
Oct 6, 2018
01704a1
reorder import, and other PR fix
Oct 6, 2018
44909f4
Fix such that test passes
Oct 6, 2018
512739c
Use self.get_edge_list
Oct 6, 2018
077658c
Fixes for PR comment
Oct 6, 2018
7be7539
Bug fix
Oct 6, 2018
7ad99bf
Remove some lint error
Oct 6, 2018
0e16b42
resolve some make lint inssues
Oct 6, 2018
2a261f4
Var renaming + adding weight param to from_networkx
Oct 7, 2018
5768fbe
Change assert to self.assertEqual
Oct 7, 2018
ae07666
Change one assert
Oct 7, 2018
6e8c636
Setting the seed for random tests
Oct 7, 2018
35ef0e4
Save and Load reimplemented
Oct 13, 2018
fd97f87
fix overloading suite error
Oct 13, 2018
881833b
Add test for save/load of multiple format + some bug fix
Oct 13, 2018
78f8550
Add doc for to_networkx + argument to store weight under another name
Oct 13, 2018
fd2517f
Fix https://github.com/epfl-lts2/pygsp/pull/32#discussion_r223394071
Oct 13, 2018
4968cb0
Auto detect type of attributes when exporting to graphtool
Oct 13, 2018
08a5f7c
Move the dict for type conversion into utils.
Oct 13, 2018
c56cb0e
ask for forgiveness rather than permission
Oct 14, 2018
aa8f4ef
remove edge property name from to_graphtool and to_networkx
Oct 14, 2018
69bb37a
Import all the signals as asked in https://github.com/epfl-lts2/pygsp…
Oct 14, 2018
ff8c9de
Simplify from_graphtool()
Oct 17, 2018
8023519
Cleaner way of adding the signal
Oct 17, 2018
b3f5d5e
Test environement on travis
Dec 27, 2018
95c62a2
Bug fix
Feb 3, 2019
bbda580
Add auto selection of save and load backend based on the format
Feb 7, 2019
ea11316
install dependencies for graph-tool on travis
Feb 7, 2019
6f1355d
add system_sit_package true
Feb 7, 2019
3fbc04c
test for python > 3.5 only
Feb 18, 2019
d2f8bb9
Fix save for graph_tool (dot, gml)
Feb 18, 2019
f2f895d
clean code
Feb 18, 2019
9ed1650
fix verison for test_save_load
Feb 18, 2019
86655b1
use graph_tool.generation to gen random graph
Feb 19, 2019
77b7adb
remove useless isomorphic testing
Feb 19, 2019
879af6d
Convert to float the singal when exporting to networkx
Feb 19, 2019
4db856d
skip graph tool tests for python2.7
Feb 19, 2019
ee985ac
Update pygsp/graphs/graph.py
mdeff Feb 19, 2019
caf3cd1
Update pygsp/graphs/graph.py
mdeff Feb 19, 2019
062823b
Update pygsp/graphs/graph.py
mdeff Feb 19, 2019
5b0a95c
remove support for dot export and import
Feb 20, 2019
40361c6
use graph_tool.spectral.adjacency
Feb 21, 2019
df5bb09
RandomRing: use a kernel
mdeff Feb 25, 2019
9ceba3a
RandomRing: cleanup
mdeff Feb 25, 2019
00753c1
StochasticBlockModel: allow to indefinitely try to get a connected graph
mdeff Feb 25, 2019
da1876d
merge all the extra requirements in a single dev requirement
mdeff Feb 25, 2019
b2e0ff7
Add examples
Feb 26, 2019
717c5f0
fix doctest
Feb 26, 2019
672edac
fix expcted nothing error
Feb 26, 2019
33704fd
rings need at least 3 vertices
mdeff Feb 27, 2019
7e07698
RandomRing: allow user to pass angles
mdeff Feb 27, 2019
06656f6
improve is_connected
mdeff Feb 28, 2019
6ee4e2c
test connectedness
mdeff Feb 28, 2019
5db04e4
accept adjacencies as list of lists
mdeff Mar 1, 2019
7da3193
accept signals as array_like
mdeff Mar 1, 2019
a0c188a
array-like => array_like
mdeff Mar 1, 2019
e0561ab
prefer asanyarray over asarray
mdeff Mar 1, 2019
be1b4ab
improve and test subgraph
mdeff Mar 1, 2019
c804cc4
improve and test is_directed
mdeff Mar 1, 2019
f991174
simplify
mdeff Mar 1, 2019
2ae4735
fix python 2.7
mdeff Mar 1, 2019
4a21884
improve graph construction from adjacency
mdeff Mar 1, 2019
ca703ac
fix bug in weighted degree (had no impact)
mdeff Mar 5, 2019
67ab369
improve degree
mdeff Mar 5, 2019
b60c8f1
changing the Laplacian invalidates Fourier and difference
mdeff Mar 5, 2019
723491a
in-place modification of the graph is not allowed anymore
mdeff Mar 5, 2019
17ad36d
doc: update Fourier coherence
mdeff Mar 12, 2019
cbecfa8
improve and test set_signal
mdeff Mar 13, 2019
987a0d1
add new methods to doc
mdeff Mar 13, 2019
9712b67
remove redundant :py directive
mdeff Mar 13, 2019
d2bdec8
improve and test convert_dtype
mdeff Mar 13, 2019
38a3eb9
tests: cleaner skipping
mdeff Mar 13, 2019
ed55ecc
show helpful message if networkx or graph-tool cannot be imported
mdeff Mar 13, 2019
3a0b5fe
test import errors
mdeff Mar 14, 2019
7895a5e
improve save and load
mdeff Mar 14, 2019
e480057
use RandomState instead of seeding whole numpy
mdeff Mar 14, 2019
60bbb52
better test of save and load
mdeff Mar 14, 2019
f5561f7
clean & improve {to,from}_{networkx,graphtool}
mdeff Mar 15, 2019
df37c81
test import/export without edge weights
mdeff Mar 20, 2019
abc69cf
contributing: extras requirement and partial test suite
mdeff Mar 20, 2019
cbcb5df
break and join signals on I/O
mdeff Mar 20, 2019
8e24e69
sorted dict fix for python < 3.6
mdeff Mar 20, 2019
5d3a3a8
update I/O doc
mdeff Mar 20, 2019
99a934c
move I/O and layout in their own modules
mdeff Mar 20, 2019
ec36a26
test: fix unknown backend
mdeff Mar 20, 2019
4523955
test for missing networkx node attribute
mdeff Mar 20, 2019
9b9429e
test export of invalid signal type
mdeff Mar 20, 2019
9262e94
doc: See Also as numpy docstring standard
mdeff Mar 20, 2019
bdb303c
doc: some cross references
mdeff Mar 20, 2019
9352599
doc: path and DCT, ring and DFT
mdeff Mar 20, 2019
8bd2447
doc: graph formats and manipulation + visualization software
mdeff Mar 21, 2019
51afe79
to_networkx: convert numpy int to python int
mdeff Mar 21, 2019
1a8349f
subgraph: sub-sample signals as well
mdeff Mar 25, 2019
65e5767
doc: use sphinx-gallery for short examples
mdeff Mar 28, 2019
1140afc
doc: eigenvalue concentration example
mdeff Mar 28, 2019
8437127
doc gallery: need this config for intersphinx links to work
mdeff Mar 29, 2019
87e0d03
doc: more examples from my talks
mdeff Mar 29, 2019
c117771
history: examples gallery
mdeff Mar 29, 2019
e322b44
examples: while math looks better (especially for papers and slides),…
mdeff Mar 29, 2019
5cafa93
replace f-strings (>=3.6) and @ infix operator (>=3.5)
mdeff Mar 29, 2019
6066684
ring example: check that DFT is an eigenbasis (by Nathanaël)
mdeff Mar 29, 2019
cd08452
Remove eigenvectors from concentration demo
nperraud Mar 29, 2019
52b686b
Add diagonals to grid2d
Apr 8, 2019
30d9156
Add test for the diagonal values
Apr 8, 2019
877756a
fix bug with small graphs
Apr 8, 2019
3e482f1
renaming
Apr 8, 2019
7fafee0
rename doc
Apr 8, 2019
015ec85
Update _layout.py
Jun 11, 2019
6568611
icosahedron similar to jiang data
Droxef Jul 8, 2019
0afe964
problem rebase
Droxef Jul 26, 2019
3cf57f0
problem rebase 2
Droxef Jul 26, 2019
d2fc4d7
problem equiangular with Driscoll-Heally sampling: temp fix
Droxef Jul 26, 2019
b7ceedc
correct equirectangular with different bandwidths
Droxef Jul 29, 2019
02130b9
add longitude and latitude coords
Droxef Jul 29, 2019
9707b08
correct some docs and move OD sphere graph
Droxef Jul 30, 2019
14ebb22
correct sampling type in equiangular graph
Droxef Jul 30, 2019
02111fe
correct with new nngraph
Droxef Jul 31, 2019
98ab35a
add plotting to sphere icosa
Droxef Jul 31, 2019
3297cab
rebase did not work correctly
Droxef Jul 31, 2019
5a3a152
change NNgraph
Droxef Jul 31, 2019
c65f6a0
equiangular doc and icosahdron graph clases changed
Droxef Sep 2, 2019
9d0db1f
modified spherehealpix with new kernel_widths
Droxef Sep 17, 2019
6b21639
healpix graph with optimal kernel widths
Droxef Sep 24, 2019
c69398b
healpix: extrapolate kernel width from nside = 1 to 2048
mdeff Jan 21, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ output/*.html
output/*/index.html

# Sphinx documentation
doc/_build
/doc/_build/
/doc/examples/
/doc/backrefs/

# Vim swap files
.*.swp
Expand Down
3 changes: 1 addition & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ python:
version: 3
pip_install: true
extra_requirements:
- alldeps
- doc
- dev
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ matrix:
addons:
apt:
packages:
- libqt5gui5 # pyqt5>5.11 fails to load the xcb platform plugin without it
- libqt5gui5 # pyqt5>5.11 otherwise cannot load the xcb platform plugin
- libflann-dev

install:
- pip install -U --upgrade-strategy eager .[alldeps,test,doc]
Expand Down
22 changes: 21 additions & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,20 @@ The package can be set up (ideally in a virtual environment) for local
development with the following::

$ git clone https://github.com/epfl-lts2/pygsp.git
$ pip install -U -e pygsp[alldeps,test,doc,pkg]
$ pip install -U -e pygsp[dev]
<<<<<<< HEAD

The ``dev`` "extras requirement" ensures that dependencies required for
development (to run the test suite and build the documentation) are installed.
Only `graph-tool <https://graph-tool.skewed.de>`_ will be missing: install it
manually as it cannot be installed by pip.
=======
>>>>>>> merge all the extra requirements in a single dev requirement

The ``dev`` "extras requirement" ensures that dependencies required for
development (to run the test suite and build the documentation) are installed.
Only `graph-tool <https://graph-tool.skewed.de>`_ will be missing: install it
manually as it cannot be installed by pip.

You can improve or add functionality in the ``pygsp`` folder, along with
corresponding unit tests in ``pygsp/tests/test_*.py`` (with reasonable
Expand All @@ -36,6 +49,13 @@ documentation with the following (enforced by Travis CI)::
Check the generated coverage report at ``htmlcov/index.html`` to make sure the
tests reasonably cover the changes you've introduced.

To iterate faster, you can partially run the test suite, at various degrees of
granularity, as follows::

$ python -m unittest pygsp.tests.test_docstrings.suite_reference
$ python -m unittest pygsp.tests.test_graphs.TestImportExport
$ python -m unittest pygsp.tests.test_graphs.TestImportExport.test_save_load

Making a release
----------------

Expand Down
35 changes: 24 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
PyGSP: Graph Signal Processing in Python
========================================

The PyGSP is a Python package to ease
`Signal Processing on Graphs <https://arxiv.org/abs/1211.0053>`_.
The documentation is available on
`Read the Docs <https://pygsp.readthedocs.io>`_
and development takes place on
`GitHub <https://github.com/epfl-lts2/pygsp>`_.
A (mostly unmaintained) `Matlab version <https://lts2.epfl.ch/gsp>`_ exists.

+-----------------------------------+
| |doc| |pypi| |conda| |binder| |
+-----------------------------------+
Expand All @@ -26,18 +34,11 @@ PyGSP: Graph Signal Processing in Python
:target: https://coveralls.io/github/epfl-lts2/pygsp
.. |github| image:: https://img.shields.io/github/stars/epfl-lts2/pygsp.svg?style=social
:target: https://github.com/epfl-lts2/pygsp
.. |binder| image:: https://mybinder.org/badge.svg
.. |binder| image:: https://mybinder.org/badge_logo.svg
:target: https://mybinder.org/v2/gh/epfl-lts2/pygsp/master?filepath=playground.ipynb
.. |conda| image:: https://anaconda.org/conda-forge/pygsp/badges/installer/conda.svg
:target: https://anaconda.org/conda-forge/pygsp

The PyGSP is a Python package to ease
`Signal Processing on Graphs <https://arxiv.org/abs/1211.0053>`_.
The documentation is available on
`Read the Docs <https://pygsp.readthedocs.io>`_
and development takes place on
`GitHub <https://github.com/epfl-lts2/pygsp>`_.
A (mostly unmaintained) `Matlab version <https://lts2.epfl.ch/gsp>`_ exists.

The PyGSP facilitates a wide variety of operations on graphs, like computing
their Fourier basis, filtering or interpolating signals, plotting graphs,
Expand All @@ -53,6 +54,15 @@ exponential window; and Gabor filters. Despite all the pre-defined models, you
can easily use a custom graph by defining its adjacency matrix, and a custom
filter bank by defining a set of functions in the spectral domain.

While NetworkX_ and graph-tool_ are tools to analyze the topology of graphs,
the aim of the PyGSP is to analyze graph signals, also known as features or
properties (i.e., not the graph itself).
Those three tools are complementary and work well together with the provided
import / export facility.

.. _NetworkX: https://networkx.github.io
.. _graph-tool: https://graph-tool.skewed.de

The following demonstrates how to instantiate a graph and a filter, the two
main objects of the package.

Expand Down Expand Up @@ -100,13 +110,16 @@ The PyGSP is available on PyPI::

$ pip install pygsp

Note that you will need a recent version of ``pip`` and ``setuptools``. Please
run ``pip install --upgrade pip setuptools`` if you get any installation error.

The PyGSP is available on `conda-forge <https://github.com/conda-forge/pygsp-feedstock>`_::

$ conda install -c conda-forge pygsp

The PyGSP is available in the `Arch User Repository <https://aur.archlinux.org/packages/python-pygsp>`_::

$ git clone https://aur.archlinux.org/python-pygsp.git
$ cd python-pygsp
$ makepkg -csi

Contributing
------------

Expand Down
23 changes: 18 additions & 5 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import pygsp

extensions = ['sphinx.ext.viewcode',
'sphinx.ext.autosummary',
'sphinx.ext.mathjax',
'sphinx.ext.inheritance_diagram',
'sphinxcontrib.bibtex']
extensions = [
'sphinx.ext.viewcode',
'sphinx.ext.autosummary',
'sphinx.ext.mathjax',
'sphinx.ext.inheritance_diagram',
'sphinxcontrib.bibtex',
]

extensions.append('sphinx.ext.autodoc')
autodoc_default_flags = ['members', 'undoc-members']
Expand Down Expand Up @@ -37,6 +39,17 @@
from pygsp import graphs, filters, utils, plotting
"""

extensions.append('sphinx_gallery.gen_gallery')
sphinx_gallery_conf = {
'examples_dirs': '../examples',
'gallery_dirs': 'examples',
'filename_pattern': '/',
'reference_url': {'pygsp': None},
'backreferences_dir': 'backrefs',
'doc_module': 'pygsp',
'show_memory': True,
}

exclude_patterns = ['_build']
source_suffix = '.rst'
master_doc = 'index'
Expand Down
23 changes: 22 additions & 1 deletion doc/history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,27 @@ History
* New implementation of the Sensor graph that is simpler and scales better.
* A new learning module with three functions to solve standard semi-supervised
classification and regression problems.
<<<<<<< HEAD
<<<<<<< HEAD
* A much improved, fixed, documented, and tested NNGraph. The user can now
select the backend and similarity kernel. The radius can be estimated and
features standardized. (PR #43)
=======
=======
* Import and export graphs and their signals to NetworkX and graph-tool.
* Save and load graphs and theirs signals to / from GraphML, GML, and GEXF.
<<<<<<< HEAD
>>>>>>> update I/O doc
=======
* Documentation: path graph linked to DCT, ring graph linked to DFT.
<<<<<<< HEAD
>>>>>>> doc: path and DCT, ring and DFT
=======
* We now have a gallery of examples! That is convenient for users to get a
taste of what the library can do, and to start working from a code snippet.
>>>>>>> history: examples gallery
* Merged all the extra requirements in a single dev requirement.
>>>>>>> merge all the extra requirements in a single dev requirement

Experimental filter API (to be tested and validated):

Expand Down Expand Up @@ -89,7 +110,7 @@ The following packages were made optional dependencies:
workflow, it's not necessary for users who only want to process data without
plotting graphs, signals and filters.
* pyflann, as it is only used for approximate kNN. The problem was that the
source distribution would not build for Windows. On conda-forge, (py)flann
source distribution would not build for Windows. On conda-forge, (py)flann
is not built for Windows either.

Moreover, matplotlib is now the default drawing backend. It's well integrated
Expand Down
1 change: 1 addition & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

Home <self>
tutorials/index
examples/index
reference/index
contributing
history
Expand Down
6 changes: 3 additions & 3 deletions doc/reference/index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
===============
Reference guide
===============
=============
API reference
=============

.. automodule:: pygsp

Expand Down
5 changes: 3 additions & 2 deletions doc/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,16 @@ @article{klein1993resistance
publisher={Springer}
}

@article{strang1999discrete,
@article{strang1999dct,
title={The discrete cosine transform},
author={Strang, Gilbert},
journal={SIAM review},
volume={41},
number={1},
pages={135--147},
year={1999},
publisher={SIAM}
publisher={SIAM},
url={https://sci-hub.tw/10.1137/S0036144598336745},
}

@article{shuman2013spectrum,
Expand Down
4 changes: 2 additions & 2 deletions doc/tutorials/optimization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ We start with the graph TV regularization. We will use the :class:`pyunlocbox.so
>>> prob1 = pyunlocbox.solvers.solve([d, r, f], solver=solver,
... x0=x0, rtol=0, maxit=1000)
Solution found after 1000 iterations:
objective function f(sol) = 2.250584e+02
objective function f(sol) = 2.256055e+02
stopping criterion: MAXIT
>>>
>>> fig, ax = G.plot(prob1['sol'])
Expand All @@ -107,7 +107,7 @@ This figure shows the label signal recovered by graph total variation regulariza
>>> prob2 = pyunlocbox.solvers.solve([r, f], solver=solver,
... x0=x0, rtol=0, maxit=1000)
Solution found after 1000 iterations:
objective function f(sol) = 6.504290e+01
objective function f(sol) = 4.376481e+01
stopping criterion: MAXIT
>>>
>>> fig, ax = G.plot(prob2['sol'])
Expand Down
3 changes: 3 additions & 0 deletions examples/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
========
Examples
========
38 changes: 38 additions & 0 deletions examples/eigenvalue_concentration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
r"""
Concentration of the eigenvalues
================================

The eigenvalues of the graph Laplacian concentrates to the same value as the
graph becomes full.
"""

import numpy as np
from matplotlib import pyplot as plt
import pygsp as pg

n_neighbors = [1, 2, 5, 8]
fig, axes = plt.subplots(3, len(n_neighbors), figsize=(15, 8))

for k, ax in zip(n_neighbors, axes.T):

graph = pg.graphs.Ring(17, k=k)
graph.compute_fourier_basis()
graph.plot(graph.U[:, 1], ax=ax[0])
ax[0].axis('equal')
ax[1].spy(graph.W)
ax[2].plot(graph.e, '.')
ax[2].set_title('k={}'.format(k))
#graph.set_coordinates('line1D')
#graph.plot(graph.U[:, :4], ax=ax[3], title='')

# Check that the DFT matrix is an eigenbasis of the Laplacian.
U = np.fft.fft(np.identity(graph.n_vertices))
LambdaM = (graph.L.todense().dot(U)) / (U + 1e-15)
# Eigenvalues should be real.
assert np.all(np.abs(np.imag(LambdaM)) < 1e-10)
LambdaM = np.real(LambdaM)
# Check that the eigenvectors are really eigenvectors of the laplacian.
Lambda = np.mean(LambdaM, axis=0)
assert np.all(np.abs(LambdaM - Lambda) < 1e-10)

fig.tight_layout()
66 changes: 66 additions & 0 deletions examples/filtering.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
r"""
Filtering a graph signal
========================

A graph signal is filtered by transforming it to the spectral domain (via the
Fourier transform), performing a point-wise multiplication (motivated by the
convolution theorem), and transforming it back to the vertex domain (via the
inverse graph Fourier transform).

.. note::

In practice, filtering is implemented in the vertex domain to avoid the
computationally expensive graph Fourier transform. To do so, filters are
implemented as polynomials of the eigenvalues / Laplacian. Hence, filtering
a signal reduces to its multiplications with sparse matrices (the graph
Laplacian).

"""

import numpy as np
from matplotlib import pyplot as plt
import pygsp as pg

G = pg.graphs.Sensor(seed=42)
G.compute_fourier_basis()

#g = pg.filters.Rectangular(G, band_max=0.2)
g = pg.filters.Expwin(G, band_max=0.5)

fig, axes = plt.subplots(1, 3, figsize=(12, 4))
fig.subplots_adjust(hspace=0.5)

x = np.random.RandomState(1).normal(size=G.N)
#x = np.random.RandomState(42).uniform(-1, 1, size=G.N)
x = 3 * x / np.linalg.norm(x)
y = g.filter(x)
x_hat = G.gft(x).squeeze()
y_hat = G.gft(y).squeeze()

limits = [x.min(), x.max()]

G.plot(x, limits=limits, ax=axes[0], title='input signal $x$ in the vertex domain')
axes[0].text(0, -0.1, '$x^T L x = {:.2f}$'.format(G.dirichlet_energy(x)))
axes[0].set_axis_off()

g.plot(ax=axes[1], alpha=1)
line_filt = axes[1].lines[-2]
line_in, = axes[1].plot(G.e, np.abs(x_hat), '.-')
line_out, = axes[1].plot(G.e, np.abs(y_hat), '.-')
#axes[1].set_xticks(range(0, 16, 4))
axes[1].set_xlabel(r'graph frequency $\lambda$')
axes[1].set_ylabel(r'frequency content $\hat{x}(\lambda)$')
axes[1].set_title(r'signals in the spectral domain')
axes[1].legend(['input signal $\hat{x}$'])
labels = [
r'input signal $\hat{x}$',
'kernel $g$',
r'filtered signal $\hat{y}$',
]
axes[1].legend([line_in, line_filt, line_out], labels, loc='upper right')

G.plot(y, limits=limits, ax=axes[2], title='filtered signal $y$ in the vertex domain')
axes[2].text(0, -0.1, '$y^T L y = {:.2f}$'.format(G.dirichlet_energy(y)))
axes[2].set_axis_off()

fig.tight_layout()
Loading