flip_edges: Flip direction of igraph edges

flip_edgesR Documentation

Flip direction of igraph edges

Description

Flip direction of igraph edges

Usage

flip_edges(g, edge_idx, verbose = FALSE, ...)

Arguments

g

igraph object

edge_idx

integer index of edges in the order they are stored in igraph::E(g), or what igraph calls an "edge sequence" which is a character name for each node, defined as "node1|node2". For example "D|A" would define an edge from node name "D" to node name "A". When verbose=TRUE a summary table is printed out to show which edges were flipped.

verbose

logical indicating whether to print verbose output. When verbose=TRUE a summary table is printed with these columns:

  • edge_seq: the input edge sequence, for example when edge_idx is provided as a character vector, the input vector is printed here.

  • edge_seq_matched: edge sequence that matched the g object. For example, when edge_idx input is a character vector, only the edges that match the g input are included here.

  • edge_idx: the integer index values of edges flipped. An NA value indicates the edge was not flipped, which should only happen when input edge_idx is provided as a character vector and some edges do not match the g input.

...

additional arguments are ignored.

Details

This function simply flips the direction of igraph edges, keeping all other node and edge attributes.

Note that this function will flip the order of nodes for each edge defined by edge_idx, regardless whether the igraph itself is a directed graph.

When edge_idx is provided as a character vector edge sequence, any entries that do not match edges in g are ignored. A summary table is printed when verbose=TRUE.

See Also

Other jam igraph functions: cnet2df(), cnet2im(), cnetplotJam(), cnetplot_internalJam(), color_edges_by_nodegroups(), color_edges_by_nodes_deprecated(), color_edges_by_nodes(), color_nodes_by_nodegroups(), communities2nodegroups(), drawEllipse(), edge_bundle_bipartite(), edge_bundle_nodegroups(), enrichMapJam(), fixSetLabels(), get_bipartite_nodeset(), igraph2pieGraph(), jam_igraph(), jam_plot_igraph(), label_communities(), layout_with_qfrf(), layout_with_qfr(), mem2emap(), memIM2cnet(), mem_multienrichplot(), nodegroups2communities(), rectifyPiegraph(), relayout_with_qfr(), removeIgraphBlanks(), removeIgraphSinglets(), reorderIgraphNodes(), rotate_igraph_layout(), spread_igraph_labels(), subgraph_jam(), subsetCnetIgraph(), subset_igraph_components(), sync_igraph_communities(), with_qfr()

Examples

am <- matrix(ncol=5, nrow=5, byrow=TRUE,
   data=c(0,0,0,0,0,
      1,0,0,0,0,
      1,0,0,0,0,
      1,0,0,0,0,
      1,0,0,0,0),
   dimnames=list(head(LETTERS, 5),
      head(LETTERS, 5)))
am;
g1 <- igraph::graph_from_adjacency_matrix(am)
plot(g1);
g2 <- flip_edges(g1, 3:4);
plot(g2);


jmw86069/jamenrich documentation built on Nov. 6, 2024, 7:07 p.m.