libpysal.weights.Gabriel

class libpysal.weights.Gabriel(coordinates, **kwargs)[source]

Constructs the Gabriel graph of a set of points. This graph is a subset of the Delaunay triangulation where only “short” links are retained. This function is also accelerated using numba, and implemented on top of the scipy.spatial.Delaunay class.

For a link (i,j) connecting node i to j in the Delaunay triangulation to be retained in the Gabriel graph, it must pass a point set exclusion test:

  1. Construct the circle C_ij containing link (i,j) as its diameter

  2. If any other node k is contained within C_ij, then remove link (i,j) from the graph.

  3. Once all links are evaluated, the remaining graph is the Gabriel graph.

Parameters:
coordinatesarray of points, (N,2)

numpy array of coordinates containing locations to compute the delaunay triangulation

**kwargskeyword argument list

keyword arguments passed directly to weights.W

__init__(coordinates, **kwargs)[source]

Methods

__init__(coordinates, **kwargs)

asymmetry([intrinsic])

Asymmetry check.

from_WSP(WSP[, silence_warnings])

Create a pysal W from a pysal WSP object (thin weights matrix).

from_adjlist(adjlist[, focal_col, ...])

Return an adjacency list representation of a weights object.

from_dataframe(df[, geom_col, ids, use_index])

Construct a Delaunay triangulation from a geopandas GeoDataFrame.

from_file([path, format])

Read a weights file into a W object.

from_networkx(graph[, weight_col])

Convert a networkx graph to a PySAL W object.

from_shapefile(*args, **kwargs)

from_sparse(sparse)

Convert a scipy.sparse array to a PySAL W object.

full()

Generate a full numpy.ndarray.

get_transform()

Getter for transform property.

plot(gdf[, indexed_on, ax, color, node_kws, ...])

Plot spatial weights objects.

remap_ids(new_ids)

In place modification throughout W of id values from w.id_order to new_ids in all.

set_shapefile(shapefile[, idVariable, full])

Adding metadata for writing headers of .gal and .gwt files.

set_transform([value])

Transformations of weights.

symmetrize([inplace])

Construct a symmetric KNN weight.

to_WSP()

Generate a WSP object.

to_adjlist([remove_symmetric, drop_islands, ...])

Compute an adjacency list representation of a weights object.

to_file([path, format])

Write a weights to a file.

to_networkx()

Convert a weights object to a networkx graph.

to_sparse([fmt])

Generate a scipy.sparse array object from a pysal W.

Attributes

asymmetries

List of id pairs with asymmetric weights sorted in ascending index location order.

cardinalities

Number of neighbors for each observation.

component_labels

Store the graph component in which each observation falls.

diagW2

Diagonal of \(WW\).

diagWtW

Diagonal of \(W^{'}W\).

diagWtW_WW

Diagonal of \(W^{'}W + WW\).

histogram

Cardinality histogram as a dictionary where key is the id and value is the number of neighbors for that unit.

id2i

Dictionary where the key is an ID and the value is that ID's index in W.id_order.

id_order

Returns the ids for the observations in the order in which they would be encountered if iterating over the weights.

id_order_set

Returns True if user has set id_order, False if not.

islands

List of ids without any neighbors.

max_neighbors

Largest number of neighbors.

mean_neighbors

Average number of neighbors.

min_neighbors

Minimum number of neighbors.

n

Number of units.

n_components

Store whether the adjacency matrix is fully connected.

neighbor_offsets

Given the current id_order, neighbor_offsets[id] is the offsets of the id's neighbors in id_order.

nonzero

Number of nonzero weights.

pct_nonzero

Percentage of nonzero weights.

s0

s0 is defined as

s1

s1 is defined as

s2

s2 is defined as

s2array

Individual elements comprising s2.

sd

Standard deviation of number of neighbors.

sparse

Sparse matrix object.

transform

Getter for transform property.

trcW2

Trace of \(WW\).

trcWtW

Trace of \(W^{'}W\).

trcWtW_WW

Trace of \(W^{'}W + WW\).