neighbor_graph-methods: Construct Neighborhood Graph from Surface Mesh

neighbor_graphR Documentation

Construct Neighborhood Graph from Surface Mesh

Description

This generic function constructs a neighborhood graph from a surface mesh using edge weights. It allows for flexible definition of neighborhoods based on edge radius and custom edge weights.

Usage

neighbor_graph(x, radius, edgeWeights = missing(), nodes = missing(), ...)

## S4 method for signature 'igraph,numeric,missing,missing'
neighbor_graph(
  x,
  radius,
  edgeWeights = NULL,
  nodes = NULL,
  distance_type = c("geodesic", "euclidean", "spherical")
)

## S4 method for signature 'SurfaceGeometry,numeric,missing,missing'
neighbor_graph(
  x,
  radius,
  edgeWeights = NULL,
  nodes = NULL,
  distance_type = c("geodesic", "euclidean", "spherical")
)

## S4 method for signature 'SurfaceGeometry,numeric,numeric,missing'
neighbor_graph(
  x,
  radius,
  edgeWeights,
  distance_type = c("geodesic", "euclidean", "spherical")
)

## S4 method for signature 'SurfaceGeometry,numeric,numeric,integer'
neighbor_graph(
  x,
  radius,
  edgeWeights,
  nodes,
  distance_type = c("geodesic", "euclidean", "spherical")
)

## S4 method for signature 'SurfaceGeometry,numeric,missing,integer'
neighbor_graph(
  x,
  radius,
  nodes,
  distance_type = c("geodesic", "euclidean", "spherical")
)

Arguments

x

An object representing a surface mesh. The specific class depends on the method implementation.

radius

Numeric. The edge radius defining the neighborhood extent.

edgeWeights

Numeric vector. Custom weights for edges, used to define edge distances.

nodes

Integer vector. The subset of nodes to use in graph construction. If NULL, all nodes are used.

...

Additional arguments passed to methods.

distance_type

the type of distance metric to use

Details

The neighborhood graph is constructed by considering edges within the specified radius and applying the provided edge weights. This function is particularly useful in neuroimaging analyses for defining local connectivity on brain surfaces.

Value

An object representing the constructed neighborhood graph. The specific class depends on the method implementation.

See Also

graph, vertices

Examples


# Assuming 'surface_mesh' is a pre-defined surface mesh object
graph <- neighbor_graph(surface_mesh, radius = 5,
                        edgeWeights = runif(nrow(surface_mesh$vertices)),
                        nodes = 1:1000)



g <- make_graph("Zachary")
E(g)$dist <- runif(ecount(g))
neighbor_g <- neighbor_graph(g, radius = 0.5, distance_type = "geodesic")



bbuchsbaum/neurosurf documentation built on June 10, 2025, 8:22 p.m.