Learn R Programming

gor (version 2.0)

apply_incidence_map: Apply incidence map of a graph to an edge vector

Description

Apply incidence map of a graph to an edge vector. It uses the edgelist of the graph instead of the incidence matrix.

Usage

apply_incidence_map(eG, v)

Value

A vertex vector, having the degree of each vertex in the subgraph specified by the edge vector.

Arguments

eG

Graph in edgelist representation, see igraph::as_edgelist().

v

Edge vector to which the incidence map will be applied.

Author

Cesar Asensio

Details

The incidence map is the linear transformation from the edge vector space to the vertex vector space of a graph. It is customarily represented by the incidence matrix, which is a very large matrix for large graphs; for this reason it not efficient to use directly the incidence matrix. This function uses the edgelist of the graph as returned by the igraph::as_edgelist() function to compute the result of the incidence map on an edge vector, which is interpreted with respect to the same edgelist.

See Also

shave_cycle, for shaving hairy cycles, which makes use of this routine, and generate_fundamental_cycles, using the former.

Examples

Run this code
library(igraph)
g <- make_graph("Dodecahedron")
eG <- as_edgelist(g)
set.seed(1)
v <- sample(0:1, gsize(g), replace = TRUE) # Random edge vector
apply_incidence_map(eG, v) # 1 1 0 1 2 0 1 1 3 2 0 1 1 1 1 1 0 0 1 2
## Plotting the associated subgraph
h <- make_graph(t(eG[v==1,]))
z <- layout_with_gem(g)
plot(g, layout = z)
plot(h, layout = z, add = TRUE, edge.color = "red3", edge.width = 3)

Run the code above in your browser using DataLab