-
Notifications
You must be signed in to change notification settings - Fork 4
/
13-fcns_inspection.Rmd
709 lines (354 loc) · 19.9 KB
/
13-fcns_inspection.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
# Functions: Inspection {#fcns_inspection}
## `node_info()`
<img src="diagrams/inspection/node_info.svg">
<h4><em>Get detailed information on nodes</em></h4>
<h5>DESCRIPTION</h5>
Obtain a data frame with detailed information on nodes and their interrelationships within a graph.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
## `edge_info()`
<img src="diagrams/inspection/edge_info.svg">
<h4><em>Get detailed information on edges</em></h4>
<h5>DESCRIPTION</h5>
Obtain a data frame with detailed information on edges and their interrelationships within a graph.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
## `graph_info()`
<img src="diagrams/inspection/graph_info.svg">
<h4><em>Get metrics for a graph</em></h4>
<h5>DESCRIPTION</h5>
Get a data frame with metrics for a graph.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
## `get_node_ids()`
<img src="diagrams/inspection/get_node_ids.svg">
<h4><em>Get a vector of node ID values</em></h4>
<h5>DESCRIPTION</h5>
Obtain a vector of node ID values from a graph object or a node data frame. An optional filter by node attribute can limit the set of node ID values returned.
<h5>PARAMETERS</h5>
**`x`** either a graph object of class `dgr_graph` or a node data frame.
**`conditions`** an option to use filtering conditions for the retrieval of nodes.
## `get_edge_ids()`
<img src="diagrams/inspection/get_edge_ids.svg">
<h4><em>Get a vector of edge ID values</em></h4>
<h5>DESCRIPTION</h5>
Obtain a vector of edge ID values from a graph object. An optional filter by edge attribute can limit the set of edge ID values returned.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
**`conditions`** an option to use filtering conditions for the retrieval of edges.
## `get_edges()`
<img src="diagrams/inspection/get_edges.svg">
<h4><em>Get node IDs associated with edges</em></h4>
<h5>DESCRIPTION</h5>
Obtain a vector, data frame, or list of node IDs from a graph object or an edge data frame. An optional filter by edge attribute can limit the set of edges returned.
<h5>PARAMETERS</h5>
**`x`** either a graph object of class `dgr_graph` or an edge data frame.
**`conditions`** an option to use filtering conditions for the retrieval of edges.
**`return_type`** using `vector` (the default), a vector of character objects representing the edges is provided. With `list` a list object will be provided that contains vectors of outgoing and incoming node IDs associated with edges. With `df`, a data frame containing outgoing and incoming node IDs associated with edges.
**`return_values`** using `id` (the default) results in node ID values returned in the edge definitions. With `label`, the node labels will instead be used to define edges.
## `get_predecessors()`
<img src="diagrams/inspection/get_predecessors.svg">
<h4><em>Get node IDs for predecessor nodes to the specified node</em></h4>
<h5>DESCRIPTION</h5>
Provides a vector of node IDs for all nodes that have a connection to the given node.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
**`node`** a node ID for the selected node.
## `get_successors()`
<img src="diagrams/inspection/get_successors.svg">
<h4><em>Get node IDs for successor nodes to the specified node</em></h4>
<h5>DESCRIPTION</h5>
Provides a vector of node IDs for all nodes that have a connection from the given node.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
**`node`** a node ID for the selected node.
## `get_node_df()`
<img src="diagrams/inspection/get_node_df.svg">
<h4><em>Get a node data frame from a graph</em></h4>
<h5>DESCRIPTION</h5>
From a graph, obtain a node data frame with all current node attributes.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
## `get_edge_df()`
<img src="diagrams/inspection/get_edge_df.svg">
<h4><em>Get an edge data frame from a graph</em></h4>
<h5>DESCRIPTION</h5>
From a graph, obtain an edge data frame with all current edge attributes.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
## `node_count()`
<img src="diagrams/inspection/node_count.svg">
<h4><em>Get count of all nodes or certain types of nodes</em></h4>
<h5>DESCRIPTION</h5>
From a graph object of class `dgr_graph`, get a count of nodes in the graph and optionally obtain a count of nodes by their type.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
**`type`** either a logical value, where `TRUE` provides a named vector of node count by type and `FALSE` (the default) provides a total count, or, a character vector of `type` values to filter the node count.
## `edge_count()`
<img src="diagrams/inspection/edge_count.svg">
<h4><em>Get count of all edges or edges with distinct relationship types</em></h4>
<h5>DESCRIPTION</h5>
From a graph object of class `dgr_graph`, get a count of edges in the graph and optionally obtain a count of edges by their relationship type.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
**`rel`** either a logical value, where `TRUE` provides a named vector of edge count by type and `FALSE` (the default) provides a total count of edges, or, a string corresponding to one or more edge relationship types.
## `node_present()`
<img src="diagrams/inspection/node_present.svg">
<h4><em>Determine whether a specified node is present</em></h4>
<h5>DESCRIPTION</h5>
From a graph object of class `dgr_graph`, determine whether a specified node is present.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
**`node`** a value that may or may not match a node ID in the graph.
## `edge_present()`
<img src="diagrams/inspection/edge_present.svg">
<h4><em>Determine whether a specified edge is present</em></h4>
<h5>DESCRIPTION</h5>
From a graph object of class `dgr_graph`, determine whether a directed edge (defined by a pair of node IDs extant in the graph) is present.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
**`from`** a node ID from which the edge to be queried is outgoing.
**`to`** a node ID to which the edge to be queried is incoming.
## `is_graph_empty()`
<img src="diagrams/inspection/is_graph_empty.svg">
<h4><em>Is the graph empty?</em></h4>
<h5>DESCRIPTION</h5>
Provides a logical value on whether the graph is empty (i.e., contains no nodes).
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
## `is_graph_directed()`
<img src="diagrams/inspection/is_graph_directed.svg">
<h4><em>Is the graph a directed graph?</em></h4>
<h5>DESCRIPTION</h5>
Determines whether a graph is set to be directed or not and returns a logical value to that effect.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
## `is_graph_connected()`
<img src="diagrams/inspection/is_graph_connected.svg">
<h4><em>Is the graph a connected graph?</em></h4>
<h5>DESCRIPTION</h5>
Determines whether a graph is a connected graph.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
## `is_property_graph()`
<img src="diagrams/inspection/is_property_graph.svg">
<h4><em>Is the graph a property graph?</em></h4>
<h5>DESCRIPTION</h5>
Provides a logical value on whether the graph is property graph (i.e., all nodes have an assigned `type` value and all edges have an assigned `rel` value).
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
## `get_degree_in()`
<img src="diagrams/inspection/get_degree_in.svg">
<h4><em>Get indegree values for all nodes</em></h4>
<h5>DESCRIPTION</h5>
Get the indegree values for all nodes in a graph.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
**`normalized`** set as `FALSE` (the default), the the indegree will be provided for each of the nodes (as a count of edges to each node). When set as `TRUE`, then the result for each node will be divided by the total number of nodes in the graph minus 1.
## `get_degree_out()`
<img src="diagrams/inspection/get_degree_out.svg">
<h4><em>Get outdegree values for all nodes</em></h4>
<h5>DESCRIPTION</h5>
Get the outdegree values for all nodes in a graph.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
**`normalized`** set as `FALSE` (the default), the the outdegree will be provided for each of the nodes (as a count of edges outgoing from each node). When set as `TRUE`, then the result for each node will be divided by the total number of nodes in the graph minus 1.
## `get_degree_total()`
<img src="diagrams/inspection/get_degree_total.svg">
<h4><em>Get total degree values for all nodes</em></h4>
<h5>DESCRIPTION</h5>
Get the total degree values for all nodes in a graph.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
**`normalized`** set as `FALSE` (the default), the the total degree will be provided for each of the nodes (as a count of edges to and from each node). When set as `TRUE`, then the result for each node will be divided by the total number of nodes in the graph minus 1.
## `get_degree_histogram()`
<img src="diagrams/inspection/get_degree_histogram.svg">
<h4><em>Get histogram data for a graph's degree frequency</em></h4>
<h5>DESCRIPTION</h5>
Get histogram data for a graph's degree frequency. The bin width is set to 1 and zero-value degrees are omitted from the output.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
## `get_degree_distribution()`
<img src="diagrams/inspection/get_degree_distribution.svg">
<h4><em>Get degree distribution data for a graph</em></h4>
<h5>DESCRIPTION</h5>
Get degree distribution data for a graph. Graph degree is represented as a frequency of degree values over all nodes in the graph.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
## `get_graph_diameter()`
<img src="diagrams/inspection/get_graph_diameter.svg">
<h4><em>Get the graph diameter</em></h4>
<h5>DESCRIPTION</h5>
Get the graph diameter, which is the maximum eccentricity.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
## `get_constraint()`
<img src="diagrams/inspection/get_constraint.svg">
<h4><em>Get constraint scores for one or more graph nodes</em></h4>
<h5>DESCRIPTION</h5>
Get the constraint scores (based on Burt's Constraint Index) for one or more nodes in a graph.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
**`nodes`** an optional vector of node IDs to consider for constraint scores. If not supplied, then constraint scores for all nodes in the graph will be calculated.
## `get_betweenness()`
<img src="diagrams/inspection/get_betweenness.svg">
<h4><em>Get betweenness centrality scores</em></h4>
<h5>DESCRIPTION</h5>
Get the betweenness centrality scores for all nodes in a graph.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
## `get_closeness()`
<img src="diagrams/inspection/get_closeness.svg">
<h4><em>Get closeness centrality values</em></h4>
<h5>DESCRIPTION</h5>
Get the closeness centrality values for all nodes in a graph.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
**`direction`** using `all` (the default), the search will ignore edge direction while traversing through the graph. With `out`, measurements of paths will be from a node whereas with `in`, measurements of paths will be to a node.
## `get_bridging()`
<img src="diagrams/inspection/get_bridging.svg">
<h4><em>Get bridging scores</em></h4>
<h5>DESCRIPTION</h5>
Get the bridging scores (based on Valente's Bridging vertex measure) for all nodes in a graph.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
## `get_eccentricity()`
<img src="diagrams/inspection/get_eccentricity.svg">
<h5>DESCRIPTION</h5>
<h4><em>Get node eccentricities</em></h4>
Get a named vector or data frame with node eccentricity values.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
**`nodes`** an optional vector of node IDs for filtering the list of nodes present in the graph.
**`return_type`** using `vector` (the default) will provide a named vector of eccentricity values (the node IDs serve as names). With `df`, a data frame containing node IDs and eccentricity values is provided.
## `get_jaccard_similarity()`
<img src="diagrams/inspection/get_jaccard_similarity.svg">
<h4><em>Get Jaccard similarity coefficient scores</em></h4>
<h5>DESCRIPTION</h5>
Get the Jaccard similiarity coefficient scores for one or more nodes in a graph.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
**`nodes`** an optional vector of node IDs to consider for Jaccard similarity scores. If not supplied, then similarity scores will be provided for every pair of nodes in the graph.
**`direction`** using `all` (the default), the function will ignore edge direction when determining scores for neighboring nodes. With `out` and `in`, edge direction for neighboring nodes will be considered.
**`round_to`** the maximum number of decimal places to retain for the Jaccard similarity coefficient scores. The default value is `3`.
## `get_dice_similarity()`
<img src="diagrams/inspection/get_dice_similarity.svg">
<h4><em>Get Dice similarity coefficient scores</em></h4>
<h5>DESCRIPTION</h5>
Get the Dice similiarity coefficient scores for one or more nodes in a graph.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
**`nodes`** an optional vector of node IDs to consider for Dice similarity scores. If notsupplied, then similarity scores will be provided for every pair of nodes in the graph.
**`direction`** using `all` (the default), the function will ignore edge direction when determining scores for neighboring nodes. With `out` and `in`, edge direction for neighboring nodes will be considered.
**`round_to`** the maximum number of decimal places to retain for the Dice similarity coefficient scores. The default value is \code{3}.
## `get_periphery()`
<img src="diagrams/inspection/get_periphery.svg">
<h4><em>Get nodes that form the graph periphery</em></h4>
<h5>DESCRIPTION</h5>
Get those nodes that are part of the graph periphery (i.e., have the maximum eccentricity in the graph).
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
## `get_cmty_walktrap()`
<img src="diagrams/inspection/get_cmty_walktrap.svg">
<h4><em>Get community membership using the Walktrap method</em></h4>
<h5>DESCRIPTION</h5>
With the Walktrap community finding algorithm, obtain the group membership values for each of the nodes in the graph.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
**`steps`** the number of steps to take for each of the random walks.
## `get_cmty_louvain()`
<img src="diagrams/inspection/get_cmty_louvain.svg">
<h4><em>Get community membership by Louvain optimization</em></h4>
<h5>DESCRIPTION</h5>
Through the use of multi-level optimization of a modularity score, obtain the group membership values for each of the nodes in the graph.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
## `get_cmty_l_eigenvec()`
<img src="diagrams/inspection/get_cmty_l_eigenvec.svg">
<h4><em>Get community membership by leading eigenvector</em></h4>
<h5>DESCRIPTION</h5>
Through the calculation of the leading non-negative eigenvector of the modularity matrix of the graph, obtain the group membership values for each of the nodes in the graph.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
## `get_cmty_fast_greedy()`
<img src="diagrams/inspection/get_cmty_fast_greedy.svg">
<h4><em>Get community membership by modularity optimization</em></h4>
<h5>DESCRIPTION</h5>
Through the use of greedy optimization of a modularity score, obtain the group membership values for each of the nodes in the graph.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
## `get_cmty_edge_btwns()`
<img src="diagrams/inspection/get_cmty_edge_btwns.svg">
<h4><em>Get community membership by edge betweenness</em></h4>
<h5>DESCRIPTION</h5>
Using edge betweenness, obtain the group membership values for each of the nodes in the graph.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
## `get_nbrs()`
<img src="diagrams/inspection/get_nbrs.svg">
<h4><em>Get all neighbors of one or more nodes</em></h4>
<h5>DESCRIPTION</h5>
With one or more nodes, get the set of all neighboring nodes.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
**`nodes`** a vector of node ID values.
## `get_non_nbrs()`
<img src="diagrams/inspection/get_non_nbrs.svg">
<h4><em>Get non-neighbors of a node in a graph</em></h4>
<h5>DESCRIPTION</h5>
Get the set of all nodes not neighboring a single graph node.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
**`node`** a single-length vector containing a node ID value.
## `get_common_nbrs()`
<img src="diagrams/inspection/get_common_nbrs.svg">
<h4><em>Get all common neighbors between two or more nodes</em></h4>
<h5>DESCRIPTION</h5>
With two or more nodes, get the set of common neighboring nodes.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
**`nodes`** a vector of node ID values of length at least 2.
## `get_similar_nbrs()`
<img src="diagrams/inspection/get_similar_nbrs.svg">
<h4><em>Get neighboring nodes based on node attribute similarity</em></h4>
<h5>DESCRIPTION</h5>
With a graph a single node serving as the starting point, get those nodes in a potential neighborhood of nodes (adjacent to the starting node) that have a common or similar (within threshold values) node attribute to the starting node.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
**`node`** a single-length vector containing a node ID value.
**`node_attr`** the name of the node attribute to use to compare with adjacent nodes.
**`tol_abs`** if the values contained in the node attribute `node_attr` are numeric, one can optionally supply a numeric vector of length 2 that provides a lower and upper numeric bound as criteria for neighboring node similarity to the starting node.
**`tol_pct`** if the values contained in the node attribute `node_attr` are numeric, one can optionally supply a numeric vector of length 2 that specifies lower and upper bounds as negative and positive percentage changes to the value of the starting node. These bounds serve as criteria for neighboring node similarity to the starting node.
## `get_paths()`
<img src="diagrams/inspection/get_paths.svg">
<h4><em>Get paths from a specified node in a directed graph</em></h4>
<h5>DESCRIPTION</h5>
Obtain a list of all possible paths from a given node within a directed graph.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
**`from`** the node from which all paths will be determined.
**`to`** the node to which all paths will be determined.
**`shortest_path`** an option to return paths that are the shortest in the set of all determined paths.
**`longest_path`** an option to return paths that are the longest in the set of all determined paths.
**`distance`** a vector of integer values that specify which of the valid paths to return when filtering by distance.
## `get_w_connected_cmpts()`
<img src="diagrams/inspection/get_W_connected_cmpts.svg">
<h4><em>Get all nodes associated with connected components</em></h4>
<h5>DESCRIPTION</h5>
Determine which nodes in a graph belong to different weakly connected components (i.e., distinct sets of nodes with traversable paths to and from each node in the set).
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
## `get_s_connected_cmpts()`
<img src="diagrams/inspection/get_s_connected_cmpts.svg">
<h4><em>Get nodes within strongly connected components</em></h4>
<h5>DESCRIPTION</h5>
Determine which nodes in a graph belong to different strongly connected components.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.
## `get_articulation_points()`
<img src="diagrams/inspection/get_articulation_points.svg">
<h4><em>Get articulation points</em></h4>
<h5>DESCRIPTION</h5>
Get the nodes in the graph that are identified as articulation points.
<h5>PARAMETERS</h5>
**`graph`** a graph object of class `dgr_graph`.