You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To retrieve attributes, you can also use `graph_attr()`, `vertex_attr()`, and `edge_attr()`. To find the ID of a vertex you can use the function `match()`:
293
293
294
294
```{r echo = TRUE}
295
-
match(c("George"), V(g)$name)
295
+
match(c("Ibrahim"), V(g)$name)
296
296
```
297
297
298
298
To assign attributes to a subset of vertices or edges, you can use:
@@ -334,7 +334,7 @@ degree(g, v = c(3, 4, 5))
334
334
Most functions that accept vertex IDs also accept vertex _names_ (the values of the `name` vertex attribute) as long as the names are unique:
335
335
336
336
```{r echo = TRUE}
337
-
degree(g, v = c("Carmina", "Frank", "Dennis"))
337
+
degree(g, v = c("Carmina", "Moshe", "Nang"))
338
338
```
339
339
340
340
It also works for single vertices:
@@ -453,7 +453,7 @@ E(g)[.from("Carmina")]
453
453
454
454
Using `.to()` filters edge sequences based on the target vertices. This is different from `.from()` if the graph is directed, while it gives the same answer for undirected graphs. Using `.inc()` selects only those edges that are incident on a single vertex or at least one of the vertices, irrespective of the edge directions.
455
455
456
-
The `%--%` operator can be used to select edges between specific groups of vertices, ignoring edge directions in directed graphs. For instance, the following expression selects all the edges between Carmina (vertex index 3), Dennis (vertex index 5) and Esther (vertex index 6):
456
+
The `%--%` operator can be used to select edges between specific groups of vertices, ignoring edge directions in directed graphs. For instance, the following expression selects all the edges between Carmina (vertex index 3), Nang (vertex index 5) and Samira (vertex index 6):
457
457
458
458
```{r echo = TRUE}
459
459
E(g)[3:5 %--% 5:6]
@@ -487,7 +487,7 @@ The adjacency matrix is another way to represent a graph. In an adjacency matrix
487
487
as_adjacency_matrix(g)
488
488
```
489
489
490
-
For example, Carmina (`1, 0, 0, 1, 1, 1, 0`) is directly connected to Alejandra (who has vertex index 1), Frank (index 4), Dennis (index 5) and Esther (index 6), but not to Bruno (index 2) or to George (index 7).
490
+
For example, Carmina (`1, 0, 0, 1, 1, 1, 0`) is directly connected to Alejandra (who has vertex index 1), Moshe (index 4), Nang (index 5) and Samira (index 6), but not to Bruno (index 2) or to Ibrahim (index 7).
Para recuperar atributos, también puedes utilizar `graph_attr()`, `vertex_attr()` y `edge_attr()`. Para encontrar el ID de un vértice puedes utilizar la función `match()`:
305
305
306
306
```{r echo = TRUE}
307
-
match(c("George"), V(g)$name)
307
+
match(c("Ibrahim"), V(g)$name)
308
308
```
309
309
310
310
Para asignar atributos a un subconjunto de vértices o aristas, puedes utilizar:
@@ -346,7 +346,7 @@ degree(g, v = c(3,4,5))
346
346
La mayoría de las funciones que aceptan los IDs de los vértices también aceptan los "nombres" de los vértices (es decir, los valores del atributo `name` del vértice) siempre que los nombres sean únicos:
347
347
348
348
```{r echo = TRUE}
349
-
degree(g, v = c("Carmina", "Frank", "Dennis"))
349
+
degree(g, v = c("Carmina", "Moshe", "Nang"))
350
350
```
351
351
352
352
También funciona para vértices individuales:
@@ -465,7 +465,7 @@ E(g)[.from("Carmina")]
465
465
466
466
Al usar `.to()`, se filtran la serie de aristas en función de los vértices de destino o diana. Esto es diferente de `.from()` si el grafo es dirigido, mientras que da la misma respuesta para grafos no dirigidos. Con `.inc()` sólo se seleccionan las aristas que inciden en un único vértice o en al menos uno de los vértices, independientemente de la dirección de las aristas.
467
467
468
-
La expresión `%--%` es un operador especial que puede utilizarse para seleccionar todas las aristas entre dos conjuntos de vértices. Ignora las direcciones de las aristas en los grafos dirigidos. Por ejemplo, la siguiente expresión selecciona todas las aristas entre Carmina (su ID de vértice es el 3), Dennis (su ID de vértice es el 5) y Esther (su ID de vértice es el 6):
468
+
La expresión `%--%` es un operador especial que puede utilizarse para seleccionar todas las aristas entre dos conjuntos de vértices. Ignora las direcciones de las aristas en los grafos dirigidos. Por ejemplo, la siguiente expresión selecciona todas las aristas entre Carmina (su ID de vértice es el 3), Nang (su ID de vértice es el 5) y Samira (su ID de vértice es el 6):
469
469
470
470
```{r echo = TRUE}
471
471
E(g) [ 3:5 %--% 5:6 ]
@@ -499,7 +499,7 @@ Una matriz de adyacencia es otra manera de representar un grafo. En la matriz de
499
499
as_adjacency_matrix(g)
500
500
```
501
501
502
-
Por ejemplo, Carmina (`1, 0, 0, 1, 1, 1, 0`) está directamente conectada con Alejandra (que tiene el índice 1), Frank (índice 4), Dennis (índice 5), Esther (índice 6) y , pero no con Bruno (índice 2) ni con George (índice 7).
502
+
Por ejemplo, Carmina (`1, 0, 0, 1, 1, 1, 0`) está directamente conectada con Alejandra (que tiene el índice 1), Moshe (índice 4), Nang (índice 5), Samira (índice 6) y , pero no con Bruno (índice 2) ni con Ibrahim (índice 7).
0 commit comments