New verbs

While tidygraph mainly works by allowing you to use well known dplyr verbs on relational data, it provides a few new verbs special to working with this type of data.

activate() active() `%N>%` `%E>%`

Determine the context of subsequent manipulations

bind_graphs() bind_nodes() bind_edges()

Add graphs, nodes, or edges to a tbl_graph

graph_join()

Join graphs on common nodes

reroute()

Change terminal nodes of edges

focus() unfocus()

Select specific nodes or edges to compute on

iterate_n() iterate_while()

Repeatedly modify a graph by a function

morph() unmorph() crystallise() crystallize() convert()

Create a temporary alternative representation of the graph to compute on

to_linegraph() to_subgraph() to_subcomponent() to_split() to_components() to_largest_component() to_complement() to_local_neighborhood() to_dominator_tree() to_minimum_spanning_tree() to_random_spanning_tree() to_shortest_path() to_bfs_tree() to_dfs_tree() to_simple() to_contracted() to_unfolded_tree() to_directed() to_undirected() to_hierarchical_clusters()

Functions to generate alternate representations of graphs

Graph creation

Graphs and networks can come from many sources, or be created by simulation or deterministacally. Tidygraph provides conversions from all well-known structures in R, as well as a range of create_() and play_*() functions for creating well-defined or simulated graphs.

tbl_graph() as_tbl_graph() is.tbl_graph()

A data structure for tidy graph manipulation

create_ring() create_path() create_chordal_ring() create_de_bruijn() create_empty() create_bipartite() create_citation() create_complete() create_notable() create_kautz() create_lattice() create_star() create_tree()

Create different types of well-defined graphs

play_degree() play_dotprod() play_fitness() play_fitness_power() play_gnm() play_gnp() play_geometry() play_erdos_renyi()

Graph games based on direct sampling

play_blocks() play_blocks_hierarchy() play_islands() play_smallworld()

Graph games based on connected components

play_citation_age() play_forestfire() play_growing() play_barabasi_albert() play_barabasi_albert_aging()

Graph games based on evolution

play_preference() play_preference_asym() play_bipartite() play_traits() play_citation_type()

Graph games based on different node types

Mapping over nodes

Mapping functions over nodes for relational data is different than for standard tabular data as you often want to recurse over a search or in other ways use the graph structure as part of your map.

map_bfs() map_bfs_lgl() map_bfs_chr() map_bfs_int() map_bfs_dbl()

Apply a function to nodes in the order of a breath first search

map_bfs_back() map_bfs_back_lgl() map_bfs_back_chr() map_bfs_back_int() map_bfs_back_dbl()

Apply a function to nodes in the reverse order of a breath first search

map_dfs() map_dfs_lgl() map_dfs_chr() map_dfs_int() map_dfs_dbl()

Apply a function to nodes in the order of a depth first search

map_dfs_back() map_dfs_back_lgl() map_dfs_back_chr() map_dfs_back_int() map_dfs_back_dbl()

Apply a function to nodes in the reverse order of a depth first search

map_local() map_local_lgl() map_local_chr() map_local_int() map_local_dbl()

Map a function over a graph representing the neighborhood of each node

Searches

Searching is central to many graph algorithms and is often performed in either a breath-first, or depth-first manner. Tidygraph provides a slew of functions for extracting out information from such searches.

bfs_rank() bfs_parent() bfs_before() bfs_after() bfs_dist() dfs_rank() dfs_rank_out() dfs_parent() dfs_dist()

Search a graph with depth first and breath first

Centrality

Centrality is a key measure in network analysis, and while it is mainly calculated for nodes, a few algorithms exists for calculating edge centrality as well.

centrality_alpha() centrality_authority() centrality_betweenness() centrality_power() centrality_closeness() centrality_eigen() centrality_hub() centrality_pagerank() centrality_subgraph() centrality_degree() centrality_edge_betweenness() centrality_harmonic() centrality_manual() centrality_closeness_harmonic() centrality_closeness_residual() centrality_closeness_generalised() centrality_integration() centrality_communicability() centrality_communicability_odd() centrality_communicability_even() centrality_subgraph_odd() centrality_subgraph_even() centrality_katz() centrality_betweenness_network() centrality_betweenness_current() centrality_betweenness_communicability() centrality_betweenness_rsp_simple() centrality_betweenness_rsp_net() centrality_information() centrality_decay() centrality_random_walk() centrality_expected()

Calculate node and edge centrality

Community detection

Social network analysis is especially interested in detecting groups or communities within a graph, but such algorithms are also useful in other areas of network research. No single algorithm can provide the correct grouping of nodes so several exists that weigh certain features differently.

group_components() group_edge_betweenness() group_fast_greedy() group_infomap() group_label_prop() group_leading_eigen() group_louvain() group_leiden() group_optimal() group_spinglass() group_walktrap() group_fluid() group_biconnected_component() group_color()

Group nodes and edges based on community structure

Node measures

Tidygraph provides a wide range of algorithms for extracting differnt information about the nodes in a graph, from calculating local measures, to defining whether they are part of certain topological features.

local_size() local_members() local_triangles() local_ave_degree() local_transitivity()

Measures based on the neighborhood of each node

node_eccentricity() node_constraint() node_coreness() node_diversity() node_efficiency() node_bridging_score() node_effective_network_size() node_connectivity_impact() node_closeness_impact() node_fareness_impact()

Querying node measures

node_rank_hclust() node_rank_anneal() node_rank_branch_bound() node_rank_traveller() node_rank_two() node_rank_mds() node_rank_leafsort() node_rank_visual() node_rank_spectral() node_rank_spin_out() node_rank_spin_in() node_rank_quadratic() node_rank_genetic() node_rank_dendser()

Calculate node ranking

node_dominator() node_topo_order()

Node properties related to the graph topology

node_is_cut() node_is_root() node_is_leaf() node_is_sink() node_is_source() node_is_isolated() node_is_universal() node_is_simplical() node_is_center() node_is_adjacent() node_is_keyplayer() node_is_connected()

Querying node types

node_adhesion_to() node_adhesion_from() node_cohesion_to() node_cohesion_from() node_distance_to() node_distance_from() node_cocitation_with() node_bibcoupling_with() node_similarity_with() node_max_flow_to() node_max_flow_from()

Calculate node pair properties

random_walk_rank()

Perform a random walk on the graph and return encounter rank

Edge measures

Fewer quantitative measures exist for edges, but they can still be queried for topological features such as which nodes they link, etc.

edge_is_multiple() edge_is_loop() edge_is_mutual() edge_is_from() edge_is_to() edge_is_between() edge_is_incident() edge_is_bridge() edge_is_feedback_arc()

Querying edge types

edge_rank_eulerian()

Calculate edge ranking

random_walk_rank()

Perform a random walk on the graph and return encounter rank

Graph measures

The graph under investigation can also have properties of its own that can be summarised into quantitative or qualitative values.

graph_is_simple() graph_is_directed() graph_is_bipartite() graph_is_connected() graph_is_tree() graph_is_forest() graph_is_dag() graph_is_chordal() graph_is_complete() graph_is_isomorphic_to() graph_is_subgraph_isomorphic_to() graph_is_eulerian()

Querying graph types

graph_adhesion() graph_assortativity() graph_automorphisms() graph_clique_num() graph_clique_count() graph_component_count() graph_motif_count() graph_diameter() graph_girth() graph_radius() graph_mutual_count() graph_asym_count() graph_unconn_count() graph_size() graph_order() graph_reciprocity() graph_min_cut() graph_mean_dist() graph_modularity() graph_efficiency()

Graph measurements

Misc

Outside of the verbs and algorithms there is a few helper functions available to streamline graph manipulation.

.G() .N() .E()

Access graph, nodes, and edges directly inside verbs

with_graph()

Evaluate a tidygraph algorithm in the context of a graph