node_topology: Node properties related to the graph topology

Description Usage Arguments Value Functions Examples

Description

These functions calculate properties that are dependent on the overall topology of the graph.

Usage

1
2
3
node_dominator(root, mode = "out")

node_topo_order(mode = "out")

Arguments

root

The node to start the dominator search from

mode

How should edges be followed. Either 'in' or 'out'

Value

A vector of the same length as the number of nodes in the graph

Functions

Examples

1
2
3
4
5
# Sort a graph based on its topological order
create_tree(10, 2) %>%
  arrange(sample(graph_order())) %>%
  mutate(old_ind = seq_len(graph_order())) %>%
  arrange(node_topo_order())

Example output

Attaching package: 'tidygraph'

The following object is masked from 'package:stats':

    filter

# A tbl_graph: 10 nodes and 9 edges
#
# A rooted tree
#
# Node Data: 10 x 1 (active)
  old_ind
    <int>
1       9
2       3
3       4
4       2
5       7
6       6
# ... with 4 more rows
#
# Edge Data: 9 x 2
   from    to
  <int> <int>
1     1     3
2     1     2
3     3     6
# ... with 6 more rows

tidygraph documentation built on July 8, 2020, 6 p.m.