apply_incidence_map {gor}R Documentation

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)

Arguments

eG

Graph in edgelist representation, see as_edgelist.

v

Edge vector to which the incidence map will be applied.

Details

The incidence map is the linear transformation from the edge vector space to the vertex vector space of a graph associating to each edge its incident vertices. 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 as_edgelist function to compute the result of the incidence map on an edge vector, which is interpreted with respect to the same edgelist.

Value

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

Author(s)

Cesar Asensio

See Also

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

Examples

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)


[Package gor version 1.0 Index]