NNGraphs objects¶
NNGraphs Class¶
-
class
pygsp.graphs.
NNGraph
(Xin, NNtype='knn', use_flann=False, center=True, rescale=True, k=10, sigma=0.1, epsilon=0.01, gtype=None, plotting={}, symmetrize_type='average', **kwargs)[source]¶ Bases:
pygsp.graphs.graph.Graph
Creates a graph from a pointcloud.
Parameters: Xin : ndarray
Input points
use_flann : bool
Whether flann method should be used (knn is otherwise used). (default is False) (this option is not implemented yet)
center : bool
Center the data (default is True)
rescale : bool
Rescale the data (in a 1-ball) (default is True)
k : int
Number of neighbors for knn (default is 10)
sigma : float
Variance of the distance kernel (default is 0.1)
epsilon : float
RRdius for the range search (default is 0.01)
gtype : string
The type of graph (default is “knn”)
Examples
>>> from pygsp import graphs >>> import numpy as np >>> Xin = np.arange(90).reshape(30, 3) >>> G = graphs.NNGraph(Xin)
Bunny¶
Cube¶
-
class
pygsp.graphs.
Cube
(radius=1, nb_pts=300, nb_dim=3, sampling='random', **kwargs)[source]¶ Bases:
pygsp.graphs.nngraphs.nngraph.NNGraph
Creates the graph of an hyper-cube.
Parameters: radius : float
Edge lenght (default = 1)
nb_pts : int
Number of vertices (default = 300)
nb_dim : int
Dimension (default = 3)
sampling : string
Variance of the distance kernel (default = ‘random’) (Can now only be ‘random’)
Examples
>>> from pygsp import graphs >>> radius = 5 >>> G = graphs.Cube(radius=radius)
Sphere¶
-
class
pygsp.graphs.
Sphere
(radius=1, nb_pts=300, nb_dim=3, sampling='random', **kwargs)[source]¶ Bases:
pygsp.graphs.nngraphs.nngraph.NNGraph
Creates a spherical-shaped graph.
Parameters: radius : flaot
Radius of the sphere (default = 1)
nb_pts : int
Number of vertices (default = 300)
nb_dim : int
Dimension (default = 3)
sampling : sting
Variance of the distance kernel (default = ‘random’) (Can now only be ‘random’)
Examples
>>> from pygsp import graphs >>> radius = 5 >>> G = graphs.Sphere(radius=radius)
TwoMoons¶
-
class
pygsp.graphs.
TwoMoons
(moontype='standard', sigmag=0.05, N=400, sigmad=0.07, d=0.5)[source]¶ Bases:
pygsp.graphs.nngraphs.nngraph.NNGraph
Create a 2 dimensional graph of the Two Moons.
Parameters: moontype : string
You have the freedom to chose if you want to create a standard two_moons graph or a synthetised one (default is ‘standard’). ‘standard’ : Create a two_moons graph from a based graph. ‘synthetised’ : Create a synthetised two_moon
sigmag : float
Variance of the distance kernel (default = 0.05)
N : int
Number of vertices (default = 2000)
sigmad : float
Variance of the data (do not set it too high or you won’t see anything) (default = 0.05)
d : float
Distance of the two moons (default = 0.5)
Examples
>>> from pygsp import graphs >>> G1 = graphs.TwoMoons(moontype='standard') >>> G2 = graphs.TwoMoons(moontype='synthetised', N=1000, sigmad=0.1, d=1)